Repository navigation
vuln: remove zod 3.25.76 (GHSA-mrhx-c7xc-m3w5) from trueforge - #1373
mitanshudodia wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: 8fad3f4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| # GHSA-mrhx-c7xc-m3w5 (zod 3.x memory exhaustion, no fixed 3.x): force zod 4 for transitive deps | ||
| # that still pin zod@3 (@ag-ui/core via @openuidev/react-headless; @anthropic-ai/sandbox-runtime). | ||
| '@ag-ui/core>zod': '^4.6.7' | ||
| '@anthropic-ai/sandbox-runtime>zod': '^4.6.7' |
There was a problem hiding this comment.
nothing guarantees ag-ui or srt will work with zod v4, we should not override like this
There was a problem hiding this comment.
Agreed — the override isn't something upstream supports. I looked for a safer fix and couldn't find a clean one, so I haven't changed any code yet. What I found:
Advisory: GHSA-mrhx-c7xc-m3w5 (High) affects zod < 4.6.6, and the only patched version is 4.6.6. The newest 3.x release is 3.25.76, which is what we have, so there's no fixed 3.x to override to.
@ag-ui/core (via @openuidev/react-headless)
- Every 0.0.x release (up to 0.0.59) depends on
zod ^3.22.4and imports the rootzod(v3 API). @ag-ui/core@1.0.x(latest 1.0.4) supports zod v4 properly: peer range^3.25.18 || ^4.0.0, importszod/v4.- But every
@openuidev/react-headlessrelease up to the latest 0.18.8 pins@ag-ui/core ^0.0.53. So we can't get there with a normal version bump. - Mitigating detail: at runtime, react-headless only imports
EventType(a plain enum) from@ag-ui/core. Everything else it uses is type-only. Building the schemas when the module loads, and a quickEventSchemas.safeParsecheck (RUN_STARTED / TEXT_MESSAGE_CONTENT / ACTIVITY_SNAPSHOT), both work on zod 4.6.7.
@anthropic-ai/sandbox-runtime (we pin 0.0.77)
- 0.0.77 depends on
zod ^3.24.1and imports the rootzod. - 0.0.78 through the latest 0.0.83 depend on
zod ^3.25.0but importzod/v3. zod 4.x still ships that path with the same v3 API. - With the override, bumping srt to ≥0.0.78 would mean it runs exactly the v3 API it was written for, instead of the v4 "classic" API under the root import. I didn't bump it, because 0.0.78+ also changes seccomp, proxy and config code and we pin srt exactly.
- On 0.0.77 with zod 4.6.7,
SandboxRuntimeConfigSchemaaccepts a valid config and rejects an invalid domain with the custom message. That's only a light check, not a guarantee.
Options
- Drop the override and accept/document the risk until upstream moves: react-headless →
@ag-ui/core@1.x, srt → zod v4. This advisory is about memory use when validating oversized arrays. We only use these schemas for srt config (which we control) and ag-ui event parsing, which react-headless doesn't call. - Keep the srt override and bump srt to 0.0.83 (or 0.0.78), so it goes through
zod/v3. Then runtests/sandbox/local/smoke.test.tsand the local sandboxhostRunpath on Linux and macOS before merging. For ag-ui, either accept the risk or keep its override, since onlyEventTypeis used at runtime. - Keep the current overrides and add targeted smoke tests: the srt config parse plus
SandboxManager.initialize/wrapWithSandboxArgv, and the react-headless chat stream.
My preference is (2) for srt and accept/document for ag-ui. Let me know which you'd like and I'll update the PR (it also needs a merge from main).
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 90c71b5. Configure here.
| # GHSA-mrhx-c7xc-m3w5 (zod 3.x memory exhaustion, no fixed 3.x): force zod 4 for transitive deps | ||
| # that still pin zod@3 (@ag-ui/core via @openuidev/react-headless; @anthropic-ai/sandbox-runtime). | ||
| '@ag-ui/core>zod': '^4.6.7' | ||
| '@anthropic-ai/sandbox-runtime>zod': '^4.6.7' |
There was a problem hiding this comment.
Missing changeset for shipped packages
Low Severity
This change alters runtime dependencies of published packages and the frontend bundle that ships in the server tarball, but adds no .changeset/*.md. Repo changeset rules require pnpm changeset with a patch bump for @truefoundry/trueforge and @truefoundry/trueforge-ui.
Additional Locations (1)
Triggered by project rule: TrueForge review rules
Reviewed by Cursor Bugbot for commit 90c71b5. Configure here.
There was a problem hiding this comment.
Valid. The repo's AGENTS.md requires a changeset when a PR changes the deps of published packages. I pushed 8fad3f4, which adds .changeset/zod-ghsa-mrhx-override.md with patch bumps for @truefoundry/trueforge and @truefoundry/trueforge-ui. It's patch only, as the repo rule requires. Nothing else changed.
Scheduled vuln run (2026-11-16): today's devtest grype scan still shows 0 Critical / 1 High (zod 3.25.76, GHSA-mrhx-c7xc-m3w5) on trueforge, so this PR is still needed.
@chiragjn's concern about the zod v4 override is still open and needs an owner decision. There is no fixed 3.x zod release. The alternatives are to accept the override (with the runtime checks described above) or to wait for upstream @openuidev/react-headless and @anthropic-ai/sandbox-runtime releases that support zod v4.


Summary
Removes zod@3.25.76 (High, GHSA-mrhx-c7xc-m3w5 / CVE-2023-54404 — "Zod can exhaust memory while validating oversized constrained collections"; fixed in 4.6.6, no fixed 3.x release) from the trueforge dependency tree.
Scan source: grype on deployed trueforge image
tfy-truefoundry-trueforge-2lz4n:897d02c8…— 0 Critical / 1 High fixable (this zod finding).What changed
zod 3.25.76 was only pulled in transitively by two packages that pin zod 3 as a hard dependency:
@anthropic-ai/sandbox-runtime@0.0.77(direct dep ofpackages/trueforge; latest 0.0.82 still requireszod ^3.25.0)@ag-ui/core@0.0.53(via@openuidev/react-headless; latest react-headless 0.18.8 still pins@ag-ui/core ^0.0.53)Since no parent bump removes zod 3, added targeted pnpm overrides in
pnpm-workspace.yaml:and regenerated
pnpm-lock.yaml(pnpm install --lockfile-only). Both now resolve to the workspace's existingzod@4.6.7. No other lockfile changes.Compatibility / risk
z.object/string/literal/array/record/union/discriminatedUnion/enum/nativeEnum,.superRefine/.strict/.passthrough), all present in zod 4. Newer@ag-ui/core(1.0.4) itself declareszod ^3.25.18 || ^4.0.0.safeParseon all exported schemas — no runtime errors; valid ag-uiToolSchema/RunAgentInputSchemainputs parse successfully.z.recordsemantics) inside these libraries. Note PR chore(deps): bump the npm-minor-and-patch group across 1 directory with 57 updates #1370 bumps sandbox-runtime to 0.0.81, which still depends on zod 3 — override stays relevant after it merges.Verification
grep -n "zod@3" pnpm-lock.yaml→ no matchespnpm-lock.yaml(--only-fixed): zod High 1 → 0 (remaining lockfile Highs are dompurify, addressed by fix: upgrade dompurify to 3.4.17 (GHSA-cg2g-xh64-v4q7) #1355)pnpm install --frozen-lockfileOK;pnpm run typecheckpasses forpackages/trueforgeandpackages/trueforge-uiDocker rebuild not done (no daemon) — owning team must build, test and verify functionally.
Note
Medium Risk
Forcing zod 3→4 under packages that declare zod 3 may cause subtle validation or runtime differences despite basic schema API compatibility.
Overview
Adds pnpm dependency overrides so
@ag-ui/coreand@anthropic-ai/sandbox-runtimeusezod@^4.6.7instead of the vulnerable transitivezod@3.25.76(GHSA-mrhx-c7xc-m3w5). The lockfile is regenerated accordingly;zod@3.25.76is removed from the resolved tree while the rest of the workspace stays on existingzod@4.6.7.Reviewed by Cursor Bugbot for commit 90c71b5. Bugbot is set up for automated code reviews on this repo. Configure here.