The prompt injection testing tool stack you can run in CI
A prompt injection testing tool earns its place in CI when a hit returns a non-zero exit code and blocks the merge. promptfoo exits with code 100 when at least 1 test fails.
Published on
A prompt injection testing tool earns its place in CI when a hit returns a non-zero exit code and blocks the merge. promptfoo does this out of the box: its eval command exits with code 100 when at least 1 test fails. This page wires three open-source tools into GitHub Actions for a site chat: promptfoo on every pull request, garak as a nightly scan and PyRIT for multi-turn attacks before a release. Prompt injection is ranked first, as LLM01:2025, in the OWASP Top 10 for LLM Applications (the Open Worldwide Application Security Project list of the 10 main risks of LLM apps). That ranking is why we test it on each commit.
Key takeaways:
- promptfoo (MIT) exits with code 100 on a failed test, which fails a GitHub Actions job with no extra script.
- garak (Apache 2.0) writes a JSONL report and a hit log on every run, a fit for a nightly job.
- PyRIT (MIT) runs multi-turn attacks such as Crescendo and TAP against HTTP, WebSocket and Playwright targets.
- On 28 November 2026 the three repositories counted 27.8k, 10.2k and 5.2k GitHub stars.
What a prompt injection testing tool should catch on each commit
Each commit that touches a system prompt, a model ID or a tool schema changes the attack surface. A prompt change that drops one refusal line reopens attacks that passed last week. The suite on a pull request covers three things: system prompt extraction, instruction override, and hijacking of the chat away from its stated purpose.
Most published tool lists answer a different question. One October 2026 roundup of 10 tools covers 6 runtime detectors or guardrails, 1 action runtime and 3 open-source testers. Runtime detectors screen live traffic in production and bill by volume: Amazon Bedrock Guardrails charges $0.08 per 1,000 text units for prompt attack checks and $0.10 per 1,000 text units for sensitive information filters, and Google Cloud Model Armor charges $0.10 per 1 million tokens past 2 million free tokens a month. Meta Llama Prompt Guard 2, the self-hosted option, ships in 86M and 22M parameter variants with a 512-token context window. The three testers run before release, and they are the ones that belong in a pipeline.
| Tool | License | Role in the pipeline | Cadence | Targets |
|---|---|---|---|---|
| promptfoo | MIT | Regression gate with YAML suite | Every pull request | Model providers, HTTP, browser |
| garak | Apache 2.0 | Broad probe scan | Nightly | REST, OpenAI, Hugging Face, Bedrock |
| PyRIT | MIT | Multi-turn attacks | Before each release | HTTP, WebSockets, Playwright |
promptfoo on every pull request
promptfoo is a CLI and library for evaluating and red teaming LLM apps, now part of OpenAI and still MIT licensed. It needs Node.js 22.22.0 or later. Its red team generates attacks from plugins (attack categories) and strategies (ways to wrap each attack), with a default of 5 tests per plugin and a concurrency of 4.
The prompt injection testing tool config that fails the build
This config is the core of the suite. It targets the same model and system prompt your chat ships with, the system prompt sitting in a chat-format file whose user turn holds {{prompt}}:
description: Site chat injection suite
providers:
- id: openai:gpt-5-mini
label: site-chat
prompts:
- file://prompts/system.json
redteam:
purpose: Support chat for an online store, answers from the catalogue only
numTests: 5
plugins:
- owasp:llm:01
- prompt-extraction
- hijacking
- system-prompt-override
strategies:
- basic
- jailbreak:metaGenerate the attacks, then run them as a normal eval so the exit code reaches the job:
name: injection-tests
on: pull_request
jobs:
promptfoo:
runs-on: ubuntu-latest
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24'
- run: npx promptfoo@latest redteam generate -o redteam.yaml
- run: npx promptfoo@latest eval -c redteam.yamlThe eval returns 100 on any failure and 1 on any other error. Set PROMPTFOO_PASS_RATE_THRESHOLD to tolerate a known false positive rate, or PROMPTFOO_FAILED_TEST_EXIT_CODE to change the code. Cache ~/.cache/promptfoo with actions/cache to reuse LLM requests and outputs between runs. The free Community CLI covers up to 10,000 red team probes a month.
garak and PyRIT outside the pull request
garak as a nightly scan
garak is NVIDIA's LLM vulnerability scanner, under Apache 2.0, installed with python -m pip install -U garak. Its probes are attack modules; --spec probes.promptinject runs only the PromptInject methods. The rest.RestGenerator connects garak to any REST endpoint that returns plain text or JSON:
{"rest": {"RestGenerator": {
"name": "site chat staging",
"uri": "https://staging.example.com/api/chat",
"headers": {"Authorization": "Bearer $KEY"},
"req_template_json_object": {"message": "$INPUT"},
"response_json": true,
"response_json_field": "reply"}}}Run it on a schedule with python -m garak --target_type rest -G site_chat.json --spec probes.promptinject. garak replaces $KEY with the value of REST_API_KEY, times out a request after 20 seconds and retries on HTTP 429. Each run writes a new JSONL report and a hit log of the attempts that found a vulnerability. Add a step that fails the nightly job when the hit log holds an entry. garak runs before release and blocks no live traffic.
PyRIT for multi-turn attacks
PyRIT (Python Risk Identification Tool) is Microsoft's MIT-licensed red teaming framework, version 1.2.1 in its current documentation. It runs multi-turn strategies such as Crescendo, TAP and Skeleton Key, where the attacker model escalates over several turns. Install it with pip install pyrit; Python 3.13 is the recommended version. The pyrit_scan command runs built-in scenarios from a shell, and results land in SQLite memory for review. RAMPART, a pytest-native layer built on PyRIT, turns red team findings into repeatable CI regression tests. Run PyRIT before each release, because a 10-turn conversation sends 10 model requests where a single-turn probe sends 1.
"Automation can help cover more of the risk landscape," write Blake Bullwinkel and 25 co-authors of the Microsoft AI Red Team, after red teaming over 100 generative AI products.
Pointing a prompt injection testing tool at a browser chat
A chat that runs on the visitor's own AI has no server endpoint holding the model. The conversation runs in the page, between the visitor's browser and their provider. A test runner in CI has no visitor, so you split the target into three layers. First, test the prompt and model pair directly: the promptfoo config above sends your system prompt to openai:gpt-5-mini with a test key stored in CI secrets, so the CI account pays for the run. Second, test the server side that remains: an MCP server exposing site tools answers over HTTP, which promptfoo and garak reach through their HTTP and REST targets. Third, test the full page with Playwright, through the promptfoo browser provider or a PyRIT web app target, in the nightly job. The promptfoo documentation calls the browser provider a last resort. It supports Chromium only and runs at concurrency 1 when a session persists.
Two details matter for the browser layer. Streamed replies need a wait step, since the provider does not detect streamed text inside an existing element. Run it against staging, with the checklist in the launch checklist for a chatbot going live as the pass criteria, and keep runtime filters in place: tests measure a risk that open source LLM guardrails compared for a browser chat reduce in production.
How TensorPass approaches chat security
We build AI chat that runs on the visitor's own AI. Read how we attacked our own AI chat for the method.
AI Connect SDK. The SDK is under Apache 2.0, public on GitHub since 12 November 2026. Its four packages have been on npm under the @tensorpass scope since 16 November 2026, with provenance signed by the GitHub build.
AI Wallet. It runs in a browser on a computer: Chrome, Edge, Brave and Opera add it from the Chrome Web Store, and Firefox adds it from Firefox Add-ons.
Done-for-you service. We make a site AI native in under 24 hours, priced on quote. Vulnerability reports go to [email protected].
Wiring the three jobs, in order
- promptfoo on pull requests. Start with
owasp:llm:01and 5 tests per plugin. - Exit code check. Confirm a planted failure returns 100 and blocks the merge.
- Response cache. Cache
~/.cache/promptfooto cut repeat calls. - garak nightly. Run
probes.promptinjectagainst staging over REST. - Hit log gate. Fail the nightly job on any hit log entry.
- PyRIT before release. Run Crescendo and TAP against the full page.
Start with the pull request job this week; it takes one config file and one workflow. Add garak once the gate is green for 5 runs in a row, then PyRIT before your next release. For the wider threat model, see AI chatbot security for a public website. Keep each prompt injection testing tool in the pipeline as the measure of the risk before a merge; runtime guards reduce that risk in production.
Also worth reading:
- The launch checklist for a chatbot going live
- Open source LLM guardrails compared for a browser chat
- AI chatbot security for a public website
- How we attacked our own AI chat
Sources:
- Command line : Promptfoo documentation, consulted 28 November 2026
- Red team configuration : Promptfoo documentation, consulted 28 November 2026
- Red team quickstart : Promptfoo documentation, consulted 28 November 2026
- GitHub Action : Promptfoo documentation, consulted 28 November 2026
- Browser provider : Promptfoo documentation, consulted 28 November 2026
- promptfoo repository : GitHub, consulted 28 November 2026
- garak, the LLM vulnerability scanner : NVIDIA, GitHub, consulted 28 November 2026
- garak.generators.rest : garak reference documentation, consulted 28 November 2026
- PyRIT documentation 1.2.1 : Microsoft, consulted 28 November 2026
- PyRIT repository : Microsoft, GitHub, consulted 28 November 2026
- 10 Best Prompt Injection Detection Tools for AI Agents : Arcade.dev, 9 October 2026
- LLM01:2025 Prompt Injection : OWASP GenAI Security Project, 2025
- Lessons From Red Teaming 100 Generative AI Products : Microsoft AI Red Team, arXiv, 13 January 2025