Skip to main content

admission-gate

CI License: MIT PyPI

A zero-dependency, deterministic admission security kernel and cryptographic audit logging engine for autonomous CLI agents.

When autonomous scripts or LLMs execute commands in a subshell, developers face two extremes: fully autonomous execution that risks destructive operations, or prompt fatigue from micro-approving benign steps. admission-gate sits directly between the agent and your shell:

  1. Deterministic Security Kernel: Enforces sandbox jails, blocks hazardous tokens, and canonicalizes paths (os.path.realpath) across all command arguments.
  2. Metacharacter & Environment Variable Hardening: Neutralizes command chaining evasions, redirection breakouts, indirect subshells ($(...), backticks, <(...)), and unexpanded environment variable injection ($VAR, ${VAR}, %VAR%).
  3. Risk-Tier Auto-Classification: Automatically infers risk based on command binaries, flags (e.g. sed -i), and redirection operators, ratcheting upward if an agent attempts to under-report risk.
  4. Sliding-Window Rate Limiting & Burst Control: Enforces maximum requests per minute, mandatory quiescent cooldown periods after destructive actions (Tier 3), and burst escalation.
  5. Interactive & Non-Interactive (--verify-only) Modes: Halts for operator authorization ([y/N]) on interactive terminals or runs headless with structured outputs in CI/automation.
  6. Cryptographic Audit Trail & Forensic Tools: Appends SHA-256 hash-chained JSONL logs, verifiable via verify-audit and queryable via query-audit.
  7. Native Model Context Protocol (MCP): Exposes admission-gate-mcp for direct integration into Claude Desktop, Cursor, and Cline.

Requires Python 3.8+ with zero third-party dependencies.


Installation

pip install --upgrade admission-gate

Configuration (admission_gate.toml)

Place admission_gate.toml in your working directory or provide --config <path>:

[policy]
blocked_patterns = [
    "rm -rf /",
    ":(){ :|:f };:",
    "/dev/sd",
    "> /dev/null",
    "mkfs",
]
require_confirm = true

[filesystem]
allowed_roots = [
    "./workspace",
    "./scratch",
]
protected_paths = [
    "/etc",
    "/boot",
    "/sys",
    "/dev",
    "/proc",
    "C:\\Windows",
    "C:\\Windows\\System32",
]
logging]
log_file = "audit_log.jsonl"

[rate_limit]
enabled = true
max_requests_per_minute = 30
burst_threshold = 10
tier3_cooldown_seconds = 3.0

Risk-Tier Auto-Classification

The gate calculates an effective risk tier for every proposal. The engine only ratchets upward:

Tier 1 (Read-Only / Inspection): ls, cat, head, tail, grep, find, stat, diff, wc, file. Tier 2 (Mutating / State Modification): touch, mkdir, cp, ggit add, python, node, or any command containing redirection (>, >>). **Tier 3 (Destructive / Administrative)**: rm, mv, chmod, chown, dd, truncate, kill, sed -i, mkfs, shred`.


Command Line Tools

1. admission-gate (Core Gatekeeper)

# Interactive execution
some_proposal_stream | admission-gate

# Headless / Dry-Run verification in CI
some_proposal_stream | admission-gate --verify-only

2. verify-audit (Cryptographic Verification)

Matches all prev-hash chains and validates tamper-resistance:

verify-audit audit_log.jsonl

3. query-audit (Forensic Query & Replay)

Filter historical records or simulate past proposals against updated policies:

# Filter by risk tier or status
query-audit --tier 3
query-audit --status blocked

# Filter by time window
query-audit --since 15mquery-audit --until 5m

# Replay past actions against current admission_gate.toml rules
query-audit --action-id step_1 --replay

4. admission-gate-mcp (MCP Adapter)

{
  "mcpServers": {
    "admission_gate": {
      "command": "admission-gate-mcp",
      "args": []
    }
  }
}

Running the Test Suite

PYTHONPATG=src python3 -m unittest discover -s tests

License

[MIT)(LICENSE)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

admission_gate-0.3.0.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

admission_gate-0.3.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file admission_gate-0.3.0.tar.gz.

File metadata

  • Download URL: admission_gate-0.3.0.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for admission_gate-0.3.0.tar.gz
Algorithm Hash digest
SHA256 45a00c015e1d5e1adaf8841d8138c0f4b80c0872d6d44df1131212342cd4da13
MD5 de87d9172ec9aaeafb3b272175cd649b
BLAKE2b-256 24aa1d082fb0afb2c12f617dbdbcb9b21f489795ced22ac6ac3835a654b61598

See more details on using hashes here.

Provenance

The following attestation bundles were made for admission_gate-0.3.0.tar.gz:

Publisher: publish.yml on ak-skwaa-mahawk/admission-gate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file admission_gate-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: admission_gate-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for admission_gate-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1fa6e87820196b99cdd61b8dffed18c2794607c589bdc49b4d36704276bd733
MD5 629ad86ff71c48104b4c433983b36b97
BLAKE2b-256 293db47dc430a2c6472d2bf414de9aaabb14af7e0e4fbd8a98a430d6fac01141

See more details on using hashes here.

Provenance

The following attestation bundles were made for admission_gate-0.3.0-py3-none-any.whl:

Publisher: publish.yml on ak-skwaa-mahawk/admission-gate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.4.1

2 files

0.4.0

2 files

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page