mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5891] [MERGED] fix(mari): post-execution scan closes the sandbox's new-sensitive-file review gap #6982
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#6982
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/5891
Author: @kolacheee
Created: 9/6/2026
Status: ✅ Merged
Merged: 9/6/2026
Merged by: @kolacheee
Base:
staging← Head:fix/5786-sandbox-postexec-scan📝 Commits (2)
9852fbafix(mari): post-execution scan closes the sandbox's new-sensitive-file gap (#5786)0fac65dfix(mari): count staged cards and bound the scan walk (CodeRabbit)📊 Changes
6 files changed (+763 additions, -64 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
packages/server/src/services/professor-mari/workspace-agent.service.ts(+226 -55)📝
packages/server/src/services/professor-mari/workspace-change-review.service.ts(+1 -1)📝
packages/server/src/services/professor-mari/workspace-shell-sandbox.ts(+236 -3)📝
scripts/regressions/mari-guard-sibling-paths.regression.ts(+295 -4)📝
scripts/regressions/mari-write-readback.regression.ts(+3 -1)📄 Description
Linked issue
Closes #5786
Why this change
The shell sandbox's write-deny list is built only from sensitive paths that exist at spawn, so a command could create a brand-new supply-chain-sensitive file — a
package.jsonin a fresh directory, a rootDockerfilethat was absent — with no deny rule and no user review. The #5777 pre-execution heuristic catches common write shapes, but it is a command-string check by design; any shape it misses created a reviewed-class file with zero review. That is a false negative on the sensitive-file approval floor, found during the #5776–#5778 adversarial review.What changed
Every sandboxed bash run is now bracketed by the safety net the issue proposed:
snapshotSensitiveWorkspaceFilesrecords every sensitive file (sha256; bytes retained up to the 512 KB review cap; >8 MB fingerprinted by size, never read);detectUnreviewedSensitiveChangesfinds whatever changed unreviewed, whatever command shape produced it. New sensitive directories and newly created skip-named dirs (a freshdist/) are walked in full — no rule covers them.stageSensitiveFileChange(re-reading the restored disk as "before") turns the change into an ordinary approval card. Capped at 5 cards per run — everything past the cap is still reverted.Sandbox:header, before thestdout:/stderr:markers), andisStagedSensitiveMutationrecognizes them only there. Every string the engine interpolates into that region — the command, file paths — is flattened to one line first, so neither a newline-bearing command nor a newline-bearing filename can mint a forged engine line or truncate the region. Behavioral fixtures prove the classifications through the real resolver.Hardening from two adversarial review rounds (15 findings, all applied)
package.jsonwould have read arbitrary host files into an approval card; FIFOs can no longer hang the run; device targets are never read.bun.lockb-style binaries); staging happens only when content provably round-trips as text; an 8 MB aggregate retention budget bounds a scan against thousands of planted manifests.Honest residuals (follow-up issue filed)
node_modules,.pnpm,.pnpm-store) stay outside the scan for cost; writing there was always sandbox-permitted for builds, and the review floor defends the manifests that control what gets installed. Named in the CHANGELOG too.--die-with-parent/--unshare-all.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
mari-guard-sibling-pathslane extended with functional temp-workspace coverage: the exact reported gap (fresh-dirpackage.json), tampering, covered-directory silence, new-sensitive-dir descent, a manifest planted in a pre-existingdist/, binary content, a smuggled sensitive-named symlink, oversize files, per-entry containment and the snapshot-blind attribution guard (POSIX-gated), and thenode_modulesnegative — plus behavioral staged/echo-forgery/nested-marker fixtures throughresolveWorkspaceMutationVerification, and wiring pins.mari-guard-sibling-paths,mari-write-readback,mari-ask-latch,mari-understood-request,prompt) pass; server lint clean; zero-error build.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 — the user-visible surface is the existing sensitive-change approval card, reached through a new path.
Summary by CodeRabbit
Bug Fixes
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.