[PR #6037] [MERGED] fix(security): address dependency advisories and isolate archive extraction #7037

Closed
opened 2026-10-23 04:15:57 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: staging ← Head: codex/security-sweep-20260910


📝 Commits (3)

  • 0ed4aec fix(deps): pin patched Hono and YAML versions
  • c896b61 fix(security): isolate runtime archive extraction
  • 3fc5ab1 fix(docker): include dependency patches in Lite installs

📊 Changes

10 files changed (+234 additions, -23 deletions)

View changed files

📝 .github/workflows/security-audit.yml (+1 -0)
📝 CHANGELOG.md (+2 -0)
📝 Dockerfile (+2 -0)
📝 Dockerfile.lite (+2 -0)
📝 package.json (+2 -2)
📝 packages/server/src/services/sidecar/sidecar-runtime.service.ts (+8 -5)
➕ patches/onnxruntime-node@1.24.3.patch (+14 -0)
📝 pnpm-lock.yaml (+21 -16)
📝 pnpm-workspace.yaml (+12 -0)
➕ scripts/regressions/archive-extraction-security.regression.ts (+170 -0)

📄 Description

Linked issue

Closes #6035

Why this change

The sidecar and ONNX installers used predictable extraction directories. A pre-seeded symlink could redirect ZIP output outside the intended directory; the regression reproduces an outside-file overwrite in both original callers. Give both installers exclusive private directories, retain sidecar directory privacy across retries, and install the available Hono/YAML security patches.

What changed

  • Create sidecar extraction directories with native mkdtempSync; clean partial contents while retaining the private directory on retry, and remove temporary directories on failure.
  • Apply a two-line pnpm patch to ONNX Runtime 1.24.3 so its NuGet installer also uses mkdtempSync instead of a timestamped, reusable temporary directory.
  • Include the patch in all dependency-install stages of the full and Lite Dockerfiles and trigger the security workflow for patch changes.
  • Pin Hono 4.13.5 and js-yaml 4.3.2; regenerate the lockfile with pnpm.
  • Document one narrow audit exception for GHSA-vwc7-r8mq-g2x9. adm-zip has no patched release. Its filesystem extraction callers now operate inside private roots; the new behavioral regression is part of pnpm regression:security. Remove the exception/ONNX patch when an upstream fix is available, and preserve this invariant for any new extraction caller. This is a caller mitigation, not an upstream adm-zip fix; raw audit metadata still counts one moderate advisory.

Alert review

Full applicability record.

  • Dismissed 15 inapplicable alerts with individual reasons: unused numeric proxy trust; fast-uri outside network/security policy; unused qs comma/stringify paths; no unbounded runtime Browserslist queries; and unused Hono query/static-generation/dot-body paths. The assessment covers main and staging, not only already-patched staging dependencies.
  • Retained #32 (Fastify primitive-body validation) and #39 (Browserslist custom build stats): patched versions 5.12.1 and 4.28.7 already exist on staging. Capability routes can forward Fastify schemas, and custom stats remain a build-input concern, so these were not blanket-dismissed.
  • Retained #41 (adm-zip): this PR mitigates the reproduced callers on staging. Main remains unchanged.
  • Marinara-Agents has no open Dependabot alerts and needs no code change for this sweep.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Manually verify a real Windows CUDA runtime install and reinstall
  • Read and followed CONTRIBUTING.md

Manual verification notes

Completed locally:

  • pnpm install using the existing dependency cache, then regenerated installation after the dependency changes. Native ONNX binding validation passed on macOS arm64.
  • The new archive regression failed before the fix with both outside sentinel files overwritten. It passes after the fix, covering real ZIP extraction, private POSIX permissions, successful installs, retry directory identity/cleanup, and final-failure cleanup. Only download transports/asset selection are redirected to local fixtures; no real model runtime is executed.
  • pnpm check, pnpm regression:security (18 regression files), pnpm version:check, and git diff --check passed.
  • pnpm audit --audit-level low passes with the single documented caller-mitigated adm-zip exception. Raw audit metadata still reports that one upstream moderate advisory.

The initial isolated install exhausted local disk space; its incomplete cache was removed, and the existing cache was reused successfully. Full container build verification uses required CI. The Lite build/production manifest setups were checked with pnpm’s offline frozen-lockfile preflight: they failed when the patch directory was omitted and passed after it was copied. No full Lite image build, local full Docker build, or container runtime boot is claimed for this PR. No real Windows GPU installation or manual UI walkthrough is claimed.

Completed CI on 3fc5ab196d49a8e0a6ba605179dc03d6abf62445: all 28 distinct checks passed before the staging merge, including project/container validation, dependency audit, the full Node and browser matrix, and CodeQL. CodeRabbit’s final review covers that commit, has no actionable comments, and there are no unresolved review threads. See the archive caller applicability evidence.

Docs and release impact

Added an Unreleased security-fix changelog entry. Existing installation requirements and release versions are unchanged; no main promotion is included. Source archives and git-based launchers include the checked-in dependency patch.

UI evidence (if applicable)

No UI changes. The first CI run had one failure in the existing WebKit character-sheet settings test; that test and the affected client code are unchanged by this PR. The unmodified test then passed three consecutive local WebKit runs. The same case passed in the final CI run, and all browser shards and aggregate checks passed without any UI or test changes.


🔄 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/6037 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/10/2026 **Status:** ✅ Merged **Merged:** 9/10/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/security-sweep-20260910` --- ### 📝 Commits (3) - [`0ed4aec`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0ed4aec4bbab14e660aa3cb8c5d1d20a6efd8899) fix(deps): pin patched Hono and YAML versions - [`c896b61`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c896b614cf0739a6369b706246ebfd271f52dfe1) fix(security): isolate runtime archive extraction - [`3fc5ab1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3fc5ab196d49a8e0a6ba605179dc03d6abf62445) fix(docker): include dependency patches in Lite installs ### 📊 Changes **10 files changed** (+234 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/security-audit.yml` (+1 -0) 📝 `CHANGELOG.md` (+2 -0) 📝 `Dockerfile` (+2 -0) 📝 `Dockerfile.lite` (+2 -0) 📝 `package.json` (+2 -2) 📝 `packages/server/src/services/sidecar/sidecar-runtime.service.ts` (+8 -5) ➕ `patches/onnxruntime-node@1.24.3.patch` (+14 -0) 📝 `pnpm-lock.yaml` (+21 -16) 📝 `pnpm-workspace.yaml` (+12 -0) ➕ `scripts/regressions/archive-extraction-security.regression.ts` (+170 -0) </details> ### 📄 Description ## Linked issue Closes #6035 ## Why this change The sidecar and ONNX installers used predictable extraction directories. A pre-seeded symlink could redirect ZIP output outside the intended directory; the regression reproduces an outside-file overwrite in both original callers. Give both installers exclusive private directories, retain sidecar directory privacy across retries, and install the available Hono/YAML security patches. ## What changed - Create sidecar extraction directories with native `mkdtempSync`; clean partial contents while retaining the private directory on retry, and remove temporary directories on failure. - Apply a two-line pnpm patch to ONNX Runtime 1.24.3 so its NuGet installer also uses `mkdtempSync` instead of a timestamped, reusable temporary directory. - Include the patch in all dependency-install stages of the full and Lite Dockerfiles and trigger the security workflow for patch changes. - Pin Hono 4.13.5 and js-yaml 4.3.2; regenerate the lockfile with pnpm. - Document one narrow audit exception for GHSA-vwc7-r8mq-g2x9. adm-zip has no patched release. Its filesystem extraction callers now operate inside private roots; the new behavioral regression is part of `pnpm regression:security`. Remove the exception/ONNX patch when an upstream fix is available, and preserve this invariant for any new extraction caller. This is a caller mitigation, not an upstream adm-zip fix; raw audit metadata still counts one moderate advisory. ## Alert review [Full applicability record](https://github.com/Pasta-Devs/Marinara-Engine/issues/6035#issuecomment-5620065565). - Dismissed 15 inapplicable alerts with individual reasons: unused numeric proxy trust; fast-uri outside network/security policy; unused qs comma/stringify paths; no unbounded runtime Browserslist queries; and unused Hono query/static-generation/dot-body paths. The assessment covers main and staging, not only already-patched staging dependencies. - Retained #32 (Fastify primitive-body validation) and #39 (Browserslist custom build stats): patched versions 5.12.1 and 4.28.7 already exist on staging. Capability routes can forward Fastify schemas, and custom stats remain a build-input concern, so these were not blanket-dismissed. - Retained #41 (adm-zip): this PR mitigates the reproduced callers on staging. Main remains unchanged. - Marinara-Agents has no open Dependabot alerts and needs no code change for this sweep. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Manually verify a real Windows CUDA runtime install and reinstall - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes Completed locally: - `pnpm install` using the existing dependency cache, then regenerated installation after the dependency changes. Native ONNX binding validation passed on macOS arm64. - The new archive regression failed before the fix with both outside sentinel files overwritten. It passes after the fix, covering real ZIP extraction, private POSIX permissions, successful installs, retry directory identity/cleanup, and final-failure cleanup. Only download transports/asset selection are redirected to local fixtures; no real model runtime is executed. - `pnpm check`, `pnpm regression:security` (18 regression files), `pnpm version:check`, and `git diff --check` passed. - `pnpm audit --audit-level low` passes with the single documented caller-mitigated adm-zip exception. Raw audit metadata still reports that one upstream moderate advisory. The initial isolated install exhausted local disk space; its incomplete cache was removed, and the existing cache was reused successfully. Full container build verification uses required CI. The Lite build/production manifest setups were checked with pnpm’s offline frozen-lockfile preflight: they failed when the patch directory was omitted and passed after it was copied. No full Lite image build, local full Docker build, or container runtime boot is claimed for this PR. No real Windows GPU installation or manual UI walkthrough is claimed. Completed CI on `3fc5ab196d49a8e0a6ba605179dc03d6abf62445`: all 28 distinct checks passed before the staging merge, including [project/container validation](https://github.com/Pasta-Devs/Marinara-Engine/actions/runs/34490524577), [dependency audit](https://github.com/Pasta-Devs/Marinara-Engine/actions/runs/34490524479), [the full Node and browser matrix](https://github.com/Pasta-Devs/Marinara-Engine/actions/runs/34490524751), and CodeQL. CodeRabbit’s final review covers that commit, has no actionable comments, and there are no unresolved review threads. See the [archive caller applicability evidence](https://github.com/Pasta-Devs/Marinara-Engine/pull/6037#issuecomment-5620545732). ## Docs and release impact Added an Unreleased security-fix changelog entry. Existing installation requirements and release versions are unchanged; no main promotion is included. Source archives and git-based launchers include the checked-in dependency patch. ## UI evidence (if applicable) No UI changes. The first CI run had one failure in the existing WebKit character-sheet settings test; that test and the affected client code are unchanged by this PR. The unmodified test then passed three consecutive local WebKit runs. The same case passed in the final CI run, and all browser shards and aggregate checks passed without any UI or test changes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:15:57 +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#7037
No description provided.