You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0306e2b
Browse filesBrowse the repository at this point in the historyBrowse files
Bound input size to prevent heap OOM from wide (not deep) payloads (#126)
The depth cap from the previous commit only protects against deeply-nested
input; a shallow-but-huge array (e.g. a "match" expression with millions of
branches) sails past it untouched. Confirmed by reproducing under a
constrained heap: unlike the stack-overflow case, exhausting the heap is not
a catchable JS error - it aborts the whole process (SIGABRT, "FATAL ERROR:
Reached heap limit"), taking down every concurrent MCP session, not just the
one request.
- Cap the JSON-string form of `expression`/`style` in their Zod schemas, so
oversized payloads are rejected before JSON.parse ever runs. For
validate_expression_tool this has to be a `.refine()` rather than `.max()`
on the union member directly, since the sibling `z.any()` branch would
otherwise swallow oversized strings right past the length check.
- Add an O(1) array-length/object-key-count guard (checked before iterating
or copying) alongside the existing depth guard, so the already-parsed
object-input path is covered too, and so a single oversized array/object
anywhere in the tree is rejected without visiting its elements.
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
0 commit comments