mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7538] [MERGED] fix(import): accept padded archives and check entry limits before the file list #7782
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#7782
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/7538
Author: @SpicyMarinara
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/archive-reader-followup📝 Commits (2)
b136334fix(import): accept padded archives and check entry limits before the file listd682c6bfix(import): refuse an archive with an exact and a padded end record📊 Changes
5 files changed (+354 additions, -142 deletions)
View changed files
📝
packages/server/src/lib/zip-reader.ts(+159 -120)📝
packages/server/src/routes/import.routes.ts(+10 -10)📝
packages/server/src/services/agents/custom-agent-repositories.service.ts(+6 -2)📝
packages/server/src/services/capability-packages/package-manager.service.ts(+9 -3)📝
scripts/regressions/zip-reader.regression.ts(+170 -7)📄 Description
Linked issue
Refs #7531 (follow-up to #7532, which is merged)
Why this change
taron macOS and on Windows 10/11, pads a ZIP it writes to a pipe (tar --format zip -cf - … > card.charx) with zero bytes up to a whole block. Some transfers also leave a line break after the file. Those.charxcards, custom Agent repository archives, Agent packages and.marinarapackages were refused with "The file is not a readable ZIP archive".adm-zip, Pythonzipfileand Info-ZIPunzipall read them..marinarapackages: 8, Agent packages and custom repositories: 8,192) checked it only after the reader had built every entry. The reader now checks that limit against the end record before it reads the file list, and it keeps a small index instead of a full entry object per file. As a result, a long file list takes less memory than the archive itself.What changed
openZipArchive(buffer, budget?)takes the caller's existing limit and message. The.marinararoute passes 8 and keeps ".marinara package has too many entries". Agent package install and custom repositories passPACKAGE_ARCHIVE_BUDGET(8,192, "Package contains too many files").validatePackageArchiveEntrieskeeps its own check..charxhas no entry limit and none is added.getEntryorgetEntriesasks for them. The overlap check now runs on two sortedFloat64Arrays instead of an array of objects. Every structural check is the same and still runs when the archive is opened..marinara1 GB / 256 MB-per-entry limits, the Agent artifact limits (100 MB artifact, 250 MB expanded, 1 MB manifest, per-file declarations) and the custom repository limits are all unchanged.scripts/regressions/zip-reader.regression.tsadds:adm-zip;bsdtar/libarchivetaris installed;.charxinspect,.marinaraimport, custom repository and package archive through their entry points;.marinararoute and the custom repository entry point;Claim boundary (risky work: import hardening)
installCatalogPackage,parseCustomAgentRepositoryContents,/api/import/marinara-package;.charximport and inspect go through the same reader with no caller change.openZipArchive(archive, PACKAGE_ARCHIVE_BUDGET)that the regression exercises directly.Validation
pnpm checkpasses locallyCONTRIBUTING.mdAgent-run checks, for the human reviewer to confirm (not ticked):
pnpm check: exit 0. The only lint warning is an existing, unrelated client warning.node ./scripts/run-regressions.mjs --filter …:zip-reader1/1,import12/12,package6/6,capability19/19,agent-activation2/2,spatial-context1/1,open-issues1/1,game-ruleset53/53.game-ruleset-repository,native-export-memory,large-native-json-import,agent-registry-hydration,decision-conditionals,robustness-runtime-diagnosticsandgame-tool-controlseach passed 1/1.--filter charxand--filter custom-agentmatch no regression file names; that coverage lives inzip-reader.zip-readerregression fails against the reader onstaging. Its first failure is the zero-padded archive.bsdtar3.5.3 and libarchive 3.7.4): a.charxwritten withtar --format zip -cf - card.json assets >(10,240 bytes, about 9.7 KB of zeros after the end record) is inspected as before. The same card with\nor 512 zero bytes appended is also inspected as before.stagingheld several times the archive's size.coderabbit review --agent --committed --base-commit d115a4406): 1 minor finding. It said one record that ends exactly at the end of the file and another followed only by padding should both count, so the archive is refused. That is fixed in the second commit, with a regression. CodeRabbit was not rerun after that small fix.Manual verification notes
Needs a human:
tar --format zip -cf - card.json assets > Card.charxand import it through Import Character. Also inspect it through the multi-file import flow and check the name and icon..marinarapackage and a normal.charxexported by RisuAI, and confirm nothing changed for ordinary files.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)UI evidence (if applicable)
Not applicable: server-side archive reading only.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.