Skip to content

safe-bash: add zip/unzip (ZIP archive support) #687

Closed

Description

@kamilio

Missing: zip and unzip. Only tar (+gzip) exists; ZIP is the most common interchange archive.

Behavior: unzip [-l] [-o] [-d DIR] ARCHIVE [FILES…] and zip [-r] ARCHIVE FILES…. Reuse the hardened tar-extraction safety model: reject ../absolute/traversal member names, cap member count/size/total/depth, per-entry and aggregate byte budgets, symlink-target confinement, yieldTurn cadence, and DEFLATE bomb caps (charge decompressed bytes against the output budget). VFS paths only.

From the safe-bash command gap analysis (2026-09-08). Sandbox constraints apply: bounded input/CPU/memory, VFS-only paths, cooperative cancellation, no host process/network beyond the existing curl authorizer.

Activity

  1. kamilio commented on Sep 9, 2026

    @kamilio
    MemberAuthor

    Additional concrete user impact from Barcelona guide session sess_1cab8ad3-9823-4584-bb4b-0949b485bdcb (2026-09-09, events through #118): the user explicitly requested one HTML file per day, zipped and delivered.

    After creating six HTML pages and shared CSS, the agent ran:

    cd /tmp && zip -r barcelona_tourist_guide.zip barcelona_guide/ -x ".*" && unzip -l barcelona_tourist_guide.zip

    Result: shell: line 1: zip: command not found, exit 127. It then probed multiple alternative tools and tried apt-get install -y zip, which was also unavailable. Ultimately it exported a 9,954-byte .tar.gz instead of the requested ZIP.

    Please include this end-to-end acceptance scenario: recursively archive the generated directory (six HTML files plus shared CSS), handle the -x ".*" exclusion used here, list the archive with unzip -l, and verify the exported archive opens with a standard ZIP reader and preserves the directory layout/file bytes. Existing extraction/resource safety requirements still apply.

  2. kamilio commented on Sep 10, 2026

    @kamilio
    MemberAuthor

    Implemented and verified on remote main in bf6f214, with retained-cleanup support in b7b0ec1. Adds default-preset zip/unzip, ZIP creation/update, listing/selection/extraction, VFS-only I/O, structural/CRC validation, bounded DEFLATE output, traversal and symlink confinement, and cooperative owned-staging cleanup. Full maintained npm test, lint, normal build, package lint, source/consumer types, and 22 fresh scoped/root Node/Bun/browser-platform bundle/type profiles pass. Native comparisons and supported-format/safety limitations are recorded in packages/safe-bash/docs/ZIP.md and docs/plans/issue-687-zip-unzip.md; this is not a claim of complete Info-ZIP equivalence or real-browser coverage. Release workflows are being monitored separately; remote-main delivery is verified, publication is not yet claimed.

  3. kamilio commented on Sep 10, 2026

    @kamilio
    MemberAuthor

    Release verification: the ZIP/unzip implementation is now published in poe-code@15.0.6 and @poe-platform/safe-bash@0.1.534. The successful Release workflow run is 34433754243. At September 10, 2026, 04:21 UTC, both the npm latest record and exact 15.0.6 record independently resolved to gitHead bf6f214400ff3a40c13f4cba057a72d2b276e578. This confirms actual publication, not just a green/no-op workflow. The previously documented bounded compatibility scope remains unchanged.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions