R473 · AI-built software and its verification › Security scanning for AI-written code

Constraints in code, not in prompts: a reference pipeline for autonomous vulnerability finding and patching

Read the original

security-scanningagent-sandboxingtest-oraclespatchingopen-source

On a vendor's open reference implementation for autonomous vulnerability discovery and remediation, published as an Apache-licensed repository with nine documentation pages. The repository states plainly that it "is not maintained and is not accepting contributions", and that the harness "is a reference, not a product" which "will not work on every codebase out of the box".

Why this is worth reading even if you never run it

Two things in it are durable regardless of the code. The first is a stage decomposition where every boundary exists to defeat a specific failure of agent self-assessment. The second is a single sentence that is the clearest statement of agent containment policy in any vendor documentation so far:

"models will use whatever capabilities they actually have access to, not necessarily just what you tell them they have. For that reason, constraints must be enforced in code, not in prompts."

The preceding paragraph explains why this is not a safety platitude but a design consequence: "Frontier models are increasingly good at finding creative paths around restrictions. This is what makes them effective vulnerability hunters. However, it also makes them capable of taking unexpected actions against their own execution environments." The property that makes the agent useful is the property that makes it dangerous to its own harness. You cannot prompt your way out of that.

The pipeline, and what each boundary is defending against

The preventive track runs recon, find, grade, judge, report, patch, against C/C++ memory bugs with Docker and a sanitizer-instrumented build.

StageWhat it doesThe failure it is built against
Buildone sanitizer-instrumented image, reused by find, grade and re-attackagents disagreeing because they saw different environments
Reconan agent partitions the attack surface so parallel runs start in different placesevery parallel run converging on the same shallow bug
Findone agent per run, isolated container; iterates until an input "crashes 3 out of 3 times"; emits the crashing input, not a reportprose that describes a bug nobody can reproduce
Gradea second agent, fresh container, re-runs the proof-of-conceptthe finder grading its own work
Judgea short no-tools agent rules new / cleaner-example / duplicate, seriallytwo copies of one bug arriving together and both being accepted
Reportwrites exploitability analysis from the input and source only; a separate grader scores it and the score ships with itplausible prose standing in for evidence
Patchfour-tier executable verification laddera fix that stops this input and nothing else

Three of those deserve emphasis.

Find emits bytes, not words. The artifact that leaves the find stage is the crashing input file. Everything downstream re-derives its own conclusions from that input. An agent cannot talk its finding past the next stage.

Grade is isolated from the finder's reasoning, deliberately. The documentation is explicit about the channel width: "[t]he only thing that crosses from the find container to the grader is the PoC bytes, so the grader isn't influenced by the find agent's reasoning." This is the structural answer to a problem measured elsewhere in the literature — that a model asked to assess work it or a peer produced is a poor judge of it. Here the judge is given no reasoning to be persuaded by.

Deduplication is a serial stage for a concurrency reason, not a quality reason. Parallel find agents also share an append-only findings log and "must justify why their addition is not a duplicate of something already listed before adding to it" — so there are two deduplication mechanisms, one cooperative and one authoritative.

One detail shows how carefully the egress boundary is held: an optional flag has the orchestrator clone the upstream repository and inject its commit log into the report prompt so the report can state whether a bug is already fixed upstream. "Only the orchestrator touches GitHub — the report container's egress stays restricted to the model API", and the flag is off by default so that air-gapped users are unaffected.

The patch verification ladder

Four checks in order, stopping at the first failure, each described as an "executable oracle" — it runs something and decides from the result:

  1. Build — does the patched tree compile.

  2. Reproduce — is the original crash gone.

  3. Regress — does the project's existing test suite still pass.

  4. Re-attack — a fresh 50-turn find agent attacks the patched binary; the sanitizer decides.

A fifth check, a style score from a model judge, is "advisory only, never gates" — a small but correct decision, keeping the one subjective signal out of the pass condition. On failure the concrete evidence (compiler error, sanitizer trace) is fed into the next attempt's prompt and the loop runs again.

The mechanics of re-attack are neat: the patch exists only inside the grader's container, so the grader snapshots that container as a temporary image and launches the attacking agent from the snapshot.

The number that justifies the whole stage, quoted from the documentation: "Published evals of model-generated security patches show ~60% succeed on build-and-reproduce checks, but <15% survive fuzzing and differential testing. The dominant failure mode is a bounds check at the crash site that leaves the bad value reachable from a slightly different input."

That is the most important sentence for anyone running a patching agent. The gap between 60% and 15% is the gap between "the crash stopped" and "the bug is gone", and a verification ladder without an adversarial tier sits on the wrong side of it.

What the documentation admits the ladder does not prove

Unusually, the limits are stated as plainly as the design:

The honesty has a consequence worth naming: the ladder's discriminating power is a tunable constant, the re-attack turn budget. Two teams running the same harness with different budgets hold different definitions of "fixed".

The containment architecture

SurfaceUnsandboxedSandboxed
Agent file reads and writeshost filesystemcontainer filesystem only
Agent shellhost shellcontainer shell on a user-space kernel
Network egresswhatever the host hasan allowlist, by default the model API only

The enforcement split is stated precisely, which matters because it is the part people get wrong: the user-space kernel "provides the syscall and filesystem boundary", while egress policy is enforced by an internal Docker bridge with no default route out, plus an allowlist proxy — "the netstack carries the traffic but the proxy decides what gets through." Two independent mechanisms, two independent properties.

The trust boundary is drawn around determinism rather than around code ownership: the orchestration process "is trusted and never runs target code or model-chosen commands", so it runs outside the sandbox; the agents are separate processes inside it. Proof-of-concept files are extracted by executing a command inside the container, because the host-side copy mechanism cannot reach the sandbox's filesystem.

The operational rules are tiered by capability, not applied uniformly: read-and-write-only interactive skills need no sandbox; anything that executes target code refuses to start outside one unless an explicitly dangerous flag is passed. "Match the level of isolation to the task." The explicit prohibitions are the useful part — no ordinary container runtime for autonomous agents, because "a kernel bug triggered by the target inside the container can compromise your host"; no privileged or host-network containers; never mount credential paths; and do not connect agents to tools that can write to the outside world.

Field practices worth lifting

Where to be sceptical

  1. The load-bearing number is uncited. The 60%-versus-15% figure justifies the adversarial tier and carries no citation. It is the first thing to verify independently.

  2. No end-to-end results are published. No bugs-found-per-target table, no pipeline true or false positive rate, no cost per finding, no comparison against a fuzzer on the same targets. Defensible for a reference implementation; it is still the gap for anyone deciding whether to build on it.

  3. The one quantified field result is self-measured. A claimed "near-100% true-positive rate" from feeding live traffic logs alongside source is labelled as the team's own measure, with no base rate and no sample size. It is the most quotable line in the material and the least checkable.

  4. "Not maintained" is load-bearing. A frozen security pipeline will drift against the sanitizers, runtimes and model behaviour it depends on. The architecture is the contribution; the code is a snapshot.

Review checklist for an autonomous finding-and-patching pipeline

  1. Does the finding stage emit a reproducible artifact, or prose?

  2. Does anything other than that artifact cross from finder to verifier?

  3. Is the verifier a fresh process with no access to the finder's reasoning?

  4. Is there an adversarial tier that attacks the patched build, and what is its budget?

  5. Is any subjective score allowed to gate, or only to advise?

  6. Is every constraint enforced by the runtime, or does any of it live in a prompt?

  7. Are the syscall boundary and the egress boundary enforced by separate mechanisms?

  8. Does the process that holds credentials ever execute model-chosen commands?

  9. On a disappointing first pass, does the response add agents or re-partition the surface?

  10. Is each confirmed finding converted into a deterministic check, and is that check's blind spot written down?

Connections

See R473 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.