Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
chore(prompts): file order 458, high-severity zod CVE pinned into solana-agent-sdk's nested dependency
nirholas5d6b4c8d67fc
diff --git a/prompts/finish/458-auto-solana-agent-sdk-zod-cve.md b/prompts/finish/458-auto-solana-agent-sdk-zod-cve.mdnew file mode 100644index 000000000..66885ae33--- /dev/null+++ b/prompts/finish/458-auto-solana-agent-sdk-zod-cve.md@@ -0,0 +1,55 @@+# 458. High-severity zod CVE pinned into solana-agent-sdk's nested dependency by the most recent commit on main++How to run: paste this file's repo path into a fresh Claude Code chat in this repository and say "run this work order". Runnable now, no gate, no owner action required.++## Operating clause (binding)++- Read CLAUDE.md first. CLAUDE.md overrides everything, including this file.+- Finish 100% in this session. Never end the turn with a question, an option list, or an unexecuted plan. A judgment call goes in one line of the final report; it never becomes a question that halts work.+- The only permitted stops are the CLAUDE.md stop-and-ask gates (spend/on-chain, push/deploy/publish, non-$THREE crypto commit content, destroying unrecoverable data). This order touches none of them: it edits `solana-agent-sdk/package.json`, regenerates lockfiles, and runs local installs/tests.+- The em-dash and en-dash characters are banned in everything you write.+- Concurrent agents share this worktree: stage explicit paths only (never `git add -A` or `git add .`), re-check `git status` and `git diff --staged` before each commit.+- Before committing, run `npm run check:rules -- --paths <files you touched>`. It must exit 0.+- Do not confuse this with prompts/finish/454 (root `bigint-buffer`/`lodash.set`/`node-forge`/`@solana/pay` triage, already filed, different packages entirely) or with 444/449/450 (vendored WORKER dependency CVEs under `workers/`, out of scope here). This order is scoped to one package: `zod`, inside the `solana-agent-sdk` workspace's own nested resolution. Re-check `prompts/finish/` for a number higher than 458 before you start, in case a concurrent agent already filed something that overlaps; if one exists, narrow or drop the overlapping task and say so in the report.++## Why this matters (measured 2026-10-25)++1. **The advisory, from GitHub's own API (not a secondary paraphrase):** `curl https://api.github.com/advisories/GHSA-mrhx-c7xc-m3w5` returns severity `high`, CVSS 7.5 (`AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`), `vulnerable_version_range: "< 4.6.6"`, `first_patched_version: "4.6.6"`. Full description: "Zod schema-validation library through 4.6.5 contains an uncontrolled resource consumption vulnerability that allows attackers to exhaust memory by submitting a large array to an application using an array schema without a length constraint. Attackers can exploit the handleArrayResult parse logic in `$ZodArray`, which accumulates every validation issue for each failing element with no cap or early termination, causing the process to allocate excessive issue objects and crash due to out-of-memory conditions." Note the advisory's own technical detail (`$ZodArray`, `handleArrayResult`) names zod v4's internal class/function, not v3's differently-structured parser; the npm range `< 4.6.6` is a mechanical semver cutoff that also happens to span all of v3.x. Task 1 below requires you to check whether v3.25.76's actual source has the same unbounded-issue-accumulation behavior before treating "unreachable in our schemas" as the only mitigating fact; don't rely on the range field alone to decide severity.+2. **Where it lives in this repo:** root `package.json` pins `"zod": "^4.6.7"` (lines 58, 774; safe, already past the patched version). The nested workspace package `solana-agent-sdk/package.json` declares `"zod": "^3.0.0"` twice, once as an optional `peerDependency` (lines 64-70) and once as a `devDependency` (line 79, used to run its own Jest suite). `node -e "console.log(require('./package-lock.json').packages['solana-agent-sdk/node_modules/zod'].version)"` resolves this to `3.25.76`, inside the vulnerable range, in a nested `node_modules/zod` that root's safe `^4.6.7` pin does not and cannot override (it's a separate resolution tree).+3. **How it got there:** the single most recent commit on `main` at measurement time, `1ad300d5b` ("fix(deps): add the zod 3.25.76 lock entry that npm 11.9.0 in Cloud Build requires"), added this exact lockfile entry for an unrelated reason: Cloud Build's `npm ci` under npm 11.9.0 rejected the lockfile with "Missing: [email protected] from lock file" while npm 11.19.1 accepted it; the lockfile was regenerated under 11.9.0 to match. That commit did not introduce the vulnerable version choice (`^3.0.0` in `solana-agent-sdk/package.json` already existed), it just made the lockfile internally consistent again under the older npm Cloud Build runs. Fixing this order's root cause (bumping the `^3.0.0` ranges) removes the need for that specific pin entirely, but you must re-verify the exact Cloud Build constraint that motivated `1ad300d5b` still holds after your change (see Task 3).+4. **Reachability from live production:** `grep -rl "solana-agent-sdk\|@three-ws/solana-agent" api/ --include="*.js"` finds real, deployed route handlers importing the SDK: `api/agenc/[action].js`, `api/agora/act.js`, `api/agora/[action].js`, `api/_lib/agora-human.js`, `api/x402/vanity-verifiable.js`, `api/_lib/service-catalog/services/vanity-verifiable.js`. These are live, request-handling endpoints, not build tooling.+5. **Narrower schema-usage check, already run:** `grep -n "z\.\w\+(" solana-agent-sdk/src/solana-agent-kit/actions.ts` shows only `z.object`, `z.string`, `z.number` (with `.describe()`, `.max()`, `.min()`, `.int()`, `.positive()`, `.optional()` modifiers); no `z.array`, `z.record`, `z.map`, or `z.set` anywhere in `solana-agent-sdk/src/`. `types.ts`'s only zod import is `import type { z }`, a type-only reference with no runtime parsing. This means the specific "oversized array with no length cap" exploit path described in the advisory is not reachable through solana-agent-sdk's own schema definitions as they stand today, pending Task 1's deeper check of whether v3's own array parser has an equivalent flaw.+6. **Why the fix is cheap regardless of the reachability answer:** every zod builder actually used (`z.object`, `z.string`, `z.number`, `.max`, `.min`, `.int`, `.positive`, `.optional`, `.describe`) is stable, unchanged API across the v3 to v4 major bump. There is no need to choose between "migrate" and "document as accepted risk": bumping `solana-agent-sdk`'s zod ranges to match root's already-safe `^4.6.7` is the correct fix either way, and is a small, low-risk change given this usage surface.++## Tasks++1. **Confirm or rule out v3's own exposure, for the record.** Read the installed `solana-agent-sdk/node_modules/zod/dist/**` (or `node_modules/zod` at whichever path npm resolved 3.25.76 to) array-parsing source and check whether it also accumulates unbounded validation issues with no cap on a failing array of arbitrary size (the v3 equivalent of `$ZodArray`/`handleArrayResult`, likely in a file implementing `ZodArray`'s `_parse`). State the finding in one or two lines in the report: whether v3.25.76 has the same unbounded-allocation pattern or not. This does not change the fix (Task 2 proceeds regardless) but it is the honest answer to "does the GHSA's `< 4.6.6` range actually describe v3's code, or just an npm semver mechanical cutoff."+2. **Bump the vulnerable ranges.** In `solana-agent-sdk/package.json`, change both `"zod": "^3.0.0"` occurrences (the `peerDependencies` entry around line 64 and the `devDependencies` entry around line 79) to `"zod": "^4.6.7"` (matching the root pin exactly, so there is one resolved version across the whole repo instead of two). Leave `peerDependenciesMeta.zod.optional: true` as is.+3. **Regenerate lockfiles and re-verify the Cloud Build constraint that caused `1ad300d5b`.** Run `npm install` at the repo root (this updates the root `package-lock.json`'s `solana-agent-sdk/node_modules/zod` entry, which should now resolve to `4.6.7` or later, ideally collapsing into the already-hoisted root zod so no nested copy is needed at all; confirm with the same `node -e` resolution check used above). Also run `npm install` inside `solana-agent-sdk/` if it has its own `package-lock.json` (confirmed present at `solana-agent-sdk/package-lock.json`). Then specifically re-check the Cloud Build failure mode: confirm `npm ci` succeeds at the root under the npm version actually available in this environment, and grep the updated root lockfile for any remaining `[email protected]` or other pre-4.6.6 zod entries anywhere in the tree (`node -e` walk over `package-lock.json`'s `packages` object checking every key containing `node_modules/zod`) to confirm zero vulnerable resolutions remain repo-wide.+4. **Fix any v3-to-v4 breakage.** Run `solana-agent-sdk`'s own test suite (`cd solana-agent-sdk && npm test`, which runs its Jest suite covering `tests/agent.test.ts`, `tests/actions/*.test.ts`, `tests/wallet/*.test.ts`) and its typecheck (`npm run typecheck` inside `solana-agent-sdk/`). Zod v4 is expected to be a no-op for the builders this SDK uses, but if typecheck or tests surface a real v3-to-v4 signature change (for example in error shape, `.parse` behavior, or type inference), fix the call site in `solana-agent-sdk/src/solana-agent-kit/actions.ts` or `types.ts` to match v4's API rather than downgrading the pin back.+5. **Verify nothing else broke at the root.** Run `npm run test:core` (or at minimum the test files covering the reachable call sites: grep `tests/` for `agenc`, `agora`, `vanity-verifiable` coverage) and `npm audit --json` again to confirm `GHSA-mrhx-c7xc-m3w5` no longer appears for any `zod` resolution in the tree.++## Definition of done++- [ ] `solana-agent-sdk/package.json`'s two `zod` ranges both read `^4.6.7` (or newer, if you deliberately chose a higher compatible version and said why).+- [ ] `node -e` walk of the regenerated root `package-lock.json` finds zero `node_modules/zod` entries below `4.6.6` anywhere in the tree (root or nested).+- [ ] `npm audit --json` at the root no longer lists `GHSA-mrhx-c7xc-m3w5` for `zod`.+- [ ] `solana-agent-sdk`'s own `npm test` and `npm run typecheck` both pass against the new zod version.+- [ ] `npm run test:core` passes (or the specific test files you verified, named explicitly in the report, with a one-line reason if the full suite was impractical to run given prompts/finish/401's known pre-existing failures, which are out of scope here).+- [ ] The Cloud Build `npm ci` constraint from commit `1ad300d5b` is re-verified, not silently reintroduced: state explicitly in the report whether the updated lockfile resolves cleanly under the npm version that previously failed, or why that check could not be reproduced in this environment.+- [ ] `npm run check:rules -- --paths <files you touched>` exits 0.+- [ ] Commit uses explicit paths (`solana-agent-sdk/package.json`, `package-lock.json`, `solana-agent-sdk/package-lock.json`, and any `solana-agent-sdk/src/**` file touched for v3-to-v4 fixes), one topical commit, subject naming the CVE and the package.++## Never blocked++| Blocker | Resolution (act, do not ask) |+|---|---|+| v3.25.76's own array parser is confirmed to NOT have the unbounded-accumulation bug (Task 1 finds it genuinely unreachable) | Still complete the bump (Task 2 onward): a cheap, available fix that removes the advisory entirely is strictly better than documenting an accepted risk, even if the risk turns out to be theoretical for this repo's usage. Do not stop at "documented as unreachable." |+| Zod v4 breaks something non-trivial in `solana-agent-sdk`'s own Jest suite or typecheck | Fix the call site to match v4's API (the usage surface here is narrow: `z.object`/`z.string`/`z.number` with simple modifiers). If a genuinely deep breaking change blocks the bump entirely, pin to the lowest 4.x version that both passes tests and clears `4.6.6`, and say so with the specific error in the report; do not silently fall back to `^3.0.0`. |+| The regenerated lockfile reintroduces the exact `npm ci`/npm-11.9.0 "Missing: zod@X from lock file" failure that `1ad300d5b` fixed | Regenerate with whichever npm major version is available in this environment, note the version used, and state plainly in the report that Cloud Build's specific npm 11.9.0 behavior could not be directly reproduced locally if that's the case, rather than guessing it's fine. |+| `npm install` at the root churns unrelated transitive versions across the whole lockfile | Expected lockfile churn from a real version bump; commit the full lockfile diff, don't hand-edit it, confirm `npm run test:core` still passes despite the churn. |+| `solana-agent-sdk/package-lock.json` (the nested workspace's own lockfile) drifts from the root's resolution after the bump | Regenerate it too (`cd solana-agent-sdk && npm install`) so both lockfiles agree on a single post-4.6.6 zod version; commit both. |++## Report format++Report, in this order: Task 1's v3-source finding (does 3.25.76 actually have the unbounded-issue-accumulation pattern or not, one or two lines); the version bump and lockfile re-verification result including the Cloud Build npm-version check; `solana-agent-sdk` test/typecheck results; root `test:core` and `npm audit` results; any v3-to-v4 call-site fix made; one-line judgment calls. No trailing questions.