Security · Secure Coding
How would you answer an interview scenario involving input validation?
In an interview, I would first define input validation and the problem it solves, then explain how I would validate at trust boundaries, use allowlists for constrained values, reject oversized input, separate syntactic from business validation, return safe errors, and avoid using validation as the only defense against injection. I would also call out the main failure mode: blocking a list of known bad strings is easy to bypass and can reject legitimate data while still allowing attacks in contexts the filter did not anticipate. Finally, I would describe how I would test, monitor, and safely roll back or recover the solution.