Skip to content

bound search proxy query array - #1995

Merged
efstajas merged 2 commits into
mainfrom
fix/search-validator-dos
Oct 28, 2026
Merged

efstajas merged 2 commits into
mainfrom
fix/search-validator-dos

Conversation

@efstajas

@efstajas efstajas commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1991. The search proxy's queries array had no length bound, and zod (before 4.6.6) validates every element of an array before checking its length, which can get very expensive for large request bodies. queries is now capped at 10 and zod is bumped to 4.6.7, which checks the length first.

The bump changed how a z.undefined() object key is treated (it now has to be present), so the remote check uses z.never().optional() instead.

More generally, 4.6 requires object keys whose schema accepts undefined (z.any(), z.unknown(), unions with undefined, ...) to be present unless they're .optional(). The only affected schemas were the RPGF audit log payloads (z.any()), which are now .optional() so entries without a payload keep parsing.

zod collected an issue for every invalid element of an unbounded array, so a few MB of request body allocated gigabytes. Queries are now capped at 10, and zod is bumped to 4.6.7, which checks the length before the elements.
zod 4.6 no longer treats keys whose schema accepts undefined (like z.any()) as optional, so log entries without a payload would have failed to parse.
@efstajas
efstajas merged commit fe158d9 into main Oct 28, 2026
6 of 8 checks passed
@efstajas
efstajas deleted the fix/search-validator-dos branch October 28, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant