[PR #4291] [MERGED] Pin and verify local runtime assets #6319

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4291
Author: @SpicyMarinara
Created: 7/30/2026
Status: ✅ Merged
Merged: 7/30/2026
Merged by: @SpicyMarinara

Base: staging ← Head: security/pin-local-runtime-assets


📝 Commits (2)

  • aa916f3 security: pin and verify local runtime assets
  • cdb43b6 address runtime integrity review feedback

📊 Changes

11 files changed (+1249 additions, -196 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 docs/TROUBLESHOOTING.md (+11 -0)
📝 docs/connections/local-model.md (+4 -0)
📝 package.json (+2 -1)
➕ packages/server/src/assets/mlx-runtime-requirements.in (+11 -0)
➕ packages/server/src/assets/mlx-runtime-requirements.lock (+556 -0)
📝 packages/server/src/services/sidecar/mlx-runtime.service.ts (+183 -69)
➕ packages/server/src/services/sidecar/runtime-integrity-manifest.ts (+215 -0)
📝 packages/server/src/services/sidecar/sidecar-download.ts (+14 -0)
📝 packages/server/src/services/sidecar/sidecar-runtime.service.ts (+47 -126)
➕ scripts/regressions/runtime-integrity.regression.ts (+205 -0)

📄 Description

Linked issue

Closes #4285

Why this change

Local-model setup crosses a supply-chain boundary when it downloads and executes or extracts upstream artifacts. Mutable refs and unverified bootstrap paths make the installed bytes depend on upstream state at download time rather than a repository-reviewed expectation.

What changed

  • Pin the MLX runtime to an immutable upstream commit and verify the source archive's size and SHA-256 digest.
  • Pin llama.cpp to a reviewed release and verify every supported archive and dependency against a checked-in integrity manifest.
  • Replace the moving uv installer pipeline with a pinned, verified release archive.
  • Verify downloads before extraction or installation and include revision/digest data in installed-runtime stamps.
  • Reject mismatches without promoting partial downloads, while preserving cancellation and retry behavior.
  • Add focused integrity regressions and update local-model/troubleshooting documentation and the changelog.
  • Track translated documentation separately in #4289.

Validation

  • 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

Automated proof completed before publication:

  • pnpm regression:runtime-integrity
  • pnpm check
  • pnpm version:check
  • git diff --check staging...security/pin-local-runtime-assets

Manual verification notes

  • Manually verify a fresh llama.cpp install on each supported archive family.
  • Manually verify first-run MLX and uv installation on Apple Silicon.
  • Manually verify interrupted and retried downloads in the desktop shell.
  • No real Apple-hardware runtime installation was performed in this agent run.

Docs and release impact

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

English documentation and CHANGELOG.md are updated. Translation follow-up: #4289.

UI evidence (if applicable)

Not applicable; this changes server-side runtime acquisition and integrity checks.

Summary by CodeRabbit

  • Security

    • Bundled runtime downloads are now verified using approved file sizes and SHA-256 checksums.
    • Downloads that fail validation are rejected before extraction or execution.
    • Installed runtimes remain on reviewed versions instead of automatically tracking upstream updates.
  • Documentation

    • Added troubleshooting guidance for failed runtime integrity checks, including updating Marinara and retrying without manually extracting rejected files.
  • Tests

    • Added regression coverage for runtime manifests, checksum validation, retries, and interrupted downloads.

🔄 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/4291 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/30/2026 **Status:** ✅ Merged **Merged:** 7/30/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `security/pin-local-runtime-assets` --- ### 📝 Commits (2) - [`aa916f3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/aa916f3f71d1d9b6e19b7f200859a4d165f52630) security: pin and verify local runtime assets - [`cdb43b6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cdb43b6b9bc3f8c9dc5ad4232b636f43a834af65) address runtime integrity review feedback ### 📊 Changes **11 files changed** (+1249 additions, -196 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `docs/TROUBLESHOOTING.md` (+11 -0) 📝 `docs/connections/local-model.md` (+4 -0) 📝 `package.json` (+2 -1) ➕ `packages/server/src/assets/mlx-runtime-requirements.in` (+11 -0) ➕ `packages/server/src/assets/mlx-runtime-requirements.lock` (+556 -0) 📝 `packages/server/src/services/sidecar/mlx-runtime.service.ts` (+183 -69) ➕ `packages/server/src/services/sidecar/runtime-integrity-manifest.ts` (+215 -0) 📝 `packages/server/src/services/sidecar/sidecar-download.ts` (+14 -0) 📝 `packages/server/src/services/sidecar/sidecar-runtime.service.ts` (+47 -126) ➕ `scripts/regressions/runtime-integrity.regression.ts` (+205 -0) </details> ### 📄 Description ## Linked issue Closes #4285 ## Why this change Local-model setup crosses a supply-chain boundary when it downloads and executes or extracts upstream artifacts. Mutable refs and unverified bootstrap paths make the installed bytes depend on upstream state at download time rather than a repository-reviewed expectation. ## What changed - Pin the MLX runtime to an immutable upstream commit and verify the source archive's size and SHA-256 digest. - Pin llama.cpp to a reviewed release and verify every supported archive and dependency against a checked-in integrity manifest. - Replace the moving uv installer pipeline with a pinned, verified release archive. - Verify downloads before extraction or installation and include revision/digest data in installed-runtime stamps. - Reject mismatches without promoting partial downloads, while preserving cancellation and retry behavior. - Add focused integrity regressions and update local-model/troubleshooting documentation and the changelog. - Track translated documentation separately in #4289. ## Validation - [ ] `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` Automated proof completed before publication: - `pnpm regression:runtime-integrity` - `pnpm check` - `pnpm version:check` - `git diff --check staging...security/pin-local-runtime-assets` ### Manual verification notes - Manually verify a fresh llama.cpp install on each supported archive family. - Manually verify first-run MLX and uv installation on Apple Silicon. - Manually verify interrupted and retried downloads in the desktop shell. - No real Apple-hardware runtime installation was performed in this agent run. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) English documentation and `CHANGELOG.md` are updated. Translation follow-up: #4289. ## UI evidence (if applicable) Not applicable; this changes server-side runtime acquisition and integrity checks. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Security** * Bundled runtime downloads are now verified using approved file sizes and SHA-256 checksums. * Downloads that fail validation are rejected before extraction or execution. * Installed runtimes remain on reviewed versions instead of automatically tracking upstream updates. * **Documentation** * Added troubleshooting guidance for failed runtime integrity checks, including updating Marinara and retrying without manually extracting rejected files. * **Tests** * Added regression coverage for runtime manifests, checksum validation, retries, and interrupted downloads. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:09:17 +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#6319
No description provided.