Archive extraction guard
A deterministic Claude Code PreToolUse gate that permits archive listing and integrity tests while refusing extraction commands whose entry paths, links, and expansion size cannot be verified without executing the tool.
Runs on
Scope
$npx @youdede/toolkit add archive-extraction-guard --target claude-code
What it does
Block agent-driven archive extraction when entry containment cannot be proven before execution.
When it fires
- setup
- implementation
How it behaves
Recognize archive listing versus extraction and deterministically refuse unverified expansion.
It does not extract, rewrite, repair, or delete an archive.
It does not claim that filename-only listing proves archive safety.
It does not accept an inline flag or environment variable as approval.
Configuration
targets/claude-code/archive-extraction-guard.mjs
- Version
- 1.0.0
- Requires
- Shell command guard
- Licence
- RiskThis automatic gate blocks agent-driven archive extraction when entry containment cannot be proven before execution; a false denial can interrupt legitimate work, but it does not execute the blocked action.
- Medium
- ModeHow it works: fixed rules, model instructions, or both.
- Deterministic only
- Behaviour
- Enforces, blocks on violation
- On failure
- Denies and blocks
- LatencyThe entrypoint handles one intercepted event to block agent-driven archive extraction when entry containment cannot be proven before execution without deferred work.
- Immediate
- Data retentionWhether data remains after use and who manages its storage.
- Not retained
Often used with
All in Security