Skip to content

vuln: remove zod 3.25.76 (GHSA-mrhx-c7xc-m3w5) from trueforge - #1373

Draft
mitanshudodia wants to merge 3 commits into
mainfrom
vuln/trueforge-zod-ghsa-mrhx
Draft

mitanshudodia wants to merge 3 commits into
mainfrom
vuln/trueforge-zod-ghsa-mrhx

Conversation

@mitanshudodia

@mitanshudodia mitanshudodia commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

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 of packages/trueforge; latest 0.0.82 still requires zod ^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:

'@ag-ui/core>zod': '^4.6.7'
'@anthropic-ai/sandbox-runtime>zod': '^4.6.7'

and regenerated pnpm-lock.yaml (pnpm install --lockfile-only). Both now resolve to the workspace's existing zod@4.6.7. No other lockfile changes.

Compatibility / risk

  • Both packages only use basic zod APIs (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 declares zod ^3.25.18 || ^4.0.0.
  • Smoke-tested: loaded both packages against zod 4.6.7 and ran safeParse on all exported schemas — no runtime errors; valid ag-ui ToolSchema/RunAgentInputSchema inputs parse successfully.
  • Risk: subtle zod 3→4 behavioral differences (e.g. error message formats, z.record semantics) 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 matches
  • grype on pnpm-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-lockfile OK; pnpm run typecheck passes for packages/trueforge and packages/trueforge-ui

Docker 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/core and @anthropic-ai/sandbox-runtime use zod@^4.6.7 instead of the vulnerable transitive zod@3.25.76 (GHSA-mrhx-c7xc-m3w5). The lockfile is regenerated accordingly; zod@3.25.76 is removed from the resolved tree while the rest of the workspace stays on existing zod@4.6.7.

Reviewed by Cursor Bugbot for commit 90c71b5. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8fad3f4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@truefoundry/trueforge Patch
@truefoundry/trueforge-ui Patch

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

@veria-ai

veria-ai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

PR overview

No security issues were found in this pull request.

Reviews

Comment thread pnpm-workspace.yaml
Comment on lines +29 to +32
# 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'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing guarantees ag-ui or srt will work with zod v4, we should not override like this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.4 and imports the root zod (v3 API).
  • @ag-ui/core@1.0.x (latest 1.0.4) supports zod v4 properly: peer range ^3.25.18 || ^4.0.0, imports zod/v4.
  • But every @openuidev/react-headless release 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 quick EventSchemas.safeParse check (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.1 and imports the root zod.
  • 0.0.78 through the latest 0.0.83 depend on zod ^3.25.0 but import zod/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, SandboxRuntimeConfigSchema accepts a valid config and rejects an invalid domain with the custom message. That's only a light check, not a guarantee.

Options

  1. 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.
  2. Keep the srt override and bump srt to 0.0.83 (or 0.0.78), so it goes through zod/v3. Then run tests/sandbox/local/smoke.test.ts and the local sandbox hostRun path on Linux and macOS before merging. For ag-ui, either accept the risk or keep its override, since only EventType is used at runtime.
  3. 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).

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread pnpm-workspace.yaml
# 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'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Triggered by project rule: TrueForge review rules

Reviewed by Cursor Bugbot for commit 90c71b5. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@chiragjn
chiragjn marked this pull request as draft November 16, 2026 12:35

This branch has not been deployed

No deployments
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.

2 participants