Repository navigation
fix(security): remediate zod and fast-uri audit findings - #2708
Merged
Merged
Conversation
`npm run security:audit` fails on main: - GHSA-mrhx-c7xc-m3w5 (high): zod <4.6.6 can exhaust memory validating oversized constrained collections. The direct dependency resolved to 4.4.3, and @aws/agent-inspector pulls zod@3.25.76 through @ag-ui/core@^0.0.52. zod 3 has no patched release. - GHSA-w74x-v6f9-j3xg, GHSA-xhq7-xmqj-769h, GHSA-wjr9-j795-jxcr, GHSA-333x-w4r6-6crp (moderate/low): fast-uri <3.1.9. - The temporary GHSA-vfj7-8cjw-p6xm (braces) exception is no longer used by the audit report, and the script fails on stale exceptions. Bump zod to ^4.6.6 and override every copy to the root version. The nested @ag-ui/core copy is never loaded at runtime: agent-inspector ships only a prebuilt browser bundle. Raise the fast-uri override to ^3.1.9. Drop the braces exception. evaluateAuditReport now takes the exception map as an option so the tests keep covering the time-boxed exception logic with a fixture instead of the live list.
5 tasks done
Contributor
Package TarballHow to installgh release download pr-2708-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-0.31.1.tgz |
Contributor
|
Claude Security Review: no high-confidence findings. (run) |
Contributor
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Looks good
I verified the substance of the change and found no blocking issues.
What I checked
zodoverride:"$zod"resolves from the rootdependenciesspec (^4.6.6), and@ag-ui/core@0.0.52is the only package in the tree that constrains zod to^3—@modelcontextprotocol/sdk,zod-to-json-schema,zod-validation-error, andeslint-plugin-react-hooksall already accept^4. So the override's blast radius is exactly the one package described in the PR body.- The "never loaded at runtime" claim holds:
src/cli/operations/dev/web-ui/web-server.ts(resolveUIDistDir) andscripts/copy-assets.mjsconsume@aws/agent-inspectoronly as static files fromdist-assets/, so no@ag-ui/coreJS is imported in Node. - Advisory data matches: GHSA-mrhx-c7xc-m3w5 is first patched in
4.6.6(hence no zod-3 fix), and the fast-uri 3.x line is patched at3.1.9. npm-shrinkwrap.jsonis internally consistent — onenode_modules/zod@4.6.7, onenode_modules/fast-uri@3.1.9, no leftover nested copies, rootdependencies.zodupdated. Since the shrinkwrap is published (filesincludes it), the dedupe also reaches consumers.- Injecting
exceptionsintoevaluateAuditReportkeeps the time-boxed logic covered via a fixture while the production map is empty, andscripts/security-audit.mjsstill lines up with the new default parameter (itsdecision.allowedbranch is simply unreachable while the map is empty). - I specifically looked for schema drift from the zod 4.4.3 → 4.6.7 jump, since 4.5/4.6 changed
toJSONSchemaoutput (type-onlyanyOfcompaction, closed-tuple length, chained-check folding, newz.email()pattern).src/schema/uses noz.email(), tuples, ormultipleOf, allz.recordkeys arez.string(), and every.int()precedes its.min()/.max(), soschemas/agentcore.schema.v1.jsonshould be byte-identical. Worth a quicknpm run build:lib && npm run build:schemato confirm no diff before merging, since nothing in CI enforces that file's freshness.
Non-blocking follow-ups (out of scope for this PR)
- The override removes vulnerable zod 3 from the installed tree, but
@aws/agent-inspector's prebuilt browser bundle indist-assets/still contains its own copy of zod 3 code, so for that path the change silences the audit rather than removing the vulnerable code. Low practical risk (local dev UI), and the real fix is the upstream@ag-ui/corebump already noted inoverridesComments. - The vended template
src/assets/typescript/http/vercelai/base/package.jsonstill pins"zod": "^3.24.0", so generated user projects install a version affected by this same advisory with no patched 3.x release. The template already usesai@^6, which supports zod 4, so bumping it in a follow-up looks viable.
nborges-aws
approved these changes
Oct 26, 2026
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.
Description
Fixes the failing
securityjob in Quality and Safety Checks (https://github.com/aws/agentcore-cli/actions/runs/40372130144/job/121746156229).^4.6.6(resolves 4.6.7) and added a"zod": "$zod"override. The override also replaces thezod@3.25.76that@aws/agent-inspectorpulls in through@ag-ui/core@^0.0.52, since zod 3 has no patched release. That copy is never loaded at runtime: agent-inspector ships only a prebuilt browser bundle (dist-assets/).^3.1.8to^3.1.9.evaluateAuditReportnow takes the exception map as an option, so the tests still cover the time-boxed exception logic with a fixture.Companion PR for
refactor: #2709Type of Change
Testing
npm run security:audit: 0 vulnerabilities, exit 0node --test scripts/security-audit.test.mjs: 9/9 passnpm run typecheck,npm run buildnpm test: 6379 passed. One TUI timing test (AddGatewayJwtConfig.test.tsx) failed under full-suite load and passed 3/3 in isolation.