mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #8819] [MERGED] fix(server): hold game assets, previews and the avatar cleanup to their real folders #8827
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#8827
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/8819
Author: @SpicyMarinara
Created: 11/4/2026
Status: ✅ Merged
Merged: 11/4/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/hardening-game-assets-links📝 Commits (6)
8f02173fix(server): hold game assets and the avatar cleanup to their real folders2b4096ffix(server): hold the asset seed and previews to their real foldersdab827afix(server): record the default assets seed only once every folder received itb0faf3ffix(server): check an app-folder path as written before its real path, and compare Windows paths by ASCII case2ace0e7fix(server): list folder links that stay inside game-assets, and log a refused preview folder once66f9a0bfix(server): tell game-assets folders apart by file identity, so each is entered through a link once📊 Changes
9 files changed (+1423 additions, -178 deletions)
View changed files
📝
packages/server/src/app.ts(+19 -5)📝
packages/server/src/db/seed-game-assets.ts(+79 -18)📝
packages/server/src/routes/game-assets.routes.ts(+109 -101)📝
packages/server/src/services/game/asset-manifest.service.ts(+206 -33)📝
packages/server/src/services/image/avatar-file-lifecycle.ts(+33 -6)📝
packages/server/src/services/image/image-thumbnail.ts(+25 -6)📝
packages/server/src/utils/app-folder.ts(+58 -9)➕
scripts/regressions/app-folder-bounds.regression.ts(+62 -0)➕
scripts/regressions/game-assets-link-hardening.regression.ts(+832 -0)📄 Description
Linked issue
Refs #8797 (closed as completed on 2026-11-03; this is its listed follow-up). No separate issue exists for the folder-delete guard fix below: it was found while reworking the same route.
Why this change
#8802 made
mari imagesread, write and delete only inside the real app folders. Code it calls, or shares with the app, still used paths as written: the game-asset manifest build, the default assets seed, the Game Assets routes, the image preview cache and the shared avatar cleanup. #8802 listed these as its follow-up. This holds them to their real folders the same way, without breaking normal installs: a data dir behind a link (Docker volumes, macOS /tmp) and a game-assets folder moved to another disk keep working.It also fixes three robustness problems in the same code:
DELETE /game-assets/folders/sprites/(with a trailing slash,/., or different letter case) slipped past the root-category guard and deleted the whole category.What changed
Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Agent-run checks (for reference), on the head rebased onto staging after #8802 merged:
node ./scripts/pnpm-runner.mjs build:shared: oknode ./scripts/run-regressions.mjs --filter game-assets-link-hardening: 1/1 passednode ./scripts/run-regressions.mjs --filter professor-mari/: 27/27 passed (one unidentified failure in a first run under heavy machine load did not reproduce)node ./scripts/run-regressions.mjs --filter regressions/mari/ / game-asset / avatar- / background: 39/39, 1/1, 26/26, 4/4 passedpnpm check: exit 0Before the rebase, the regression failed on the previous commit for every case the second review raised, and on the #8802 base for every link case, with no normal-flow failure; with the fix it passes 1/1.
Dottore Review on
dab827a4e5(2 LOW, 1 nitpick) is addressed in2ace0e7862; an independent review of that commit found the folder-link walk could enter one folder under several case spellings (exponential on a case-insensitive disk), fixed in66f9a0b220by identifying folders by device and file number. CodeQL's path-injection alerts were traced one by one: two real gaps (an outside path walked before the bounds check, and Windows case folding) are fixed inb0faf3f7c3, and the rest are false positives that pass isSafePath and the real-folder check before any use. Earlier independent adversarial review: changes (1 major and 7 others: the default assets seed, meta.json reads, Windows reparse points, the offline-drive loop, the preview cache, regression leftovers, the folder-delete guard and the PR text), all addressed in the second commit.Known limits and risks:
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.