Changelog - 2026-11-06
A where filter is limited to 20 levels of and / or nesting
Security Behavior ChangeIn one line. The where schema had no depth limit and its cost grows with the square of the depth, so one request with a deeply nested and / or chain could occupy the event loop for a long time. A where nested deeper than 20 levels is now a validation issue, found before the schema walks it.
What changed
- A depth check first. An iterative check measures the
and/ornesting on the raw value and stops at the limit; a flatwhereis depth 1. Wide filters (many siblings) are not affected. - Where it applies. The
whereof a filter, awheresent as a JSON string, thewhereof anincludescope, and the search filters built from the same schema. - Configurable.
QuerySchemaFactory.build({ limits: { whereDepth: 50 } })changes the limit for the schemas it builds. The default is 20.
Who is affected
- Clients that send a filter nested deeper than 20 levels. They get a validation error. Real filters stay in single digits.
- Everyone else. No action needed.
Details
| File | Package |
|---|---|
src/schemas/builder.ts | filter |
src/schemas/where-depth.ts | filter |