mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5894] [MERGED] fix(mari): read-only package stores and group-scoped sandbox teardown #6985
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6985
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5894
Author: @kolacheee
Created: 9/6/2026
Status: ✅ Merged
Merged: 9/6/2026
Merged by: @kolacheee
Base:
staging← Head:fix/5892-store-robind-groupkill📝 Commits (7)
fe8b8fffix(mari): read-only package stores and group-scoped teardown (#5892)0c1a208fix(mari): idempotent teardown and symlinked-store binds (CodeRabbit)d03f894fix(mari): cache carve-outs follow the logical store name (CodeRabbit)29b82e3fix(mari): symlink-proof cache carve-outs and canonical store exemption (CodeRabbit)578b6cbfix(mari): contain store discovery failures to the scan side (CI)dce58a7fix(mari): post-run store-link integrity and a live group-teardown case (CodeRabbit)1c74c33fix(mari): canonical workspace root and unguessable quarantine names (CodeRabbit)📊 Changes
4 files changed (+705 additions, -26 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
packages/server/src/services/professor-mari/workspace-agent.service.ts(+26 -6)📝
packages/server/src/services/professor-mari/workspace-shell-sandbox.ts(+283 -14)📝
scripts/regressions/mari-guard-sibling-paths.regression.ts(+394 -6)📄 Description
Linked issue
Closes #5892
Why this change
#5892 tracked the two residuals consciously left open by the #5786 post-execution scan (PR #5891): package-store trees stayed outside the scan for cost — so a command could plant ready-made
node_modules/<pkg>/code that executes on the server's nextrequire— and on macOS a process surviving seatbelt teardown could write after the scan walked.What changed
Residual 1 closes at the mount layer, not the scan. Package-store trees (
node_modules,.pnpm,.pnpm-store— nested included, enumerated by the existing policy walk at zero extra I/O since it already sees each store while skipping into it) are now read-only inside the sandbox on both backends. The justification is structural: sandboxed bash has no legitimate install path (package-manager mutations are refused pre-execution; approved dependency installs run outside the sandbox). Build-tool caches stay writable via carve-outs (.cache,.vite, and.vite-temp— the review probed this repo's actual vite@7 and found TS-config builds bundle there before anything else runs), pre-created when absent so a first build isn't broken by its own missing cache dir. The workspace root is canonicalized before any rules derive — the review traced a Linux fail-open where a symlinked workspace path put the writable bind and the realpath'd read-only binds on different mount points.Residual 2 narrows to the theoretical. Both backend spawns are
detached: trueand teardown signals the process group (SIGTERM, then SIGKILL escalation, timer cleared on settle so a stale group-kill can never hit a recycled pid). Backgrounded grandchildren die with the tree; what remains —setsidescapees, and trees orphaned by a hard server crash on macOS — is documented at the helper.Plus a regression the verification round caught in #5786's own revision: the descent into run-created skip-named stores had been silently lost, leaving a fresh
node_modulesinvisible to the scan and unbound. Restored, with a lane case pinning it.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
mari-guard-sibling-pathslane asserts both backends' generated rules functionally: bwrap args ro-bind all stores (nested included) with the cache--bindstacking after its parent's ro-bind; the seatbelt profile places the cache allow after the store deny (last-match-wins), order-agnostically. A real detached leader is spawned and group-killed on POSIX; the ESRCH fallback is platform-gated honestly; the run-created-store descent and pre-existing-store skip are both pinned..vite-tempcarve-out, workspace canonicalization, the lost-descent regression, the escalation-timer clear, macOS-crash-orphan and symlink-store residuals documented at the helper, lane realpath wrap and honest test gating.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)UI evidence (if applicable)
Not applicable — sandbox policy and process teardown only.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.