Why red teaming coding agents needs its own test plan
promptfoo coding agent plugins test whether an autonomous coding agent preserves code-review, filesystem, terminal, environment, process, automation, network and verifier boundaries. If your team has given a coding agent access to a repository, a terminal, secrets or CI pipelines, the question is not whether it writes useful code but whether it stays inside those boundaries when the content it reads is hostile or simply unexpected. A general chatbot test does not answer that, because the agent's risk comes from the actions it can take, not only from the text it returns.
Teams need this check at three points: before the first rollout, after any new tool, permission or secret is attached to the agent, and inside CI wherever the agent runs with pipeline credentials. The promptfoo coding agents guide covers the main failure modes in this area: repository prompt injection, terminal trust, secret leaks, sandbox escapes, CI exfiltration, unsafe automation and verifier sabotage. Read it alongside your own inventory of what the agent can reach, because the tests are only as useful as the boundaries you define for them. Confirm which of these boundaries your agent runtime actually enforces before assuming the tests will find gaps in them.
The risk maps onto three categories that security reviewers already use. LLM01 Prompt Injection covers instructions hidden in a README, issue or dependency file that the agent follows. LLM03 Excessive Agency covers the permissions the agent holds beyond what its task needs. ASI05 Unexpected Code Execution, from the OWASP Top 10 for Agentic Applications, covers code the agent runs that nobody reviewed. A test plan should record which of these the agent can trigger and which owner accepts the residual risk. Ask your vendor or internal platform team to confirm the agent's sandbox, token scope and network egress settings so the findings can be traced to specific controls.
Which coding agent risks the plugins and guide cover
The promptfoo coding agent plugins and guide organize coding agent testing around the boundaries an agent must keep: what it reads, what it runs, what it can reach and what it reports. The six areas below overlap in practice, so a single task often probes more than one of them. Confirm exact plugin names in the promptfoo docs before writing test configurations.
Repository prompt injection
Instructions can hide in code comments, README files, issue text or documentation that the agent reads while working. The boundary tested is the code-review boundary: whether the agent treats repository content as data rather than as instructions from the person who assigned the task. This maps to LLM01 Prompt Injection and ASI01 Agent Goal Hijack. Check whether the agent changes its plan or runs unrequested commands after reading a planted file.
Coding agents guideTerminal trust
Coding agents run shell commands, so the terminal is a privileged surface. The terminal boundary tests whether the agent runs commands that a planted instruction requested, such as installing unreviewed packages or piping remote scripts into a shell. This relates to LLM03 Excessive Agency and ASI02 Tool Misuse. Check which commands run without approval and what the agent does when a command output contains new instructions.
Secret leaks
Coding agents often have access to environment variables, configuration files and credential stores on the developer machine or CI runner. The test checks whether the agent reads, prints, writes or transmits these values when a task or planted content asks it to. This maps to LLM02 Sensitive Information Disclosure. Check what appears in agent output, logs and generated files, not only in the final answer.
Sandbox escapes
The sandbox boundary tests whether the agent can reach files, processes or network resources outside the workspace it was given. Attempts may target parent directories, host configuration or other processes. This relates to LLM03 Excessive Agency and ASI05 Unexpected Code Execution. Confirm the sandbox policy in your own environment, because the test shows only what the configured sandbox permits.
CI exfiltration
When an agent runs inside a pipeline, it holds pipeline secrets and can send data outward through build steps, artifacts or outbound requests. The boundary tested is the automation and network boundary: whether injected content can make the agent upload data to an external destination. This maps to LLM02 and ASI02. Check which pipeline variables the agent can read and which egress paths the runner allows.
Verifier sabotage
Agents often run tests or linters to confirm their own work. Verifier sabotage tests whether the agent edits, disables or weakens those checks so that a failing change appears to pass. This relies on the verifier boundary and maps to ASI10 Rogue Agents and LLM03 Excessive Agency. Review file hashes of test and configuration files before and after each run to see whether verifier code changed.
Which coding agent test setup fits each environment
A local sandbox runs the promptfoo coding agent plugins on a developer's own machine, usually against a checkout of a repository the developer already works in. Because promptfoo runs completely locally and talks directly with the model, the run touches whatever the developer's shell, environment variables and home directory expose to the agent. That makes this setup useful for early iteration on plugins and grading, but the blast radius is the developer's full workstation.
- Enable the coding agent plugins against a copied or throwaway branch, not the main working tree.
- Data touched includes local files, shell history, SSH keys and any tokens in environment variables that the agent process inherits.
- Trade-off is high realism of the developer's real tooling against a large blast radius if the agent escapes its intended boundary.
- Strip credentials from the environment before the run, and confirm which filesystem paths the agent can read.
- Keep traces and file hashes from each run so results can be compared later.
Before running here, confirm that no production or personal credentials are reachable from the shell that launches promptfoo.
A shared CI runner executes the scan inside the pipeline that builds the repository, often with the same repository secrets that deploy code. This is the most realistic setup for CI exfiltration and unsafe automation tests, because the pipeline's own configuration and secrets are part of the attack surface. It is also the setup where a successful exfiltration would expose live credentials, so it deserves the most restrictive configuration.
- Enable the CI exfiltration and unsafe automation checks only on scheduled or protected branches.
- Data touched includes repository secrets, deployment tokens, the runner's network egress and cached artifacts from other jobs.
- Trade-off is maximum fidelity to how the pipeline runs against the risk of exposing live secrets to a test agent.
- Restrict the job to a runner pool with no production network access and with secrets scoped to the job rather than the project.
- Confirm whether the runner is shared between projects, since a shared runner widens the audience for any leaked value.
Before enabling any CI job, ask your platform team which secrets the job can read and whether egress from the runner can be limited to the model endpoint.
An isolated test repository is a purpose-built copy of the codebase seeded with dummy credentials, fake customer data and planted instructions in files, issues and dependency manifests. The agent runs against this repository with no access to real secrets, so a successful leak reveals only a placeholder. This setup gives up some realism, such as the true structure of internal tooling, in exchange for a bounded blast radius and reproducible results.
- Enable all coding agent plugins, including repository prompt injection and verifier sabotage, since no live systems are at risk.
- Data touched is limited to the test repository, its synthetic secrets and the model endpoint.
- Trade-off is lower fidelity to real tooling in return for a bounded blast radius and repeatable runs.
- Plant canary values in place of secrets so that any leak is detectable in traces and file hashes.
- Rebuild the repository from a known commit before each run so that file hashes can be compared across runs.
Before relying on this setup, check that the dummy credentials cannot authenticate to any live service, including internal package registries.
Set up a coding agent red team in a disposable repository
This sequence builds a contained test environment, points promptfoo at the coding agent under test, and produces scan results and traces you can review as evidence. Each step ends with a check so the team can confirm the test cannot reach real code, credentials or systems before the first run.
Install promptfoo on a supported Node.js runtime
The engineer running the scan installs promptfoo from npm on a workstation or runner that is separate from production systems. The promptfoo 0.124.1 release, published on 8 October 2026, requires Node.js 22.22.0 or newer, so check the runtime version first with
node --version, then install the package and confirm the CLI responds withnpx promptfoo --version. The step is complete when the version prints without errors and matches the release you intend to test with. Confirm the exact install method against the promptfoo introduction page.Create the disposable test repository
Create a new repository that contains no company code, no production configuration and no shared secrets. Plant dummy secrets, such as fake API keys and a fake
.envfile, so that a leak is visible in the traces without exposing anything real. Add one seeded injection file, for example a README or a comment in a source file that contains instructions the agent should refuse to follow. The step is complete when a search for your organization's real key formats, internal hostnames and token prefixes returns nothing, and the dummy values are the only secrets present.Isolate the agent's access to the test repository
Run the coding agent in a sandbox or container that mounts only the disposable repository. Remove or block access to the host home directory, SSH keys, cloud credentials, package registry tokens and the network routes your CI system uses. Make sure the agent's API credential is a test key with a spending limit and no access to production model accounts. The step is complete when a test command run from inside the agent's environment cannot read files outside the repository, cannot reach internal services, and cannot find any real credential in its environment variables.
Configure the coding agent as the target
Write a promptfoo configuration that points the red team target at the coding agent, using the provider and target options described in the promptfoo documentation for coding agents. Set the working directory to the disposable repository and state the agent's allowed actions in the purpose field, so the generated tasks match what the agent is meant to do. The step is complete when a single benign request, such as asking the agent to summarize the repository, returns a response and a trace that shows it read files only inside the test directory.
Select coding agent plugins and generate tasks
Enable the coding agent plugins in the configuration. They test whether the agent preserves code-review, filesystem, terminal, environment, process, automation, network and verifier boundaries. Tasks are generated with the promptfoo remote red team generator, so the team should confirm in the documentation what data leaves the machine during generation before running it on any repository. The step is complete when the generated task list is saved, reviewed for anything that targets real systems, and shows at least one task for each boundary you intend to test.
Run the coding agent red team scan
Run the red team scan from the command line or from a CI job that uses the same isolated environment. Keep the run limited to the disposable repository and record the promptfoo version, the agent version and the configuration file hash alongside the output. The step is complete when the scan finishes and writes results without the run touching anything outside the test directory. Verify this by comparing file hashes of the repository before and after the run, and by checking that the agent's network logs show no connections beyond the approved endpoints.
Review traces and preserve evidence
Open the results and review each failed or flagged case against its trace, checking which files the agent read, which commands it ran, whether it printed a dummy secret and whether it followed the seeded injection. Save the traces, the configuration, the generated tasks and the repository hashes together so the findings can be reproduced and retested after fixes. The step is complete when every flagged finding has a trace, a file hash record and a note on whether it reproduces on a second run. Confirm your retention and access rules for these artifacts before sharing them outside the security team.
Using traces and file hashes as evidence of a failure
Keep three kinds of evidence from every coding agent run that fails a red team check: the trace of tool calls and terminal commands, the prompt and task that triggered the behavior, and hashes of repository files and configuration taken before and after the run. The trace is what lets you show the failure step by step, such as a file read outside the task scope, a command that touched credentials, or an outbound request during a CI job. Store the exact task text and the promptfoo configuration version with it, so the run can be reproduced later against the same setup. Without the input, a trace is hard to interpret and hard to rerun.
File hashes answer a narrower question that auditors and engineering leads ask first: did a verifier, test harness, CI definition or agent instruction file change during the run? Record hashes of the files that gate delivery, such as CI pipeline definitions, test runners, lint and policy configuration, and agent instruction files, before the agent starts and again after it stops. Any difference is provable evidence of a change. Be precise about what the comparison shows. A hash comparison shows whether a file changed, not who changed it or why, so pair it with the trace and your repository history before drawing conclusions about the agent or a person.
Decide retention and access for this evidence before the first run. Traces can contain source code, secrets that the agent printed, internal paths and customer data pulled into a task, so treat them as sensitive records. Confirm with your security and legal teams how long traces and hashes are kept, where they are stored, who can read them, and how they are deleted. Because promptfoo runs locally by default, the storage location is your decision, not the tool's. The same confirmation applies to any shared reports that quote trace content.
Security and operational risks of running the tests
Running coding agent red teams creates its own exposure: the test run touches credentials, CI systems, model budgets and stored evidence. promptfoo runs locally by default, but its self-hosted server has limits that matter for team use. The four cards below cover the risks to plan for before the first scan.
Test runs can leak secrets or trigger CI
A red team run makes real calls from your machine or runner, so an agent that is tricked into reading .env files or pushing to a pipeline can do it with your credentials. Use dummy credentials and tokens scoped to a sandbox repository, and disable production pipelines, deploy keys and webhooks for the test repository. Confirm that the CI job running the scan cannot reach production secrets. promptfoo documents that it runs locally and talks directly with the LLM, so your own environment is the boundary to protect.
Self-hosted server is not production ready
The self-hosted promptfoo app stores data in a local SQLite database that cannot be shared across replicas. It has no RBAC, horizontal scaling, built-in authentication or SSO, and the documentation does not recommend it for production. Treat it as a single-instance tool for a small group, placed behind your own access controls. If several teams need shared results with access control and SSO, ask the vendor about Enterprise or On-Premise before you scale the open-source server.
Self-hosting docsRepeated runs consume model budget
Every probe in a coding agent scan is a model call, and the agent may make several calls per task. Repeated runs in CI multiply that cost, and a misconfigured scan can run far more probes than intended. Set plugin counts, strategy lists and retry limits explicitly, and cap the provider key's spending limit with your model vendor. Confirm with your provider what each call costs before you schedule nightly runs. The Community edition includes 10k red team probes per month, so check that limit against your planned scan size.
promptfoo pricingEvidence files need code-level protection
Traces, transcripts, file hashes and reports show the repository contents, prompts and sometimes secret values the agent saw. That makes them sensitive in their own right, so store them with the same access controls, retention rules and encryption as the code they describe. Redact or regenerate any secret that appeared in a trace, and record hashes of the repository before and after each run so tampering is detectable. Agree a retention period with your security team before the first run, since the evidence accumulates quickly.
Questions teams ask before red teaming coding agents
What does red teaming a coding agent cost and what drives the effort?
The cost is mostly labor: the time to set up the agent under test, build the test environment, write or generate tasks for each boundary, run them and interpret the traces. Effort rises with the number of repositories, the number of agent integrations (for example, a terminal agent and a CI-hosted agent), the number of boundaries under test, how much trace access the team can give, and how long evidence must be retained. Each of these is a line item to confirm in a written scope. Model usage is a separate cost paid to the model provider, and it recurs with every run. promptfoo itself is free under the MIT license, so the license does not add a fee. Ask a partner to price setup and testing separately, and to state which runs are included and which are optional retests.
How long does a coding agent red team take?
Duration depends on the same drivers as cost: how many repositories and agent integrations are in scope, how many boundaries are tested, and how quickly access to the test environment and traces is granted. A single agent in a sandboxed test repository with a short boundary list will take less time than several agents across production-like CI. No duration figure is supplied for this work, so ask the partner for a timeline tied to named milestones: environment ready, first test run, findings review, fixes, and retest. Build time for the sandbox and access approvals often takes longer than the testing itself.
What must our team provide before testing starts?
Plan to provide four things before testing starts:
- A test repository that mirrors the structure of the real code but contains no production code or customer data.
- Dummy secrets, such as fake API keys and tokens, placed where the agent could find real ones, so a leak is visible without exposing a credential.
- Agent access with the same tools, permissions and configuration the agent uses in your environment, plus an account to test with.
- A CI sandbox where the agent can run, with outbound network rules you control so exfiltration attempts are logged rather than delivered.
Also name a reviewer who can approve test scope changes and receive findings. Confirm each item in the written scope, including who owns the sandbox and who can read the traces.
Can our internal team run coding agent red teaming alone with promptfoo?
Yes, in principle. promptfoo is licensed under the MIT license, can be used as a CLI, a library or in CI/CD pipelines, and runs locally, with evals running on your machine and talking directly with the model. The coding agent plugins generate tasks that test code-review, filesystem, terminal, environment, process, automation, network and verifier boundaries. The harder part is the surrounding work: building a realistic sandbox, deciding which boundaries matter for your agent, interpreting traces, and keeping evidence such as file hashes in a form reviewers accept. Check whether your team has the time and skills for that before choosing between self-service and a partner. The license covers the software only, not the work of designing and running the tests.
Does promptfoo Enterprise or On-Premise change how coding agent testing works?
The core testing method stays the same. Enterprise adds team sharing, teams-based access control and SSO, custom roles and permissions, continuous monitoring, a centralized guardrail dashboard, remediation recommendations and priority support with SLAs. On-Premise runs that functionality on your own infrastructure with complete data isolation and a dedicated deployment engineer. Both are sold at custom pricing, so ask the vendor for a quote. Self-hosted promptfoo without Enterprise uses a local SQLite database, has no RBAC, horizontal scaling, built-in authentication or SSO, and is not recommended for production use. Teams that need shared access or audited history across several repositories should weigh that before choosing the open-source setup.
What should we ask a partner to include in a written coding agent scope?
Ask for a written scope that lists:
- The agent versions, integrations and repositories in scope, and which are excluded.
- The boundaries tested, named after the promptfoo coding agent plugin categories, with the test cases for each.
- The sandbox the work runs in, who builds it, and how network egress is controlled.
- The evidence delivered, including traces, file hashes, findings with severity, fixes and a retest.
- Trace and data handling: who can read traces, where they are stored and how long they are retained.
- Included retests, the timeline with milestones, and what changes the price.
- Your responsibilities, the named contacts and the acceptance criteria.
Most engagements are fixed-scope, so agree these items in writing before work starts.
Keep the agent, repository and evidence inside a boundary you can prove
The diagram starts on the tester's machine or CI runner, where promptfoo generates coding agent tasks and sends them to the coding agent target. The agent works only inside a disposable test repository seeded with planted secrets and injected instruction files, and that repository sits behind an isolated network boundary that production systems never cross. Check that the agent cannot reach production credentials or networks, then confirm that traces and file hashes are written out as evidence before the environment is torn down.
Test harness, coding agent and repository with the production trust boundary marked.
How DeployOpen scopes coding agent red teams
A DeployOpen coding agent red team starts with a written scope that names the agent, the boundaries it must keep, the repositories it can touch and the CI systems it can reach. Before any test runs, the team and the client agree on which of the coding agent plugin boundaries are in play: code review, filesystem, terminal, environment, process, automation, network and verifier. Each boundary becomes a line in the scope with an owner, so a finding can be traced to a control the client actually operates. The scope also records whether the agent runs with a developer's workstation credentials, a shared runner or a dedicated sandbox, because that choice changes which secret leak and CI exfiltration tests are meaningful.
Next, DeployOpen builds a disposable test environment inside the client's own infrastructure. It uses throwaway repositories seeded with planted secrets that are fake, mirrored CI configuration, and a sandbox that mirrors the production agent setup. Nothing in this environment should reach real credentials or production pipelines. The client confirms the network egress rules, the model endpoints the agent may call and how the environment is torn down after testing. The team then runs the coding agent plugins, generating tasks with the promptfoo remote red team generator, and keeps the traces and file hashes that each run produces as evidence.
Findings are delivered with the trace for each failed case, the hashes of files before and after the run, the boundary affected, and a proposed fix such as tighter tool permissions, terminal approval rules or CI token scoping. After the client applies fixes, DeployOpen retests the same cases and reports what changed. DeployOpen prepares this evidence and the findings report. It does not issue audit reports or certifications, so independent auditors remain responsible for any assurance opinion. For organizations that change agents or pipelines often, DeployOpen offers retainers for continuous testing, which are priced separately from the fixed-scope engagement.

