Repository navigation
Upgrade to zod 4 and bound tool input arrays (v1.9.3) - #24
Merged
Merged
Conversation
Zod reports one issue per failing array element, so an unbounded array in a tool call could exhaust the process memory. Zod 4 checks .max() before it parses elements, but only where a bound is declared, so the upgrade needs bounds on the remaining arrays: parameters (1000), key_columns (100) and options (1000). zod-to-json-schema does not read zod 4 schemas and is replaced by z.toJSONSchema with io: 'input', so fields with a default stay optional. Two silent changes of the migration are kept out and pinned by tests: TRUST_PROXY would have defaulted to the string 'true', and find_rows would have required where. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Docker Scout reports CVE-2023-54404 (GHSA-mrhx-c7xc-m3w5, high) for zod 3.25.76 in the 1.9.2 image. NVD has since rejected the CVE, but GitHub still lists the advisory with 4.6.6 as the fix, so scanners keep reporting it.
Oversized arrays in tool calls did cost excessive memory in our own tests, so this PR does more than bump the version:
.max()before it parses elements.parametersofquery_sqlandexecute_sql(1000),key_columnsofupsert_rows(100),optionsofadd_select_options(1000).zod-to-json-schemaremoved. It doesn't read zod 4 schemas, sogetInputSchemanow usesz.toJSONSchemawithio: 'input'.Behaviour changes
propertyNameson records,maximumon integer fields, and noadditionalProperties: falseon nested objects. Required fields are unchanged and pinned by a test.TRUST_PROXYand the optionalwhereoffind_rowswould have changed silently in the migration. Both keep their behaviour and have tests.Test plan
npm test, typecheck, lint and build passnpm audit --omit=devreports 0 vulnerabilities--memory=512mwith oversized tool calls (mock mode)release-v1.9.3tag🤖 Generated with Claude Code