Skip to content

fix(deps): Bump zod to 4.6.7 for GHSA-mrhx-c7xc-m3w5 - #562

Merged
Jeffreyhung merged 2 commits into
mainfrom
fix/bump-zod
Nov 4, 2026
Merged

Jeffreyhung merged 2 commits into
mainfrom
fix/bump-zod

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

zod < 4.6.6 parses every element of an array/set/map schema and records an issue per invalid element before any upper size bound runs, so oversized input can exhaust memory (GHSA-mrhx-c7xc-m3w5). Semgrep flagged it on #561.

Changes

  • Direct zod dependency ^4.4.3 → ^4.6.7 in packages/warden, packages/warden-service, packages/warden-service-api, packages/evals, and apps/warden-service.
  • New pnpm.overrides entry "zod@>=4.0.0 <4.6.6": "4.6.7" for the transitive [email protected] pulled in by the Vercel CLI (vercel, @vercel/cli-auth, @vercel/cli-config).
  • specs/jsonl-schema.json regenerated. zod 4.6 emits slightly different JSON Schema: a primitive union collapses to type: [...], and the datetime pattern now requires seconds.

Behavior change to know about

z.string().datetime() in 4.6 rejects minute-precision timestamps (2026-01-01T00:00Z). 4.4.3 accepted them. Every timestamp Warden and the service client produce comes from Date#toISOString(), which always includes seconds, so nothing in-repo should be affected. External callers sending from/to to the history API without seconds would now get a 400.

Not covered

  • [email protected] stays, via @vercel/backends, @vercel/express, @vercel/hono, and @vercel/python-analysis. The advisory has no patched 3.x release, and forcing those packages onto zod 4 is a major-version jump inside Vercel's build tooling. That is a deploy-time dependency and doesn't handle untrusted input at runtime.
  • The advisory also recommends adding .max() bounds to collection schemas that parse untrusted input. That needs per-schema limits and is left for a follow-up.

Verification

  • pnpm install --frozen-lockfile succeeds. Every workspace package resolves zod 4.6.7.
  • pnpm lint, pnpm build, and typecheck pass.
  • pnpm test passes except src/skills/remote.test.ts, which needs network git and fails the same way on main in my environment.

via Jeffrey Hung.

--

View Session [Sentry]

Bump the direct zod dependency to ^4.6.7 in every workspace package
and override transitive zod 4.x below 4.6.6 (pulled in by the Vercel
CLI) to 4.6.7. zod < 4.6.6 parses every element of a collection
before applying upper size bounds, which allows memory exhaustion on
oversized input.

Regenerate specs/jsonl-schema.json for the new zod JSON Schema output.

Co-Authored-By: Jeffrey Hung <[email protected]>
@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
warden-prod Ready Ready Preview Nov 4, 2026 7:42pm UTC

Request Review

@Jeffreyhung
Jeffreyhung merged commit 80ee92a into main Nov 4, 2026
21 of 22 checks passed
@Jeffreyhung
Jeffreyhung deleted the fix/bump-zod branch November 4, 2026 19:49
Jeffreyhung added a commit that referenced this pull request Nov 4, 2026
The `evals` job fails before running anything on PRs that touch
`packages/evals/` (e.g. #562): `WARDEN_ANTHROPIC_API_KEY is required to
run evals in CI`. The workflow only wires the Anthropic secret. Warden's
own review workflow dropped that key in #434 and runs on
`WARDEN_OPENROUTER_API_KEY`, which resolves fine on the same PRs. The
evals harness was also hardcoded to Anthropic: suites skipped without
`ANTHROPIC_API_KEY`, and the judge called the Anthropic SDK directly.

## Changes

**Provider selection (`packages/evals/src/provider.ts`)**
- `WARDEN_EVAL_MODEL`: a Pi `provider/model` selector. When set, it
replaces every scenario's model, forces the Pi runtime, and enables the
suites without an Anthropic key.
- `WARDEN_EVAL_JUDGE_MODEL`: optional judge model. Defaults to
`WARDEN_EVAL_MODEL`, then `anthropic/claude-sonnet-4-6`.
- Credentials use the existing `WARDEN_<PROVIDER>_API_KEY` convention,
which eval setup already bridges to the SDK's env name.
- With neither variable set, behavior is unchanged: YAML models,
Anthropic key required.

**Judge**
- `runJudge` now goes through `getRuntime('pi').runAuxiliary` with the
configured model instead of `new Anthropic()`. Same prompt, same
verdict-count validation, same fail-closed fallback.
- Adds an `eval_judge` auxiliary task name so judge calls are labeled in
telemetry.
- `@anthropic-ai/sdk` is no longer a dependency of `warden-evals`.

**Workflow**
- `WARDEN_EVAL_MODEL` defaults to
`openrouter/anthropic/claude-sonnet-4.6`. That's the same model the
suites already pin, so scores stay comparable, on the OpenRouter key the
repo already has. The `WARDEN_EVAL_MODEL` / `WARDEN_EVAL_JUDGE_MODEL`
repo variables override it.
- Passes `WARDEN_OPENROUTER_API_KEY`, `WARDEN_ANTHROPIC_API_KEY`, and
`WARDEN_OPENAI_API_KEY`. Unset secrets are empty and harmless.
- "Verify eval credentials" checks the `WARDEN_<PROVIDER>_API_KEY` for
each selected model and names the missing one.
- "Create eval status check" only runs when verification passed. It used
to throw a second, misleading `Eval results file not found` on top of
the real error.

This PR touches `evals.yml`, so its own `evals` run exercises the
OpenRouter path end to end.

## Verification

- New `provider.test.ts` and `judge.test.ts`. `harness.test.ts` was
updated for the new judge options. The evals unit suite passes: 69
tests.
- `pnpm lint`, `pnpm build`, and typecheck all pass. The Warden
`src/sdk` tests pass.
- With no keys, `pnpm evals` skips all 62 evals, same as before.
- With `WARDEN_EVAL_MODEL=openrouter/anthropic/claude-sonnet-4.6` and a
fake key, the run reaches OpenRouter on Pi and fails with
`Authentication required.`. Without a key it fails locally with `No API
key found for openrouter`.
- I ran the verify step script locally for: valid key, missing key, a
judge on a different provider with a missing key, and a selector without
a provider.

## Notes

- Providers whose SDK env name doesn't follow `<PROVIDER>_API_KEY` (e.g.
`vercel-ai-gateway` → `AI_GATEWAY_API_KEY`) still work locally via the
SDK's own env name. In CI the verify step expects the `WARDEN_`-prefixed
form, so adding one means adding that secret to the workflow env.

<!-- junior-request-attribution:start -->
via **Jeffrey Hung**.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AD0AH1TP6CHJ%3A1793816729.438159 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AD0AH1TP6CHJ%3A1793816729.438159)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0AH1TP6CHJ%3A1793816729.438159/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Jeffrey Hung <[email protected]>
Co-authored-by: Claude <[email protected]>

This branch was successfully deployed

2 active deployments
Preview – warden-prod — 5078c110 Deployed Nov 4, 2026 by vercel[bot]
Preview – warden — 5078c110 Deployed Nov 4, 2026 by vercel[bot]
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.

1 participant