mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7532] [MERGED] fix(import): read outside archives strictly while keeping existing size limits #7781
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#7781
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/7532
Author: @SpicyMarinara
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/strict-archive-reader📝 Commits (5)
ac76e23fix(import): read outside archives strictly while keeping existing size limits5e760d7Merge branch 'staging' into fix/strict-archive-reader166d62ftest(import): cover the strict archive reader and its entry points6f3f82eMerge remote-tracking branch 'origin/fix/strict-archive-reader' into fix/strict-archive-reader4ee06ceMerge branch 'staging' into fix/strict-archive-reader📊 Changes
8 files changed (+1154 additions, -35 deletions)
View changed files
➕
packages/server/src/lib/zip-reader.ts(+305 -0)📝
packages/server/src/routes/import.routes.ts(+8 -7)📝
packages/server/src/services/agents/custom-agent-repositories.service.ts(+8 -8)📝
packages/server/src/services/capability-packages/package-manager.service.ts(+11 -10)📝
packages/server/src/services/import/st-character.importer.ts(+11 -8)📝
scripts/regressions/capability-package-lifecycle.regression.ts(+3 -1)📝
scripts/regressions/open-issues.regression.ts(+1 -1)➕
scripts/regressions/zip-reader.regression.ts(+807 -0)📄 Description
Linked issue
Closes #7531
Why this change
.charxcards and.marinarapackages. These now go through one strict reader, so every existing size limit applies to the bytes that are actually read, and an archive whose own records disagree with each other is refused instead of being interpreted.What changed
.charxwhosecard.jsonor icon unpacks to more than 256 MB can no longer be imported. This is the only new limit. It is the import upload limit, taken from the same constant (IMPORT_BODY_LIMIT_BYTES), so raising the upload limit raises it too..marinaraupload 1 GB and 256 MB per entry; Agent artifact 100 MB, expanded package 250 MB, manifest 1 MB and the per-file declarations; custom repository archive 10 MB, expanded 20 MB,agents.json1 MB, ruleset files at their existing limit..marinarafile that cannot be read as an archive at all now always gets the existing 400 "Could not read .marinara package". Before, some of those failures came back as a server error.packages/server/src/lib/zip-reader.ts. The package manager, custom Agent repositories, the.charximporter and the.marinararoute use it instead ofadm-zip. Full-backup restore, the NovelAI reader and the sidecar download are unchanged and still useadm-zip.scripts/regressions/zip-reader.regression.ts. Two existing regressions changed only to call the new reader: the case-collision fixture incapability-package-lifecyclenow goes through it, and theopen-issues.marinaraguard now names the bounded read. Their assertions and messages are unchanged.Claim boundary (risky work: import / storage hardening)
.charxcard and icon) equals the upload limit.installCatalogPackage,validatePackageArchiveEntries), custom Agent repository preview/sync (parseCustomAgentRepositoryContents),.charximport and inspect (importCharX,inspectCharX),/api/import/marinara-package..charxand.marinaraimports through the real routes, with avatar or icon bytes checked.validatePackageArchiveEntriesover the new reader, and by all 337 committed Agent artifacts reading identically. See the manual list below.Validation
pnpm checkpasses locallyCONTRIBUTING.mdAgent-run checks (for the human reviewer to confirm, not ticked):
pnpm check: exit 0. The one client lint warning, inHomeProfessorMariChat.tsx, was already there and is unrelated.node ./scripts/run-regressions.mjs --filter …:zip-reader1/1,import12/12,package6/6,capability19/19,agent-activation2/2,spatial-context1/1,open-issues1/1. Alsogame-ruleset53/53,agent19/19,decision-conditionals,archive,bulk-export,native-export-memory,agent-import1/1 each,profile-import3/3 andcustom-tool2/2.--filter charxand--filter custom-agentmatch no regression file names; that coverage is inzip-reader,game-ruleset-repositoryandopen-issues.coderabbit review --agent --committed): 0 findings across all 8 changed files.Compatibility corpus in CI (
zip-reader.regression.ts; each archive must read byte-identically to the previous reader):.marinarapackage built from a real native export.git archive, streamed and stored.zipfile: seekable,force_zip64, unseekable streams with and without ZIP64, and 65,536 entries (ZIP64 end record).-fz, and piped from stdin, when installed. JSZip when installed; it is not a dependency, so it was checked locally once.Local proof (not in CI):
artifacts/*.zip)HEADandstaging, Marinara-Enginestaginggit archiveof this branch: default, streamed (core.bigFileThreshold), stored-0,-9,-fz,-y, with extras, comment, pipe/stdin variantsditto -c -k: default,--sequesterRsrc --keepParent, level 0,--norsrczipfile: deflated, stored,force_zip64, unseekable, unseekable + ZIP64, 70,000 entriesforceZip64), yazl 3 ×3 (incl.forceZip64Format), Marinara writers ×2.marinarapackages built from Marinara's native character and persona exports with each of 17 writers, imported via/api/import/marinara-package.charxcards built from Marinara's compatible export with each of 17 writers, inspected and imported via/api/import/st-character7-Zip was not installed, so it is not in the corpus. Marinara does not write
.charxor.marinaraZIPs itself: its native export is.marinara.json, and the.marinaraZIP is a legacy format. Those rows were therefore built from Marinara's own exports.Manual verification notes
Needs a human:
.charx(for example one exported from RisuAI) through Import Character, and through the multi-file inspect flow; check the card and icon.agents.jsonand/orrulesets/*.json) and confirm the preview and apply..marinarapackage (a ZIP withdata.jsonand an avatar) for a character and for a persona.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)No docs are touched; there are no user-visible settings or limits to document beyond the
.charxnote above.UI evidence (if applicable)
Not applicable: server-only change.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.