admission-gate
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file admission_gate-0.1.0.tar.gz.
File metadata
- Download URL: admission_gate-0.1.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1271653bd7daee21f08a92fb53d5e2a0f63a7c016a56009da7195f553607bafa
|
|
| MD5 |
2bfdf67f590daf00205e49c1c4ad4d3c
|
|
| BLAKE2b-256 |
2aa3ace6c535ecc6b6ac00ca5e51183e23e79afb5036bae98de8cdcc809e7b2c
|
Provenance
The following attestation bundles were made for admission_gate-0.1.0.tar.gz:
Publisher:
publish.yml on ak-skwaa-mahawk/admission-gate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
admission_gate-0.1.0.tar.gz -
Subject digest:
1271653bd7daee21f08a92fb53d5e2a0f63a7c016a56009da7195f553607bafa - Sigstore transparency entry: 2753236810
- Sigstore integration time:
-
Permalink:
ak-skwaa-mahawk/admission-gate@b19a2f02c80a436ce80d40c4dcf64dda11e6f8ef -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ak-skwaa-mahawk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b19a2f02c80a436ce80d40c4dcf64dda11e6f8ef -
Trigger Event:
push
-
Statement type:
File details
Details for the file admission_gate-0.1.0-py3-none-any.whl.
File metadata
- Download URL: admission_gate-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
100e597cdf5a5ad995c6e7b2c8e90af83809693718c803ba73dbc58ba5e5aed8
|
|
| MD5 |
6ca2efc8a9c749568abf092b8708b92f
|
|
| BLAKE2b-256 |
ed8ad01008ec12d829cf7775b528e43945d231e1827684f8975567b29704942d
|
Provenance
The following attestation bundles were made for admission_gate-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on ak-skwaa-mahawk/admission-gate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
admission_gate-0.1.0-py3-none-any.whl -
Subject digest:
100e597cdf5a5ad995c6e7b2c8e90af83809693718c803ba73dbc58ba5e5aed8 - Sigstore transparency entry: 2753236831
- Sigstore integration time:
-
Permalink:
ak-skwaa-mahawk/admission-gate@b19a2f02c80a436ce80d40c4dcf64dda11e6f8ef -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ak-skwaa-mahawk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b19a2f02c80a436ce80d40c4dcf64dda11e6f8ef -
Trigger Event:
push
-
Statement type: