.NET Architecture & System Design Interview Question #167

What is input validation in API design?

Security Architecture, Multi-Tenancy & Disaster Recovery Senior Advanced

Quick Interview Answer

Input validation verifies that incoming data satisfies the expected shape, range, format, and business constraints before it is used.

Detailed Explanation

Input validation verifies that incoming data satisfies the expected shape, range, format, and business constraints before it is used.

Validation improves correctness and reduces attack surface, but it must be combined with context-specific protections such as parameterized database access and output encoding. Never trust data merely because it came from another internal service.

Code Example

Request DTO
   |
syntax/shape validation
   |
business validation
   |
authorized operation