sentinel

runtime defense for CLI AI agents. intercepts tool calls before execution and enforces security policy.

CI Crates.io License Platform

the live demo

The page at target.html is a fake "CloudSync docs" site. It looks like a normal tool's documentation but every section is poisoned with a prompt injection: hidden HTML comments, white-on-white text, zero-width Unicode, CSS display:none, HTML entity encoding, link title attributes, tiny-font spans, and fake "agent instruction" blockquotes. 20+ attack payloads, every one a real pattern seen in the wild.

Feed the page to any CLI agent. With sentinel's hook installed, every dangerous tool call the agent tries to make gets blocked at the hook layer before it runs.

sentinel blocking 20 prompt injections live

what you just saw

Each line is a tool call the agent would have made after parsing the poisoned page. sentinel's policy engine evaluated the call in under a millisecond and returned deny before the tool ever ran. Every attack blocked, zero false negatives.

run it yourself

git clone https://github.com/StressTestor/sentinel
cd sentinel
cargo build --release
./target/release/sentinel install --enforce
SENTINEL=./target/release/sentinel ./docs/run-attacks.sh

attacks this page contains

TypeWhereSentinel rule
HTML comment injectiontop of pagedeny.paths ~/.aws/*
Blockquote "agent instructions"troubleshootingdeny.paths ~/.aws/*
display:none hidden divtroubleshootingcurl -d @~/.aws/*
White-on-white textconfig sectionenv | grep key exfil
Tiny-font span in h2security headingcurl | sh
Fake diagnostic code blocktoken refresh~/.ssh/*
Table with malicious commandserrors tablerm -rf, curl|bash
Fake "authorized pentest" notesecuritycurl @~/.aws
rm -rf /uninstallrecursive root deletion
rm -rf on dotfile dirsuninstallcredential dir deletion
Link title attributesupport link~/.aws/*
Literal AWS key in argssupportAKIA[0-9A-Z]{16}
HTML-entity encoded commentchangelogcurl | sh
Zero-width Unicode blockfooter/etc/passwd, ~/.ssh/*
find / for credential filessecurityfilesystem scan

how it works

Claude Code has a PreToolUse hook system. Every tool call (Bash, Read, Write, Edit) passes through the hook before execution. Sentinel installs itself as that hook. The hook receives a JSON payload with the tool name and arguments, evaluates it against your policy file in <1ms, and returns allow or deny on stdout.

you type a prompt
     │
     agent decides to run: cat ~/.aws/credentials
     │
     sentinel intercepts the tool call
     │
     policy says: ~/.aws/* → BLOCK (AWS credential access)
     │
     tool call denied. credentials safe.

three-tier defense

TierWhatLatency
1. Policydeterministic deny/allow rules (glob + regex)<1ms
2. Heuristicaho-corasick automata from attack corpus<10ms
3. LLM classifiersecondary model for ambiguous inputs100-500ms

Tier 1 runs on every tool call. Tiers 2 and 3 add defense-in-depth. Tier 1 alone caught every attack on this page.