This repository was archived by the owner on Aug 20, 2026. It is now read-only.
zip container read/write, format detection, and recursive walking with depth and size guards - #1
Merged
Conversation
…-release, turbo, workerd CI)
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the package this repo was created for (documents.js#564): ZIP container read/write over fflate, archive-format detection, and the recursive ZIP-in-ZIP walker with zip-bomb guards.
zipPackage/unzipPackage(src/zip/container.ts): ordered-entries write control with stored-uncompressed support, mirroring odf.js's container contract structurally (deliberately not importing it, keeping branding and release cadences decoupled).detectArchiveFormat/isZipArchive(src/zip/detect.ts): ZIP vs unknown from leading magic bytes (local-file-header or end-of-central-directory). tar and gzip are explicitly out of scope for v1.walkArchive(src/zip/walk.ts): detects ZIP-in-ZIP entries, walks recursively, and returns a flat listing with each entry's path-as-ancestor-chain. Two guards, both throwing rather than truncating:MAX_WALK_DEPTH(8, derived from what real producers emit - OOXML embedded objects bottom out at depth 2, J2EE packaging around 3) andMAX_WALK_TOTAL_BYTES(512 MiB cumulative across every nesting level - the same figure byte-codec grants a single stream, so a bomb's multiplicative nesting leverage becomes bounded addition). Each constant's derivation is in its source comment.local/no-non-barrel-index, husky/commitlint, semantic-release with thecommitTypessingle source of truth, workerd test suite). CI is byte-codec's minus thenotify-downstreamjob (no family package depends on archive-codec yet - the receiving automation would force-add an unused dependency) and minus the alias-publish matrix (no aliases yet).Closes ExaDev/documents.js#564
Generated by Claude Code