Skip to content
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
Mearman merged 5 commits into
mainfrom
feat/zip-container-and-recursive-walking
Aug 17, 2026
Merged

zip container read/write, format detection, and recursive walking with depth and size guards#1
Mearman merged 5 commits into
mainfrom
feat/zip-container-and-recursive-walking

Conversation

@Mearman

@Mearman Mearman commented Aug 17, 2026

Copy link
Copy Markdown
Member

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) and MAX_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.
  • Toolchain mirrors byte-codec exactly (turbo-wrapped scripts, tsdown neutral platform, eslint Worker-isomorphism guard + local/no-non-barrel-index, husky/commitlint, semantic-release with the commitTypes single source of truth, workerd test suite). CI is byte-codec's minus the notify-downstream job (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

@Mearman
Mearman merged commit cc5a5ad into main Aug 17, 2026
8 checks passed
@Mearman
Mearman deleted the feat/zip-container-and-recursive-walking branch August 17, 2026 13:54
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider recursive archive extraction — new sibling package vs. extending byte-codec

1 participant