mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2477] [Issue]: Profile zip import has no aggregate or entry-count size cap (only a per-entry limit) #1220
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#1220
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?
Originally created by @Romuromylus on GitHub (Jun 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2477
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Severity: Low — data-loss / resource exhaustion regression. Profile zip/JSON asset restore enforces only a per-entry 256MB cap; there is no aggregate (total-uncompressed) cap and no entry-count cap. A crafted profile archive with many entries can exhaust local disk during staging. Main enforces a 1GB total cap.
Expected behavior
Thread a running total through the restore loop and reject once cumulative bytes exceed a total limit (main uses 1GB), and/or cap the number of asset entries — in addition to the per-entry limit.
Actual behavior
The restore loop iterates every manifest/zip entry with only the per-entry
MAX_PROFILE_ASSET_BYTES = 256MBguard. A repo-wide grep for any aggregate cap (total/uncompressed/ARCHIVE_TOTAL/restoredFileBytes/entry_count) returns nothing in the refactor restore paths. A malicious profile.zipdeclaring many ~256MB (or numerous high-ratio) entries is staged in full, filling the disk before the per-entry cap helps.Steps to reproduce
.zipwhose manifest lists many large/numerous asset entries under managed dirs.restore_profile_zip_assetsstages all of them with no cumulative ceiling, exhausting disk.Impact area
Environment
1fae2c42Logs, screenshots, or video
Static trace:
profile/assets.rs:434(fn), per-entry validate:466, per-entry copy:468; no aggregate accumulator anywhere in the restore path.Regression notes
Regression vs main.
packages/server/src/routes/backup.routes.tsdefinesPROFILE_ARCHIVE_TOTAL_UNCOMPRESSED_LIMIT_BYTES = 1GB, accumulatesrestoredFileBytesacross the restore loop, and callsassertProfileArchiveTotalLimitto reject once cumulative bytes exceed it. The refactor dropped the aggregate guard, keeping only the per-entry one.Additional context
Low: desktop is single-user, the archive is a self-inflicted import, and the staging transaction rolls back on write error (transient disk pressure, no persistent corruption). Fix is cheap: the per-entry helper already returns the copied byte count — thread a running total through
restore_profile_zip_assets/restore_profile_json_assets_in_root/preview_*and reject once it exceeds a 1GBPROFILE_ARCHIVE_TOTALconstant, mirroring main; optionally cap entry count.Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (Jun 6, 2026):
Fixed on refactor in
038b7220.Profile JSON/ZIP asset restore and preview now track aggregate restored asset bytes and reject once the 1GB total uncompressed cap is exceeded, while keeping the per-entry cap.
Verification: pnpm typecheck; pnpm build; pnpm check:architecture; cargo check --manifest-path src-tauri/Cargo.toml --workspace; focused Rust backup/profile tests; git diff --check; no .test.ts/.test.tsx files present.