Summary
Fastify can treat a JSON Schema value of false as if no schema were configured, even though Draft 7 defines false as a valid schema that rejects every instance. When a route uses this deny-all schema for request data, an unauthenticated client may reach the handler without validation, potentially enabling unauthorized state changes or disabled operations.
Affected context
The issue occurs in Fastify applications that use request schemas for route bodies, query strings, path parameters, or headers and assign the boolean false to deny all matching input. It becomes risky when the framework interprets that value as an absent schema, leaving the route handler reachable without the intended rejection behavior.
Exploit preconditions
- Attack surface: HTTP routes exposed by a Fastify application
- Required access: No authentication may be required if the affected route is publicly reachable
- Trigger point: A request reaches a route whose body, querystring, params, or headers schema is set to
false - Why exploitation is possible: Fastify may skip validator compilation because JavaScript truthiness treats
falseas absent, despite JSON Schema defining it as a valid deny-all schema
Why this happens
The underlying bug is a mismatch between JavaScript truthiness checks and JSON Schema semantics. Treating a schema value of false as equivalent to a missing schema prevents the validator from being compiled, so requests are accepted by the routing layer and passed to the handler without the intended rejection rule. This behavior maps to CWE-20: Improper Input Validation because the application fails to enforce a declared validation constraint.
Potential impact
- Unauthenticated clients may reach handlers intended to be inaccessible
- Unauthorized state changes could occur
- Disabled or deny-all operations may be executed
- Application authorization assumptions could be bypassed
- Downstream systems may receive inputs that should have been rejected
General mitigation guidance
Mitigation generally focuses on preserving the distinction between an absent schema and a valid boolean false schema.
Common defensive patterns include:
- Use framework behavior that recognizes all valid JSON Schema values, including boolean schemas
- Apply explicit route-level authorization checks in handlers rather than relying solely on schema rejection
- Define deny-all routes and input policies using supported, unambiguous schema constructs
- Maintain dependencies within vendor-supported versions that contain the relevant behavioral correction
- Add regression tests confirming that
falseschemas reject requests across body, query, parameter, and header locations - Apply least-privilege permissions to handlers and downstream operations so validation failures do not become broad state changes
How teams detect issues like this
Organizations can look for this issue through:
- Static analysis and code review searches for route schemas assigned the literal
false - Tests that verify deny-all schemas reject requests rather than merely checking that routes register successfully
- Runtime monitoring for unexpected access to disabled endpoints or handlers
- Policy checks requiring explicit authorization enforcement for sensitive route operations
- Dependency and framework behavior testing in CI, including regression cases for boolean JSON Schemas
Automated code review and software composition analysis tools may help identify affected dependency usage and risky route configurations.

