Skip to main content

admission-gate

CI License: MIT Release

A lightweight admission gatekeeper and cryptographic audit logger for autonomous CLI agents.


name: Path bypass / policy edge case about: Report a path canonicalization escape or policy engine loophole title: "[BYPASS]: " labels: bug, security

Environment

  • OS: [e.g. Windows 11, macOS Sonoma, Ubuntu 24.04, Android Termux]
  • Python Version: [e.g. 3.11]

Proposed Action

{
  "action_id": "test_bypass",
  "command": "...",
  "target_path": "...",
  "risk_tier": 1
}


---

### 3. Add an Integration Example Script

Include a short example script under `examples/agent_tool_example.py` demonstrating how an LLM tool loop hooks into `gated_shell()`:

```python
"""
Example: Hooking admission-gate into an agent tool execution loop.
"""

from admission_gate import ActionProposal, gated_shell


def agent_shell_tool(command: str, target: str) -> str:
    proposal = ActionProposal(
        action_id="agent_call_001",
        command=command,
        target_path=target,
        risk_tier=2,
    )

    executed, output, code = gated_shell(
        proposal,
        allowed_roots=["./workspace"],
        log_path="audit_log.jsonl",
        require_confirm=True,
    )

    if not executed:
        return f"Refused by gate: {output}"

    return f"Success (exit code {code}):\n{output}"


if __name__ == "__main__":
    result = agent_shell_tool("ls -la", "./workspace")
    print(result)




# 1. Create the issue template directory and file
mkdir -p .github/ISSUE_TEMPLATE
cat << 'EOF' > .github/ISSUE_TEMPLATE/path_bypass.md
---
name: Path bypass / policy edge case
about: Report a path canonicalization escape or policy engine loophole
title: "[BYPASS]: "
labels: bug, security
---

### Environment
- OS: [e.g. Windows 11, macOS Sonoma, Ubuntu 24.04, Android Termux]
- Python Version: [e.g. 3.11]

### Proposed Action
```json
{
  "action_id": "test_bypass",
  "command": "...",
  "target_path": "...",
  "risk_tier": 1
}



# admission-gate

A lightweight admission gatekeeper and cryptographic audit logger for autonomous CLI agents.

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

1. **Deterministic Filter**: Blocks dangerous patterns (`rm -rf /`) and restricts filesystem access to configured `allowed_roots` using strict path canonicalization.
2. **Interactive TTY Confirmation**: Halts for human authorization (`[y/N]`) only on proposals that pass static policy checks.
3. **SHA-256 Audit Trail**: Commits all proposals, policy outcomes, and approval decisions to an append-only, hash-chained log.

Requires Python 3.8+ with zero third-party dependencies.

---

## Quickstart

```bash
git clone [https://github.com/ak-skwaa-mahawk/admission-gate.git](https://github.com/ak-skwaa-mahawk/admission-gate.git)
cd admission-gate
pip install .

Library Usage

Wrap your agent's shell execution tool so rejected actions never hit the subshell:

from admission_gate import ActionProposal, gated_shell

proposal = ActionProposal(
    action_id="task_101",
    command="rm scratch.tmp",
    target_path="./workspace/scratch.tmp",
    risk_tier=2,
)

# Returns (executed: bool, output: str, exit_code: int)
executed, output, code = gated_shell(
    proposal,
    allowed_roots=["./workspace"],
    log_path="audit_log.jsonl",
    require_confirm=True,
)

if not executed:
    print(f"Action refused: {output}")
else:
    print(f"Command succeeded:\n{output}")

Standalone Policy Checks

from admission_gate import ActionProposal, evaluate

p = ActionProposal("chk_1", "cat /etc/shadow", "/etc/shadow", 1)
passed, reason = evaluate(p)
# passed -> False
# reason -> "Blocked: path resolves to protected directory '/etc'"

Verifying Audit Log Integrity

python3 src/admission_gate/verify.py audit_log.jsonl

Running Tests

PYTHONPATH=src python3 -m unittest discover -s tests

License

MIT

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.2.0.tar.gz (12.3 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.2.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: admission_gate-0.2.0.tar.gz
  • Upload date:
  • Size: 12.3 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.2.0.tar.gz
Algorithm Hash digest
SHA256 e86d5fa0bdcfb158baf6b33e020809fdae3d01f899d738f3a3fd22cd45c7344f
MD5 77381d9e67f1fae719b5212c3065ec91
BLAKE2b-256 1bad5c4049c1ef843afa008944a7acbb37ecc793b01aff6a7014d0e2a8ea0853

See more details on using hashes here.

Provenance

The following attestation bundles were made for admission_gate-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: admission_gate-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 11069c887a5119eba4256b1829caa2b187f9ff0988cf6411642a63200826aa0d
MD5 39b4c8cfcf32ef6c6cb07d9817d9c709
BLAKE2b-256 192bb72700e5be248576e83349cd781924fcf889d117fa4472315accc66d9240

See more details on using hashes here.

Provenance

The following attestation bundles were made for admission_gate-0.2.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

0.3.0

2 files

This release

0.2.0 This release

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