[PR #8231] [MERGED] fix(security): patch remaining dependency advisories on staging #8197

Closed
opened 2026-10-25 04:04:38 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8231
Author: @SpicyMarinara
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/dependabot-security-20261024


📝 Commits (2)

  • 225f625 chore: track dependency security remediation
  • 467c3e1 fix(security): backport Zod bounds and patch vulnerable dependencies

📊 Changes

9 files changed (+731 additions, -104 deletions)

View changed files

➕ patches/zod-security-backport.md (+25 -0)
➕ patches/zod@3.25.76.patch (+441 -0)
📝 pnpm-lock.yaml (+54 -89)
📝 pnpm-workspace.yaml (+13 -1)
➕ scripts/regressions/zod-security-backport.regression.mjs (+166 -0)
📝 tools/dev-mcp/package-lock.json (+10 -10)
📝 tools/dev-mcp/package.json (+4 -1)
📝 tools/dev-mcp/server.mjs (+2 -2)
📝 tools/dev-mcp/test/smoke.mjs (+16 -1)

📄 Description

Linked issue

Closes #8230. Related #8221 / draft #8210: the coordinated native Zod 4 migration remains separate and open.

Why this change

Security fixes must reach staging without silently replacing the Zod 3 interface promised to installed agent packages. The remaining transitive advisories and the separate developer MCP tool also need patched code. Main stays on its normal release schedule.

What changed

  • Collections above an existing schema bound now abort before element transforms or later parent refinements. Bundled Zod 4 also rejects oversized raw sets/maps whose transforms previously collapsed them below the bound, matching the upstream security fix.
  • Backport the upstream collection preflight to both parser generations inside actual Zod 3.25.76, covering ESM/CJS and TypeScript source. Public exports, declarations and the installed-agent API remain Zod 3. No import/export or arbitrary collection-size cap is added; unbounded schemas are deliberately unchanged.
  • Register one explicit GHSA-mrhx-c7xc-m3w5 audit exception for that source backport. A maintained security regression checks the actual installed parsers, sole allowed advisory, exact version, patch registration and frozen-lock hash; it fails closed if these assumptions change. Patch provenance and removal conditions are in patches/zod-security-backport.md.
  • Update body-parser to 2.4.0, the vulnerable Pi-to-Undici edge to 8.12.3, and serialize-javascript to 7.1.3. Preserve OpenAI's peer range and the release-age policy. Lockfile regeneration restores one existing Workbox peer metadata entry without changing its resolved version.
  • Upgrade the isolated developer MCP tool to native Zod 4.6.7 and body-parser 2.4.0, fix its two record signatures, and extend its existing smoke checks. No tool argument ceiling is introduced.

Validation

Current implementation head: 467c3e174.

  • Installed parser regression: 56 bounded sync/async controls passed, plus public API, defaults/transforms, unbounded valid inputs, set/map semantics, object JIT/interpreter, and policy/hash guards. The same bounded probe fails against stock Zod (1,000 element visits / 1,001 issues), then passes with the patch (0 visits / 1 issue).

  • Isolated developer MCP: all 23 tool schemas and fixture stdio smoke passed; isolation 7/7 passed; npm audit reports zero findings.

  • Workspace metadata audit: configured command exits 0 with the one disclosed backport exception. Disabling only that exception in a disposable metadata copy reports exactly the Zod advisory, with no other findings. This is not a claim that upstream 3.25.76 is patched.

  • Local CodeRabbit completed all nine files: one minor CRLF suggestion dismissed with evidence that repository .gitattributes enforces LF even with core.autocrlf=true; no blocking findings. Two independent source reviews found no substantive defect within the documented scope.

  • Full pnpm check: passed on unchanged head 467c3e174 after cleanup, including production builds. The first attempt failed writing shared build outputs due to ENOSPC; its original log is retained. The existing Professor Mari hook warning is unchanged by this PR.

  • Real request/transfer, native JSON import and host-namespace Node regressions passed. The transfer proof retained 10,001 valid roster IDs and 10,001 lorebook entries in a 13 MB export/round-trip. version:check passed.

  • Browser proofs passed: 7 desktop smoke, 5 existing host-namespace cases, and 3 actual browser-exposed Zod probes (desktop Chromium, mobile Chromium, mobile WebKit). The last three prove 0 element visits / 1 bound issue, 10,000 valid unbounded items and legacy Zod 3 records/defaults/error aliases. Local browser replay used isolated direct source-server/Vite processes because normal bootstrap tried the unavailable clean cache; the same smoke assertions and timeouts were retained. Two initial temporary-probe fixture failures and the unchanged replay are preserved; only the missing installed-package fixture setup was corrected.

  • Protected pnpm-validate already unconditionally runs pnpm regression:security, which discovers the new guard. No additional hook or ruleset change was needed.

  • Local clean frozen install hit ENOSPC; offline recovery lacked a cached tarball. Local checks used a private dependency forest with changed package tarballs verified against exact lockfile integrity and relevant edges repaired. This is not a successful local frozen install. The clean hosted frozen install, audit and security suite passed on 467c3e174, and protected pnpm-validate passed its normal startup, smoke and production checks on that same head. Final required checks and Dottore Review remain merge gates.

  • pnpm check passes locally

  • Container (Docker / Podman) built and ran without issue

  • Ran the app, clicked through the changes manually

  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)

  • Above manual verification completed (describe below)

  • Read and followed CONTRIBUTING.md

Manual verification notes

Manually verify installed agents still load and valid imports/exports retain all data. Automated route/import/browser proofs above are complete; mobile results are browser emulation. No physical-device or live exploit test is claimed.

Docs and release impact

Developer-only patch provenance is included. No user-facing docs, app release version or changelog changes.

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

No UI layout or copy change.

Verification packet: https://gist.github.com/SpicyMarinara/22be5ec5db4b9cce878dbc9d57d34367 (source, local and hosted validation, review disposition, and retained failure evidence).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8231 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/dependabot-security-20261024` --- ### 📝 Commits (2) - [`225f625`](https://github.com/Pasta-Devs/Marinara-Engine/commit/225f6250a63f6d29a34b418ebfb34ae6f0c1208e) chore: track dependency security remediation - [`467c3e1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/467c3e1740171bb47727558605414854a65d0948) fix(security): backport Zod bounds and patch vulnerable dependencies ### 📊 Changes **9 files changed** (+731 additions, -104 deletions) <details> <summary>View changed files</summary> ➕ `patches/zod-security-backport.md` (+25 -0) ➕ `patches/zod@3.25.76.patch` (+441 -0) 📝 `pnpm-lock.yaml` (+54 -89) 📝 `pnpm-workspace.yaml` (+13 -1) ➕ `scripts/regressions/zod-security-backport.regression.mjs` (+166 -0) 📝 `tools/dev-mcp/package-lock.json` (+10 -10) 📝 `tools/dev-mcp/package.json` (+4 -1) 📝 `tools/dev-mcp/server.mjs` (+2 -2) 📝 `tools/dev-mcp/test/smoke.mjs` (+16 -1) </details> ### 📄 Description ## Linked issue Closes #8230. Related #8221 / draft #8210: the coordinated native Zod 4 migration remains separate and open. ## Why this change Security fixes must reach staging without silently replacing the Zod 3 interface promised to installed agent packages. The remaining transitive advisories and the separate developer MCP tool also need patched code. Main stays on its normal release schedule. ## What changed - Collections above an existing schema bound now abort before element transforms or later parent refinements. Bundled Zod 4 also rejects oversized raw sets/maps whose transforms previously collapsed them below the bound, matching the upstream security fix. - Backport the upstream collection preflight to both parser generations inside actual Zod 3.25.76, covering ESM/CJS and TypeScript source. Public exports, declarations and the installed-agent API remain Zod 3. No import/export or arbitrary collection-size cap is added; unbounded schemas are deliberately unchanged. - Register one explicit `GHSA-mrhx-c7xc-m3w5` audit exception for that source backport. A maintained security regression checks the actual installed parsers, sole allowed advisory, exact version, patch registration and frozen-lock hash; it fails closed if these assumptions change. Patch provenance and removal conditions are in `patches/zod-security-backport.md`. - Update body-parser to 2.4.0, the vulnerable Pi-to-Undici edge to 8.12.3, and serialize-javascript to 7.1.3. Preserve OpenAI's peer range and the release-age policy. Lockfile regeneration restores one existing Workbox peer metadata entry without changing its resolved version. - Upgrade the isolated developer MCP tool to native Zod 4.6.7 and body-parser 2.4.0, fix its two record signatures, and extend its existing smoke checks. No tool argument ceiling is introduced. ## Validation Current implementation head: `467c3e174`. - Installed parser regression: **56 bounded sync/async controls passed**, plus public API, defaults/transforms, unbounded valid inputs, set/map semantics, object JIT/interpreter, and policy/hash guards. The same bounded probe fails against stock Zod (1,000 element visits / 1,001 issues), then passes with the patch (0 visits / 1 issue). - Isolated developer MCP: all 23 tool schemas and fixture stdio smoke passed; isolation 7/7 passed; npm audit reports zero findings. - Workspace metadata audit: configured command exits 0 with the one disclosed backport exception. Disabling only that exception in a disposable metadata copy reports exactly the Zod advisory, with no other findings. This is not a claim that upstream 3.25.76 is patched. - Local CodeRabbit completed all nine files: one minor CRLF suggestion dismissed with evidence that repository `.gitattributes` enforces LF even with `core.autocrlf=true`; no blocking findings. Two independent source reviews found no substantive defect within the documented scope. - Full `pnpm check`: **passed on unchanged head `467c3e174`** after cleanup, including production builds. The first attempt failed writing shared build outputs due to ENOSPC; its original log is retained. The existing Professor Mari hook warning is unchanged by this PR. - Real request/transfer, native JSON import and host-namespace Node regressions passed. The transfer proof retained 10,001 valid roster IDs and 10,001 lorebook entries in a 13 MB export/round-trip. `version:check` passed. - Browser proofs passed: **7 desktop smoke, 5 existing host-namespace cases, and 3 actual browser-exposed Zod probes** (desktop Chromium, mobile Chromium, mobile WebKit). The last three prove 0 element visits / 1 bound issue, 10,000 valid unbounded items and legacy Zod 3 records/defaults/error aliases. Local browser replay used isolated direct source-server/Vite processes because normal bootstrap tried the unavailable clean cache; the same smoke assertions and timeouts were retained. Two initial temporary-probe fixture failures and the unchanged replay are preserved; only the missing installed-package fixture setup was corrected. - Protected `pnpm-validate` already unconditionally runs `pnpm regression:security`, which discovers the new guard. No additional hook or ruleset change was needed. - Local clean frozen install hit ENOSPC; offline recovery lacked a cached tarball. Local checks used a private dependency forest with changed package tarballs verified against exact lockfile integrity and relevant edges repaired. This is not a successful local frozen install. **The clean hosted frozen install, audit and security suite passed on `467c3e174`**, and protected `pnpm-validate` passed its normal startup, smoke and production checks on that same head. Final required checks and Dottore Review remain merge gates. - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes Manually verify installed agents still load and valid imports/exports retain all data. Automated route/import/browser proofs above are complete; mobile results are browser emulation. No physical-device or live exploit test is claimed. ## Docs and release impact Developer-only patch provenance is included. No user-facing docs, app release version or changelog changes. - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) No UI layout or copy change. Verification packet: https://gist.github.com/SpicyMarinara/22be5ec5db4b9cce878dbc9d57d34367 (source, local and hosted validation, review disposition, and retained failure evidence). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-25 04:04:38 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8197
No description provided.