mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #8802] [MERGED] fix(server): hold mari images writes, deletes and JSON reads to their app folders #8815
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#8815
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/8802
Author: @SpicyMarinara
Created: 11/4/2026
Status: ✅ Merged
Merged: 11/4/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/hardening-mari-images-writes📝 Commits (6)
450802ffix(server): hold mari images writes and JSON reads to their app folders2d8ac8bfix(server): hold mari images gallery deletes and IDs to the gallery folder48d8280fix(server): refuse a linked manifest or meta.json in the read, not only the writec9828f4fix(server): keep the app's media folders read-only for Professor Mari's shell273d01efix(server): cover call videos and keep the media deny last in Mari's Seatbelt profileedca434test(server): pin mari code check's saved-data and media rules to the write deny📊 Changes
6 files changed (+852 additions, -75 deletions)
View changed files
📝
packages/server/src/services/image/gallery-file-lifecycle.ts(+18 -1)📝
packages/server/src/services/mari-db/mari-images.service.ts(+96 -61)📝
packages/server/src/services/professor-mari/workspace-shell-sandbox.ts(+102 -10)➕
packages/server/src/utils/app-folder.ts(+24 -0)➕
scripts/regressions/professor-mari/mari-images-app-folder-writes.regression.ts(+453 -0)📝
scripts/regressions/professor-mari/sandbox-secrets.regression.ts(+159 -3)📄 Description
Linked issue
Closes #8797
Why this change
#8798 made mari images read an image from an app folder only through that folder's real path. The same command also writes and deletes files in those folders: preview images and their manifest, backgrounds and their meta.json, avatars, lorebook images, sprites, and the chat and character galleries. It also reads the manifest and meta.json. All of that used the path as written, so a link in one of those folders could send a write, delete or read somewhere other than the app folder.
This holds those operations to the real app folder. The rule applies to both mari CLI routes, which share the service, and to the gallery UI's deletes, which share the gallery cleanup helper. When the data dir sits inside Professor Mari's workspace, her sandboxed shell now gets read-only access to the app's media folders, as it already had for DATA_DIR/storage (maintainer decision). A check made in the server can then no longer be undone by her shell between the check and the write.
What changed
unlinkedAppFile) serves these reads and every file write in mari-images.service.ts; the sprite catalog keeps its own link checks.mari images generate,edit,list assets,delete --target asset, background assign,list backgroundsanddelete --target backgroundstop before any image is saved or deleted.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
mari images generate, thenassignto a background, character avatar, persona avatar, lorebook image, sprite, chat gallery and character gallery, saves the files and shows them in the UI.mari images list backgroundsandlist assets, and thatdelete --target background/delete --target assetremove the file and update meta.json / the manifest.mari images generateis refused and saves no new image when DATA_DIR/gallery/mari-images/manifest.json is a symlink to another file in that folder. Then remove the link and confirm generate works again.ls packages/server/data/backgrounds), that writing or deleting a file there from her shell fails, and thatmari images assign --target backgroundfrom her chat still saves the background and shows it in the UI.mv packages/server/data/avatars packages/server/data/avatars.movedfrom her shell fails and avatars stays in place.mari code checkstill completes inside the sandbox on macOS and on Linux.Agent-run checks (for reference; each regression was shown to fail without its part of the fix):
node ./scripts/pnpm-runner.mjs build:shared: oknode ./scripts/run-regressions.mjs --filter mari-images-app-folder-writes: 1/1 passed; failed 0/1 with the earlier service in placenode ./scripts/run-regressions.mjs --filter sandbox-secrets: 1/1 passed with macos-seatbelt; failed 0/1 with the previous sandbox file, and again with only the Seatbelt rule order revertednode ./scripts/run-regressions.mjs --filter sandbox: 2/2 passed (shell-sandbox, sandbox-secrets; macos-seatbelt)node ./scripts/run-regressions.mjs --filter mari-guard: 1/1 passednode ./scripts/run-regressions.mjs --filter professor-mari/: 27/27 passednode ./scripts/run-regressions.mjs --filter regressions/mari/: 39/39 passednode ./scripts/run-regressions.mjs --filter sprite- / gallery- / avatar- / lorebook-image / background / image-edit-reference: 7/7, 7/7, 26/26, 2/2, 4/4, 1/1 passed (earlier round)cd packages/server && node ../../scripts/pnpm-runner.mjs run lint: exit 0npx prettier --checkon the changed files: cleanIndependent adversarial review, two rounds. Round one asked for changes (1 blocker, 3 major, 2 minor); round two, of
48d82805adandc9828f4386, asked for changes (1 major, 4 minor). All are addressed in2d8ac8b086,48d82805ad,c9828f4386and273d01e461, except the follow-up listed below.Known limits and risks:
Behaviour changes
/,\, NUL,.or..is refused for mari gallery assigns.mari images delete. Before, the row was deleted and the file was skipped..mari-<id>.tmpfile; image lists and the avatar sweep ignore that extension.mari images, which runs in the server. The data dir and the folders above it can no longer be renamed or removed from her shell.Follow-up on #8797
Not caught or not tested
Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.