Rebuff Canary-Token Injection Detector
Multi-stage prompt-injection detector pairing heuristic rules, canary tokens, and vector similarity checks.
Prerequisites & Step-by-Step Installation
Copy & run inside isolated labBefore You Start (Prerequisites)
- + Python >= 3.10 or TypeScript SDK
- + Isolated staging endpoint or test prompt wrapper
- + Secret-free canary token seed
Install Rebuff SDK inside Python environment
pip install rebuff
Use randomized cryptographic canaries per request session.
Enable canary leakage check on model outputs
python -c "import secrets; print('Canary check seed len:', len(secrets.token_hex(8)))"
Halts response streaming if the secret canary phrase echoes in model output.
python -c "import rebuff; print('OK')"
Client Integration & Configuration Files
Review scope limits before wiringpip install rebuff
python -c "import rebuff; print('Rebuff installed')"
How to Use & Defensive Workflow
Authorized assessment protocolTypical Scenario: Detect when a prompt-extraction probe causes a customer-facing chatbot to leak hidden system prompt instructions.
- 01. Inject a random per-session canary marker inside the non-user system prompt.
- 02. Evaluate incoming queries through heuristic + embedding filters.
- 03. Verify output text with is_canary_word_leaked() before returning JSON to the browser.
Wrap our RAG prompt template with per-request canary verification so system prompt leaks trigger an instant safe fallback response.
Canary detection helps catch prompt leakage (`LLM07`), not arbitrary instruction misuse; combine with strict least-privilege tool scoping.
Technical Architecture & Deployment Brief
Overview & Role in Security Engineering
Rebuff Canary-Token Injection Detector (Guardrail & Eval) is engineered to support practitioners focused on system-prompt leak detection via randomized canary tokens plus layered input heuristic scoring. Within the ToolWar ecosystem, it serves as an explicit bridge between AI reasoning layers and verifiable cybersecurity telemetry.
Technical Architecture & Data Flow
This entry bridges classical cybersecurity engineering with modern AI workflows while preserving strict human review, deterministic boundary checks, and verifiable outputs.
Unlike ad-hoc prompt wrappers that execute unconstrained strings directly in a shell, structured integration enforces typed parameter validation, bounded scope allowlists, and explicit separation between untrusted analyzed artifacts (source files, telemetry logs, network banners, or binary samples) and system-level control instructions.
Recommended Deployment Practice
- Isolate the Execution Boundary: Deploy integrations inside ephemeral containers or dedicated analysis VMs so untrusted repositories, binaries, or HTTP responses cannot affect primary workstations.
- Enforce Least-Privilege Scoping: Use read-only filesystem mounts, non-privileged service tokens, and target CIDR allowlists before enabling interactive assistant sessions.
- Verify Outputs Deterministically: Validate every generated output against deterministic static scanners or runtime guardrails before applying changes to production infrastructure.
Integration & Operational Caveats
- Treat all external content ingested by an LLM (including code comments, HTML titles, log lines, and MCP responses) as potential prompt-injection vectors.
- Review configuration JSON and
SKILL.mdmanifests carefully before binding credentials or running inside automated CI/CD pipelines.