Review an Input Validation Boundary for Missing Cases and Inconsistent Rules

Review the following input validation code as a skeptical reviewer. The goal is to find inputs that get through when they should not, and valid inputs that get rejected.

Language and framework: [fill in]
Where this input comes from: [HTTP body, CLI arg, file upload, queue message, etc.]
What the downstream code assumes about the data: [types, ranges, lengths, formats]
Code under review:
[paste code]

Check and report on each of these, quoting the relevant line:
- Validation happening at the boundary versus scattered or repeated later, and any path that bypasses it.
- Missing cases: null, empty string, whitespace-only, very long values, negative or zero numbers, huge numbers, unicode and mixed-script text, duplicate keys, unexpected extra fields, wrong types that coerce silently.
- Rules that disagree with each other or with the database schema, documentation, or client-side checks.
- Validate-then-transform ordering mistakes, such as trimming or normalizing after the check.
- Error responses that reveal internals or fail to say which field was wrong.

Return a ranked list of findings with severity, a concrete failing input for each, and a suggested fix. Then list five test inputs I should add. If the code looks sound for a category, say so briefly rather than inventing a problem.

Sign in to upvote this prompt.