- Home
- Skills
- APIs & Backend
- Safe ZIP Intake for Untrusted Archives
Safe ZIP Intake for Untrusted Archives
A ZIP from a customer, a marketplace, a webhook or another agent is hostile until proven otherwise.
$29
Works with the AI Agents you already use
Safe ZIP Intake for Untrusted Archives
Example session with this skill installed
A customer uploaded plugin-bundle.zip through our portal. Check whether it is safe to unpack into /srv/plugins/incoming and unpack it if so.
- Read your context and instructions
- Compiled the safe zip intake
Summary
Refused: the archive contains a path-traversal entry and an entry whose declared size does not match its bytes. Nothing was written.
What the inspection found
python -I scripts/safe_zip.py inspect plugin-bundle.zip --json- Entry 7:
assets/../../etc/cron.d/pluginrefused by ruletraversal. - Entry 12:
vendor/blob.bindeclared 2.1 MB but inflates to 1.9 GB (ratio 900:1), refused by ruleratio. - 31 other entries: names clean, stored or deflated, no symlink or special-file attributes, no case-insensitive collisions, CRCs match.
- Archive digest (SHA-256) taken through a single open descriptor; inode, size and mtime identical before and after reading.
Exit
1 (refused), rule names in the output. The destination directory was left empty and untouched. Ask the sender for a clean bundle or allow-list the digest of a reviewed one with --sha256.
Tests
python -I scripts/test_safe_zip.py: 14 passed.
Connects securely to your tools. The creator never sees your data.
About this skill
The standard library's extractall will write ../../.ssh/authorized_keys, follow a symlink entry out of the destination, let readme.md overwrite README.md on a case-insensitive filesystem, and decompress 10 KB into 10 GB. A ZIP from a customer, a marketplace, a webhook or another agent is hostile until proven otherwise.
safe_zip.py (standard library, Python 3.9+): inspect_bundle checks every entry before a byte is written: .., absolute paths, drive letters, backslashes, NUL, trailing dots and spaces; symlink and special-file entries from external attributes; names that collide under case folding; encrypted entries; compression methods other than stored and deflated; entry count, declared expanded size and per-entry compression ratio caps; CRC. inspect_file hashes and sizes the archive through one open descriptor and compares the inode, size, mtime and link count before and after, so the file you verified is the file you read, and an approved SHA-256 can be required. extract writes only into an existing, empty, link-free directory, with xb (an existing file is an error), counting bytes against both the entry's declared size and the global cap so a lying central directory is caught, and resetting modes to 0600 so nothing arrives executable or setuid.
CLI: inspect and extract with --sha256, --max-entries, --max-expanded-bytes, --max-bundle-bytes, --max-ratio, --json; exit 0 ok, 1 refused with the rule named, 2 could not run.
14 offline tests including a hand-patched archive whose central directory lies about sizes. No network. Lifted from a job runner that executes only operator-approved bundles.
ZIP only. Strips executable bits (sets 0600). Windows skips symlink-destination tests. Requires Python 3.9+.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 19 days ago
Requires
Permissions
Shell to run the Python script and tests; read files to inspect the archive; write files only on extract, into an existing empty directory you name. No network access, no environment variables.