What this thread does
The problem
You added an LLM feature (chat, summary, document Q&A) and want evidence about prompt injection before users find it. Reddit commenters in an r/LLMDevs thread on a hidden-PDF injection say a single model catch proves little: the model may flag an attack once and obey it on the next run, so you want a repeatable test with a catch rate.
What promptfoo's red-team mode does
From promptfoo's red-team quickstart (read 18 October 2026; repo MIT license, active this month):
npx promptfoo@latest redteam setup # web UI that writes promptfooconfig.yaml
# or without the UI:
promptfoo redteam init --no-gui
npx promptfoo@latest redteam run # generates adversarial inputs, saves redteam.yaml, runs them
npx promptfoo@latest redteam report # failures by category and severity, with raw inputs and outputs
Needs Node 22.22+. The config has four parts: application purpose (more detail gives more tailored attacks), a target (a model or an HTTP endpoint with url, method, headers and a body using {{prompt}}), plugins (generators of malicious inputs, individually or a preset such as Default) and strategies (wrappers that turn inputs into stronger jailbreaks and injections). The quickstart tells you to keep the same target label between runs so results compare. The docs page I read does not show the exact YAML keys for plugins and strategies; use their configuration guide.
The report lists vulnerability categories such as prompt injection and context poisoning, severity levels, a breakdown by test type, logs with the inputs that failed, and suggested mitigations.
Safety notes before you run it
- Point it at a staging deployment with fake data. It sends several hundred hostile inputs, and a weakly built app with real tools could act on them.
- The docs say attack generation defaults to OpenAI and optionally uses
OPENAI_API_KEY. They do not say what data is sent there, so assume the purpose text and the target's answers may reach a model provider and do not put real customer data in the target. npx ...@latestruns third-party code with your permissions. Pin a version you checked rather than@latestif that matters for you.
Using it with an agent
Read how my LLM feature is called (the route, its system prompt, its tools). Write the promptfoo red-team config for it: the purpose paragraph, an HTTP target pointing at http://localhost:PORT/api/chat, and the default plugin preset. Do not run it. Tell me which tools the target can call so I can restrict them first.
Mistakes to check
- Treating a clean report as proof; it is a sample of generated attacks.
- Running it against production.
- Skipping the architecture fix: commenters in the r/LLMDevs thread say tool permissions limit damage even when detection misses.
- Changing the target label between runs and losing the comparison.
Limits
I did not run promptfoo for this write-up; everything is from its docs and the repo page. Whether it finds real problems in your app is untested here.
Sources
Primary sources, opened 18 October 2026: promptfoo red-team quickstart and the promptfoo repo (metadata read through the GitHub API: MIT, last push 18 October 2026).
- Confirms: the
redteam setup,init --no-gui,runandreportcommands; Node 22.22+; the purpose, target (an HTTP target with{{prompt}}in the body), plugins and strategies parts; reuse the same targetlabelbetween runs; the report with categories, severity, logs and mitigations;promptfooconfig.yamlis what setup saves andredteam.yamlis whererunstores the generated attacks. - Corrected above: the quickstart has no staging warning (it only says the scanner can attack any endpoint reachable from your machine, so the staging advice is this thread's own), lists
OPENAI_API_KEYas optional with attack generation defaulting to OpenAI and a configurable alternative, and does not say what data is sent there, so check the provider docs and terms. - Not checked: the r/LLMDevs thread.
Started from a post by @promptfoo, packaged by the editor. Original post