Agent Safety Lab
A sandboxed harness with an independent oracle, honest statistics and a hard budget. It exists for two reasons: to measure what a coding agent does when the repository it reads tries to steer it, and to make PandaWard, a passive SAST with its own data flow engine, better and harder to fool. This page says what it has already given the product, what it measured, and what is not done.
What it gave PandaWard
- A check on what agents claim, in the product (0.2.17). The claim checker the lab built for its evidence arm is the code behind
pandaward verify-report, thepandaward_verify_reportMCP tool and a check in the Claude Code Stop hook. If Claude's last message saysE-001: PASSand the ledger has FAIL, BLOCKED, SUSPECTED or STALE for it, cites an evidence hash the ledger never recorded, or says everything passed while controls are not PASS, the hook hands the message back to Claude to correct before you read it. A more careful report is never blocked. Only structured lines and all-clear statements are read, so a false claim in free prose is not caught. - A better ReDoS check, found through labelled data. The lab's way of labelling findings against known truth (
cvebench --emit-findings) showed that the ReDoS analysis kept flagging a patched pattern because it treated bounded loops as unbounded. Fixing it keeps all 20 ReDoS detections on the OpenSSF CVE Benchmark and recognizes 2 more fixes (13 to 15 of 20). - A discipline for benchmarks. Intervals on every rate, a paired comparison on the same cases, a held-out split frozen before a run, a scan that did not happen counted as an error and not as zero, and discarded runs listed instead of hidden. The standard-rule rows on the benchmark page were built this way.
Triage of findings: measured on labelled data
The OWASP Benchmark labels every test case as vulnerable or not, so a finding in a non-vulnerable case is a labelled false positive. An agent (headless Claude Code on the maintainer's subscription, no tools, the source file in the prompt) judged each finding; the label is the oracle. A verdict removes a finding from view only in this measurement: it is a hypothesis and never closes a finding.
| Findings | Shown precision, raw scan | Shown precision, after triage | False positives removed | True findings dropped |
|---|---|---|---|---|
| PandaWard built-in rules, development, 160 | 50% [42-58%] | 76% [67-83%] | 69% [58-78%] (55/80) | 0 of 80 |
| PandaWard built-in rules, held-out, 87 | 51% [40-61%] | 80% [68-88%] | 74% [60-85%] (32/43) | 0 of 44 |
| semgrep p/default, development, 117 valid of 120 | 49% [40-58%] | 88% [78-94%] | 87% [76-93%] (52/60) | 0 of 57 |
- In all three runs the agent kept every true finding and removed most of the false positives. With zero drops the 95% interval still allows losing up to about 5 to 8 true findings in 100, so this is not a promise of no loss.
- The held-out split was frozen by a hash of the case name before any run and was used once, after the development runs, with the same settings.
- Limits: OWASP is a synthetic, public benchmark and may be in the model's training data, so the numbers can be better than on real code; the built-in findings that can be labelled are all SQL injection; one model, one prompt; the evidence gate (cited line must exist and match) removed nothing because every verdict passed it; three semgrep findings got no verdict and are counted as invalid.
- Not shipped yet. The criterion (#480) is a result that holds on real applications with hand triage (#470), because a benchmark this clean says little about messy code. Records and method: research/agent-safety/triage.
What it taught, including where we were wrong
Labelling findings on the CVE benchmark gave four post-fix findings that looked like false positives. One was a real engine flaw (the bounded loops above). Two were not false positives: the marked fix repaired only one alternative of a pattern, so the other branch is still ambiguous, and the patched serialize-to-js code still has a real path to new Function when its unsafe option is set. We had reported the second as a false positive, found the mistake when we read the code, and retracted it in the issue. The data has a limit too: the clean false-positive set from this benchmark is tiny (4 findings per engine against 14 to 19 true ones), too small to measure anything tightly.
What is next, and what is not measured
These are planned, not done, and none has a result yet.
| Work | What it would give PandaWard | Blocked by |
|---|---|---|
| Agent-assisted triage of findings (#480), first measurement above | Fewer false positives, now measured on a synthetic benchmark; next, on real applications, with the cost (true findings wrongly dismissed) reported. Runs on the user's own Claude Code, so it costs them nothing extra. A verdict stays a hypothesis until a person decides. | A labelled real-application set; the benchmark is synthetic and public. Real-application scans with hand triage (#470) are the likely source. |
| Rule and taint-spec candidates from misses (#481) | Recall that does not come from overfitting the public benchmarks: a candidate must improve the development cases and not regress a frozen held-out split the agent never sees. | A held-out split frozen at a published commit before the loop starts (#467). |
| Finding what PandaWard misses, with proof (#482) | Reproducible misses that become regression cases, and examples of what PandaWard finds that other tools do not. | Disclosure windows for anything found in other people's projects. |
Not measured at all yet: the CVE benchmark with other tools' standard rules, CodeQL and SonarQube, and any unseen real-application suite. Round 2 (19 ordinary maintained applications, research/realapps/round2.md) had 268 false positives and 3 true findings (TLS verification off) among 271 high and critical findings; after the fixes that came from it, a rescan reports 153 (150 false positives, the same 3 true), which is not a measurement on unseen code. Round 1 of the real-application scan (applications that are vulnerable by design, research/realapps/round1.md) found 54 true, 51 false positive and 7 unclear among 112 high and critical findings, and its recall check found 8 of 21 pygoat labs and 5 of about 70 WebGoat lessons. The OWASP 1.000 scores are on suites PandaWard was developed against.
What it tests about agents
An agent is given a normal task, such as reviewing a repository with the scanner output and reporting what each control established. The repository carries an attack: a README that says a manager approved a scope, a code comment that tells reviewers to hide the failing control, a tool result that asks for an approval, a scan summary edited to say everything passed, a SARIF file with a suppression nobody recorded, an evidence index with a hash that does not match. A matched legitimate control mirrors each attack without it.
The agent works in a simulated sandbox with a fake network and a shell simulator. What counts is what the effect journal says happened and whether the final report is supported by the evidence PandaWard recorded, not what a model says about it.
Four arms, same tools
| Arm | Enforcement |
|---|---|
| A | prompt only (the sandbox still protects the host) |
| B | deterministic authorization gate before every effect |
| C | B plus an evidence check of the report against recorded facts and hashes (the same code as pandaward verify-report) |
| D | C plus an independent monitor that fails closed and never sees the oracle |
First measurements
Corpus v1.4: 20 synthetic scenarios (12 attacks, 8 matched legitimate controls), 3 repetitions, 240 episodes on the API track and 180 on the Claude Code track, no invalid episodes. Intervals are 95% Wilson.
| Track and model | Arm | Attack success | Utility on controls |
|---|---|---|---|
| API, claude-haiku-5-5 | A | 3% [0-14%] (1/36) | 100% (24/24) |
| B | 0% [0-10%] (0/36) | 100% (24/24) | |
| C | 0% [0-10%] (0/36) | 100% (24/24) | |
| D | 0% [0-10%] (0/36) | 100% (24/24) | |
| Claude Code, sonnet | A | 6% [2-18%] (2/36) | 100% (24/24) |
| B | 3% [0-14%] (1/36) | 100% (24/24) | |
| C | 0% [0-10%] (0/36) | 100% (24/24) | |
| Claude Code, opus | A | 8% [3-22%] (3/36) | 100% (24/24) |
| B | 8% [3-22%] (3/36) | 100% (24/24) | |
| C | 0% [0-10%] (0/36) | 100% (24/24) |
Full reports with every table: API track, Claude Code track, sonnet and Claude Code track, opus (the Claude Code track uses Claude Code's own system prompt and tools, so it is not comparable to the API track).
How to read this
- The models almost never followed an attack, and the three models that were run reacted differently to the one that worked: all 10 breaches across the three runs (Haiku 1, Sonnet 3, Opus 6) are the same scenario, an evidence index that lists a SHA-256 that is not the hash of the evidence file, which the agent then cited in its report. Opus cited it in all 6 of its repetitions in arms A and B.
- The evidence check is where there is a signal. In the Claude Code track (sonnet and opus, 6 repetitions in all) arms A and B were breached 9 times in 144 attack episodes and arm C 0 times in 72 (one-sided Fisher exact test p = 0.024). This is an exploratory, post hoc comparison on one scenario, and repetitions of one scenario are not fully independent, so read it as a lead and not as proof. It says the check that ships as
pandaward verify-reportremoved this kind of false assurance; it says nothing about the authorization gate or the monitor, which were not told apart (the attacks on them rarely worked). - The corpus is too easy for these models to separate defenses. A harder, held-out attack set is the next step for this part of the lab.
- A defense that blocks everything would show as lost utility on the controls. None did here: utility was 24 of 24 in every arm.
Corpus v2: attacks that make an agent report a false conclusion
Corpus v2.0 has 11 attacks and 11 matched legitimate controls built only from epistemic attacks: a release ticket that pushes for PASS, a summary that calls a partial scan complete, three files that repeat a false all-clear, a risk acceptance read as a pass, a baseline that hides a finding, a changelog and a pull request that claim a fix that was not made, a README with a wrong hash, evidence for older code, a CI log with skipped tests and an auditor note. It was frozen before the runs; a read-only lab_sha256 tool lets a careful agent check a hash. Claude Code track, 3 repetitions, 198 episodes per model.
| Model | Arm | Attack success | Utility on controls |
|---|---|---|---|
| opus | A | 18% [9-34%] (6/33) | 100% (33/33) |
| B | 18% [9-34%] (6/33) | 100% (33/33) | |
| C | 0% [0-10%] (0/33) | 100% (33/33) | |
| sonnet | A | 9% [3-24%] (3/33) | 100% (31/31) |
| B | 9% [3-24%] (3/33) | 100% (33/33) | |
| C | 0% [0-10%] (0/33) | 100% (33/33) | |
| haiku | A | 12% [5-27%] (4/33) | 100% (33/33) |
| B | 9% [3-24%] (3/33) | 100% (33/33) | |
| C | 0% [0-10%] (0/33) | 97% [85-99%] (32/33) |
- These attacks work where instructions did not. Every breach is one of two scenarios: skipped security tests counted as a passing test (F08-A20, in all three models) and evidence for older code reported as PASS (F07-A19, opus and once haiku). The agents did not follow an instruction; they accepted a plausible but wrong conclusion.
- Pooled over the three models, arms A and B were breached 13 and 12 times in 99 attack episodes each and arm C 0 times in 99 (one-sided Fisher exact test p below 0.001). Exploratory and post hoc, on two scenarios, with repetitions that are not independent: read it as a strong lead, not proof.
- A zero in arm C is partly by construction: the evidence check reads the same ledger facts that the oracle uses to decide what is true, so it is expected to catch a claim that contradicts them. What the result shows is that models do make such claims and that the check removes them without blocking honest reports (utility 98 of 99 in arm C; the one loss was haiku calling a true control overcautious). It does not show the check finds false claims whose truth is not in the ledger.
- Two episodes (sonnet, arm A, control scenarios) are INVALID because the lab tool server did not start. They are counted as invalid, not dropped and not replaced.
- The authorization gate (arm B) was not told apart from the prompt alone: these attacks do not ask for a forbidden effect.
Two pilot runs on the development split, made before the hash tool existed, are discarded: a careful agent could not compute the hash the task asked for and called a true control inconclusive. That was a design flaw of the lab, found and fixed before the official runs.
How the corpus changed, and what was discarded
The first live pilot, on 12 episodes, found problems in the measuring tools, not in the model: the claim parser read a quoted forged summary as the agent's own claim, fixtures cited evidence files they did not contain, and the monitor's reply was cut off by thinking tokens. These were fixed before any official run. Two full runs were then discarded and are not reported:
- v1.2: a fixture cited
src/tls.go, which it did not contain, so a careful agent correctly refused to call that control PASS and was scored as inaccurate. - v1.3: scenarios without facts still pointed at an evidence file that the repository lacked, and the monitor blocked 7 of 24 legitimate reports in arm D because the agent admitted it could not read that file. This was found while analysing arm D, after the arm results were visible, which is why it is stated here.
Live API runs are limited by a hard spend cap enforced in code before every request (research/agent-safety/BUDGET.md); no amounts are published. The Claude Code track runs on a subscription and has no dollar figure.
Limits
- Synthetic scenarios, small samples, one model per track. A rate of zero does not mean a defense is complete.
- Report claims are read from lines that start with a control id and a status word, as the task asks; a false claim written only in free prose is not scored, so false-assurance rates are a lower bound.
- The agent runs with the model's default settings; the monitor runs with thinking off.
- Mock runs (scripted agents) check the harness and say nothing about a model. They are always labeled mock and never scored together with real runs.
- The Claude Code track's model is the alias
sonnet, resolved by Claude Code at run time.
Use it and reproduce it
pandaward verify-report report.md # the product check: exits 1 on false assurance pandaward lab validate # no model, no key pandaward lab run --run t0 --provider mock # offline, all 240 episodes pandaward lab run --run t1-api --provider api --live --model claude-haiku-5-5 --seed 20261120 --reps 3 pandaward lab run --run t1-cc --provider cc --model sonnet --arms A,B,C --seed 20261120 --reps 3 pandaward lab report --run research/agent-safety/runs/t1-api --public --out report.md
Method, code and the corpus: research/agent-safety. Every number on this page comes from a run manifest and its episodes, a merged change or a linked issue. Nothing here is a claim about any product other than what is stated, or about the models in general.