mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[PR #1477] [MERGED] fix(slurp2): validate media restored from a backup (0.3.49) #1480
Labels
No labels
agent: chess
agent: conversation-calls
agent: eightball
agent: haptic
agent: hierarchical-maps
agent: hierarchical-maps
agent: illustrator
agent: poker
agent: rock-paper-scissors
agent: tic-tac-toe
agent: uno
artifacts
bug
bugfix
build
catalog
ci
client
dependencies
docs
documentation
enhancement
feature
fixed-in-staging
in-pr
normal-scope
packages
pull-request
qol
regression
roadmap
scope-risk
server
soup
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Agents#1480
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-Agents/pull/1477
Author: @SpicyMarinara
Created: 10/19/2026
Status: ✅ Merged
Merged: 10/19/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/slurp-restore-media📝 Commits (2)
f3ba621fix(slurp2): validate media restored from a backup (0.3.49)80edb41fix(slurp2): name a saved picture by the type its bytes show📊 Changes
22 files changed (+686 additions, -370 deletions)
View changed files
➕
artifacts/slurp2-0.3.49.zip(+0 -0)📝
catalog/catalog.json(+8 -8)📝
catalog/notes.json(+6 -6)📝
catalog/v2/catalog.json(+8 -8)📝
catalog/v2/notes.json(+6 -6)📝
catalog/v3/catalog.json(+8 -8)📝
catalog/v3/notes.json(+6 -6)📝
package.json(+1 -1)📝
packages/slurp2/CHANGELOG.md(+6 -0)📝
packages/slurp2/client.js(+1 -1)📝
packages/slurp2/manifest.json(+5 -5)📝
packages/slurp2/server.mjs(+267 -267)📝
packages/slurp2/src/engine/packages/client/src/slp/features/onboarding/slp-release.ts(+6 -9)📝
packages/slurp2/src/engine/packages/server/src/slp/base/media/slp-media.ts(+77 -11)📝
packages/slurp2/src/engine/packages/server/src/slp/features/ads/slp-ads-routes.ts(+3 -5)📝
packages/slurp2/src/engine/packages/server/src/slp/features/feed/slp-feed-post-routes.ts(+13 -14)📝
packages/slurp2/src/engine/packages/server/src/slp/features/media/slp-media-routes.ts(+9 -11)📝
packages/slurp2/src/engine/packages/server/src/slp/features/messages/slp-messages-media-routes.ts(+2 -2)📝
scripts/build-feature-packages.mjs(+1 -1)📝
scripts/run-slurp-regressions.mjs(+1 -0)...and 2 more files
📄 Description
Pull request
Linked issue
Closes #1476
Why this change
media/entry back under the name it had in the archive and only checked the first bytes, so a file's extension could name a different type from its contents.reply.sendFile, which picksContent-Typefrom the file extension. What the browser was told came from the name, not from the picture.isAllowedImageBuffer(data)without the AVIF hint, so AVIF pictures in a backup were dropped.What changed
Package
slurp20.3.48 → 0.3.49 (higher than every version the catalog has published; 0.3.48 is the highest).restoreCreatorMediaFile(base/media/slp-media.ts) restores only.png,.jpg,.jpeg,.webp,.gifand.avifnames, and only when the extension matches the typeisAllowedImageBufferreads from the bytes (jpgandjpegcount as one type). Anything else is skipped and appears in the restore job's skipped list. Slurp has always named stored pictures after their bytes (generated pictures go throughslurpImageExtension, uploads usedetected.ext), so a matching file keeps its archive name and the rows that point at it still work. Rows that name a skipped file point at no file and get a 404, which is how staging already treats a picture missing from the archive. No rows are rewritten.sendSlurpImageFile(reply, path)in the same file. It reads the file header, sends the picture as the type its bytes show (sendFile(..., { contentType: false })stops the extension from overriding that type), and addsX-Content-Type-Options: nosniff. When the caller names the download (the feed route setsContent-Disposition), the filename takes the extension of that same type, so an older file under another type's extension saves with the right one. A file that is not a picture gets a 404 withCache-Control: no-storeand the caller'sContent-Dispositionremoved. BMP is accepted here because hosts without sharp keep generated BMPs as they are. All seven SlurpsendFilesites now use it: post media, post attachment, message media, Creator avatar, banner, Engine avatar copy and ad picture.engineAvatarSourcereads its header through the sharedreadFileHeaderhelper. It behaves the same.SLURP2_VERSION, aSLURP2_RELEASESentry and apackages/slurp2/CHANGELOG.mdentry (patch, no highlight). The oldest splash entry (0.2.19) is removed soslp-release.tsstays within the 800-line architecture limit. 0.3.47 did the same with 0.2.18.tests/slurp2-restore-media.regression.ts. It runs the realslp-media.tsover an Engine overlay and the Engine's realfastifyand@fastify/static. It covers the accepted and refused restore names and contents, every image type sent as the type its bytes show (including files already on disk under a misleading name), the saved filename's extension following the same type, the 404 path, and a check that onlysendSlurpImageFilecallssendFile. Likeslurp2-engine-avatar-variant, it needsMARINARA_ENGINE_ROOTand runs without the regressions tsconfig, so it is added toPLAIN_TSXinscripts/run-slurp-regressions.mjsand totest:noodle:regressions.tests/slurp2-backup-roundtrip.regression.tschecked the exact text of the old one-line restore check. That pattern now matches the stricter check, with the same message. The new regression covers the behaviour at runtime.packages/slurp2/{manifest.json,client.js,server.mjs},artifacts/slurp2-0.3.49.zip,catalog/{,v2/,v3/}{catalog,notes}.json.MARINARA_ENGINE_ROOTpinned to Engineecd43884c, the same pin as 0.3.48. Rebuilding the unchanged staging head (ef521c75a) against that Engine gives the published 0.3.48 byte for byte.client.jsdiffers only by the version and the splash entries.Package and security impact
slurp2>=2.4.6).contentType: falseis a@fastify/static10 option, and every supported Engine ships version 10.sendFilestill writes its ownCache-Control(public, max-age=0, revalidated by ETag) over the routes'Cache-Control, as it did before. This is marked with aponytail:comment and is left for a separate decision.Validation
node scripts/validate-catalog.mjspasses locallygit diff --checkpasses locallyCONTRIBUTING.mdAgent-run validation on
80edb419e(the boxes above are for the human reviewer):npm run check: passes (0 errors; the existing warnings are unchanged)node scripts/test-catalog-lanes.mjs,node scripts/validate-package-locales.mjs,node scripts/validate-package-locale-keys.mjs,node scripts/validate-catalog.mjs,node scripts/tests/catalog-release-notes.regression.mjs,node scripts/tests/catalog-generatedat-determinism.regression.mjs,node scripts/tests/vendored-engine.regression.mjs,node scripts/validate-pr-triage.mjs,npm run test:security,npm run typecheck:packages(andslurp2with the pinned Engine),git diff --check: all passMARINARA_ENGINE_ROOT=<Engine ecd43884c> npm run test:slurp:regressions: 299 passed, 0 failed (rerun after the review fix in80edb419e). Pristine stagingef521c75awith the same Engine: 298 passed, 0 failed. The extra file is the new regression.slurp2-restore-mediafails first on thesendFilewiring check. With that check removed, it fails onmedia/a1/page.html is refused(actualtrue). On this branch it passes. The saved-name check added in80edb419efails on the previous sender (a1/photo-long.jpeg is saved as slurp-x.jpg) and passes with the fix. That commit's rebuild against the same pinned Engine changes only one line ofserver.mjs, the manifest/catalog checksums and the ZIP.Manual verification notes
media/folder holds a file that is not a picture, or a picture renamed to another type's extension, restores everything else and lists that file among the skipped entries.image/*Content-Typematching the picture and withX-Content-Type-Options: nosniff.slurp-<id>.<ext>, with the extension of the picture's real type.Documentation impact
No README or package doc describes restore media rules or media response headers, so no docs were changed. The change is described in
packages/slurp2/CHANGELOG.mdand the splash.UI evidence (if applicable)
None. The only visible change is the "What's new" entry.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.