Repository navigation
feat(artifacts): recognize Zip64 archives after leading bytes - #14105
Conversation
[Medium impact] No blocking defects were found; Git history shows this exact change is already on SummaryExtends passive ZIP recognition to nonempty, single-volume Zip64 archives after unclaimed leading bytes.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Unclaimed leading bytes] --> B[Find complete classic end record]
B --> C{Zip64 locator present?}
C -->|Yes| D[Try declared record, then fixed fallback]
C -->|No| E[Use complete classic fields]
D --> F[Check single-volume claims and directory bounds]
E --> F
F --> G[Resolve first member offset]
G --> H[Check local header before directory]
H --> I[Recognize original bytes as ZIP]
Reviews (3) · Last reviewed commit: "test(artifacts): pin the unadjusted Zip6..." · Reviewed by Greptile |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Maintainer review. I read the probe against the PKWARE APPNOTE (4.3.14 Zip64 end record, 4.3.15 locator, 4.5.3 extended-information field) and libarchive's seekable reader (
I found no defects in the source. The admission checks run before every read, all reads are bounded (fixed records plus one extra field of at most 65,535 bytes), and conversions from 64-bit to Pushed on top of your branch:
Validation:
|
Summary
Recognize nonempty single-volume Zip64 archives after an unclaimed leading prefix. These archives already work through the ZIP reader, but the shared root probe only interprets classic end records. A launch-script prefix therefore makes inspection and extraction reject the entire Zip64 input.
This extends the passive root-admission behavior introduced by #5803. It consumes the shared Zip64 framing facts from #12157; the desktop end-record changes in #9173/#10618 address a different consumer.
Problem and expected behavior
With the locked ZIP writer, a two-member Zip64 archive is 456 bytes. Prepending a 17-byte inert shell stub makes the original root classifier return
file, target parsing reject it, and the compiledinspect-artifactcommand returntarget_unavailable/unsupported_target. The same plain Zip64 archive and the prefixed classic control are readable.The change admits the original prefixed bytes as ZIP, preserves their complete root digest, and exposes the same verified member contents. The prefix continues to appear in the inventory's unaccounted-byte limitation, with
coverage.status: "unknown".Change and scope
bigintuntil they fit the observed file regions. Resolve a deferred first-member offset from its conditional Zip64 extra field before applying the prefix shift.Contribution scope: ordinary passive archive inspection within the existing boundaries; a separate advance provider/execution scope decision is not applicable. No separate issue was opened because the patch extends the existing archive-admission owner and includes a producer-based regression for the concrete refusal.
Contract and boundary impact
Semantic owner:
hasTrailingZipArchive, shared by target admission and root inventory classification. Existing ZIP framing owners supply the parsed facts.CLI/MCP: existing inspection and extraction schemas; no new operation or input.
Evidence/provenance: complete original root identity and member identities; leading bytes remain explicitly outside member coverage.
Authority and cleanup: selected files are read; extraction writes only its selected output. Tests close the active MCP target and remove materialized test output. The prefix is never executed.
Package/installation: no dependency, package version, installer or generated catalog change.
Read existing files or captured data.
Change process memory, registers, files, or configuration.
Evidence and regression coverage
The original compiled CLI regression is 1 failed / 1 passed: prefixed Zip64 is refused while the classic control inspects and extracts successfully.
The final public workflow tests both formats through the compiled CLI and a real stdio MCP session (
open_binary, inspection, extraction and close). Each returns the two exact member contents, retains the original root SHA-256 and unknown prefix coverage, and leaves the source bytes unchanged.Sixteen new boundary cases cover adjusted and unadjusted offsets, a 64-bit first-member offset, an adjusted extensible end record, the maximum ZIP comment with a false EOCD, split-volume claims, inconsistent counts, invalid frame extents, and missing/out-of-range wide offsets. Existing native routing, classic corruption and member-accounting controls also pass.
Five producer-based wire variants were independently read and CRC-checked by Python
zipfile. Info-ZIP tested both member contents in all five: adjusted variants exited 0; the two relative-offset variants exited 1 with the expected 17-byte prefix warning and successful member checks. The extended fixture uses a short framed unknown extension accepted by the existing ZIP reader.Remaining coverage: no physical archive over 4 GiB or native Windows/macOS run. A variable-size Zip64 end record whose pointer was left unadjusted by a prepended prefix remains outside the fixed-record fallback.
Validation performed
Node 24.22.3 and npm 11.19.1 on Linux.
npm run test:focused -- tests/acceptance/artifactZipLeadingBytes.test.ts tests/boundary/filesystem/zip64LeadingBytes.test.ts tests/boundary/filesystem/zipDetection.test.ts src/domain/zipPackageFormat.test.ts src/artifacts/ZipMemberRegion.test.ts src/domain/zipEndOfCentralDirectory.test.ts— 90 passed.npm run docs:check— passed, including 8 README consistency tests.npm run check, withGOMEMLIMIT=512MiB— typecheck, lint, format, Knip, metadata, architecture guards (3,072 source files) and production reachability completed. The final whole-tree typed-lint process received SIGKILL, so the complete gate is not recorded as passing.typed-lint-changedcommand over all 7 changed TypeScript files, with the same memory setting — 0 errors, 1 advisory warning.git diff --check— passed.Compatibility, safety, and release
Existing caller-selected inputs, integrity policy, member budgets and extraction containment continue to apply. This is static ZIP recognition; no native analysis provider, target execution, installer change or breaking schema migration is involved.
Author readiness
Human owner: @Afloat16
Before merge
type(scope): outcome.