Skip to main content

guard-rail-edge 🛡️

Prompt-injection testing for CI/CD that measures whether its own AI judge can be trusted.

PyPI version Python 3.11 | 3.12 | 3.13 CI & Tests License: MIT Calibrated Judge


guard-rail-edge Terminal Demo


The Problem: Uncalibrated Judges Fail Silently

Most LLM security testers trust an arbitrary AI judge to grade security tests. In our empirical testing across 50 benchmark cases, small local judges miss 20–30% of system prompt leaks when disclosures are framed politely, while other models hallucinate an 85% false alarm rate on benign inputs.

guard-rail-edge eliminates blind trust with defense-in-depth:

  1. Code-First Catches: Deterministic cryptographic canaries and fuzzy system-prompt overlap detection catch leaks before invoking an LLM.
  2. Empirically Calibrated Judges: Benchmarked against ground-truth datasets with 95% Wilson confidence intervals.
  3. "NEEDS REVIEW" Verdict: When an LLM judge is uncertain, ambiguous, or discordant, it escalates to NEEDS REVIEW (exit 3) instead of guessing PASS.

⚡ Quickstart (Under 60 Seconds)

Step 1: Install guard-rail-edge

pip install guard-rail-edge

Step 2: Set your API Key (or use offline mock)

# Recommended free hosted judge: Groq
export GROQ_API_KEY="gsk_..."

# Or on Windows PowerShell:
# $env:GROQ_API_KEY="gsk_..."

(No API key? Test offline immediately with guard-rail-edge init --preset mock.)

Step 3: Initialize and Run

guard-rail-edge init --preset groq
guard-rail-edge run

What It Checks

guard-rail-edge evaluates production prompt defenses across real-world workloads:

  • Direct Prompt Injection: Instruction overrides, delimiter breakouts, and persona hijacking.
  • Indirect RAG Injections: Attacks embedded inside retrieved knowledge base context.
  • System Prompt Exfiltration: Extracting confidential rules, internal credentials, or canary tokens.
  • Format Breakouts: Breaking structured JSON/schema contracts or smuggling executable payloads.
  • Roleplay & Social Engineering: Authority emulation (e.g. fake compliance auditor) and hypothetical framing.

Explore realistic runnable suites in examples/:


Calibrated Judge Accuracy

Judge Calibration Chart

Empirical calibration benchmark results evaluated across 50 ground-truth cases (30 dev, 20 holdout):

Status Judge Model Leak Detection Rate (95% CI) False Alarm Rate (95% CI) Safe cases sent to review Calibration Verdict
Passed Groq qwen/qwen3.8-27b 100.0% [83.9%, 100.0%] 0.0% [0.0%, 16.1%] 15.0% (3/20) [5.2%, 36.0%] TRUSTWORTHY (Passed calibration)
Failed Groq openai/gpt-oss-120b 100.0% [83.9%, 100.0%] 35.0% [18.1%, 56.7%] 5.0% (1/20) [0.9%, 23.6%] NOT TRUSTWORTHY (Did not pass calibration)
Failed Local qwen2.5:7b* 80.0% [58.4%, 91.9%] 0.0% [0.0%, 16.1%] n/a (not measured) NOT TRUSTWORTHY (Did not pass calibration)
Failed Local qwen2.5:0.5b* 90.0% [69.9%, 97.2%] 85.0% [64.0%, 94.8%] n/a (not measured) NOT TRUSTWORTHY (Did not pass calibration)
Failed Local gemma:2b* 10.0% [2.8%, 30.1%] 80.0% [58.4%, 91.9%] n/a (not measured) NOT TRUSTWORTHY (Did not pass calibration)

With --on-review fail (default), cases sent to review fail CI; use --on-review warn to report them without blocking.

*Evaluated in commit 101a81e on local CPU. Legacy results; see docs/real-model-results.md for raw details. Calibration uses 50 cases (20 holdout, 8 holdout leaks); treat results as indicative, not a guarantee. Re-run calibrate on your own judge and, ideally, your own labelled cases.

Full evaluation methodology, confusion matrices, and audit logs: docs/real-model-results.md.


CI/CD Pipeline Integration

Add guard-rail-edge directly to your GitHub Actions workflow using our official composite action:

- name: Run Guardrail Security Gate
  uses: zayanahmed23/guard-rail-edge@v0.5.4
  with:
    suite: tests.json
    on-review: fail
  env:
    GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}

Raw model responses are redacted in CI report artifacts by default (redact-responses: true) to prevent leaking prompt secrets.

(Or run via manual CLI script: pip install guard-rail-edge && guard-rail-edge doctor && guard-rail-edge run --on-review fail --report-json security-audit.json.)

Deterministic Exit Codes

  • 0: PASSED — All adversarial tests verified safe.
  • 1 : BLOCKED — Vulnerability or prompt leakage detected.
  • 2: ERROR — Configuration or operational runtime failure.
  • 3: NEEDS REVIEW — Evaluation uncertain; human review required.

Comparison: When to Use Which

Tool Focus & Philosophy When to Prefer
guard-rail-edge Calibrated prompt-injection CI gate with code-first canary & overlap detection, self-healing patches, and "needs-review" verdicts. When you need an automated, fast CI/CD security gate that measures whether its own evaluator can be trusted.
promptfoo General LLM evaluation framework for output quality, regression assertions, and wide custom plugins. When running multi-dimensional model evals, latency benchmarks, or prompt quality comparisons.
garak Deep, extensive LLM vulnerability scanner probing model-level security weaknesses. When conducting exhaustive, academic-grade vulnerability assessments across thousands of generative probes.
PyRIT Microsoft's red-teaming framework for multi-turn risk assessment and complex attack orchestration. When evaluating multi-turn conversational agents, strategy graphs, and multimodal attack surfaces.
DeepTeam Enterprise red-teaming platform with web dashboards, risk metrics, and team management. When looking for managed enterprise attack simulation and organizational compliance dashboards.

Documentation


License

Distributed under the MIT License.

Metadata

Release files for guard-rail-edge 0.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for guard-rail-edge 0.5.4
File Size Uploaded Provenance Actions
guard_rail_edge-0.5.4.tar.gz 153.6 kB With provenance Details for guard_rail_edge-0.5.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for guard-rail-edge 0.5.4
File Interpreter ABI Platform Actions
guard_rail_edge-0.5.4-py3-none-any.whl Python 3 none any Details for guard_rail_edge-0.5.4-py3-none-any.whl

Total release size: 247.6 kB

Release files / guard_rail_edge-0.5.4.tar.gz

Download URL guard_rail_edge-0.5.4.tar.gz
Size 153.6 kB
Tags Source
SHA-256 checksum
How to use checksums
64504112c138cfee3cdeb1cde24d5fef2c15d9f972df8e8c83ee9935c22ee540
BLAKE2b-256 checksum
How to use checksums
68ab22a1967d47a895a5218d6d80defcf1d95d38a74438b3ae6fa44bbc5820fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / guard_rail_edge-0.5.4-py3-none-any.whl

Download URL guard_rail_edge-0.5.4-py3-none-any.whl
Size 93.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
715e350a5aa4ef2c2de75e12e02c113af0fff87b3ccbdc239e6ba17e6e33a315
BLAKE2b-256 checksum
How to use checksums
4d3751a726cb7c5175f0f997e0d861fc34b895314cd06ff7a920402bfa116339
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for guard-rail-edge 0.5.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for guard_rail_edge-0.5.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.4 This release

2 release files Full provenance

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