SAST (static application security testing) is a way to scan source code for known classes of vulnerability without running the program. The tool reads the code, matches it against rules, and reports where a pattern looks unsafe. When an agent wrote the change, SAST is still worth running, and it is still not enough. It says whether known bad patterns are present. It does not say whether the delivered behavior is the one that was requested. The sections below cover what SAST sees, what changes with agent-written code, where to place it in the checks of a task, and what to show a security reviewer.
What does a SAST tool look at, and what does it miss?
A SAST tool reads source code, or a representation of it, and flags patterns that match known classes of weakness: injection, unsafe deserialization, hard-coded secrets, weak cryptographic calls. It is fast, repeatable and needs no running system, which makes it a good deterministic check inside a pipeline. It cannot tell whether the code does what the person asked for, and it only sees what its rules describe. Code written by an agent changes little about how the scanner works, but it changes what you should expect: more changes, an author who cannot be questioned afterwards, and code that is often plausible rather than correct. So SAST belongs in the verify command of each task, with the result stored, while the question of intent stays with a named person who signs the delivery. A clean scan is evidence that known patterns are absent, not that the right behavior is present.
| Question | Can SAST answer it? | | --- | --- | | Is there a string built into a query from user input? | Yes, if a rule covers the language and framework | | Is a secret committed in the source? | Yes, usually with a dedicated rule set | | Does the endpoint apply the permission the client asked for? | No, it needs the intent | | Was the change inside the approved scope? | No, it needs the plan | | Is the new dependency the one that was meant? | Only partly, composition analysis does this |
Where does agent-written code change the findings?
It changes volume, shape and accountability, not the scanner. A few effects show up in practice:
- Volume: an agent produces more diffs per day than a person reviews carefully, so the scan becomes the first filter and not the last.
- Plausible but wrong: generated code often looks idiomatic. Rules that match obvious patterns pass it, while a wrong permission check or a missing ownership test does not match any rule.
- Copied patterns: an agent can reproduce a weak idiom it has seen many times, and the scanner will flag it again and again. Noise is a real cost, and a team that mutes the rule loses the signal.
- No memory of the decision: after the session closes, nobody can ask why a finding was suppressed. The suppression has to be written down with its reason.
For the review side of the same problem, see secure code review when the author is an agent.
How do you put a SAST gate inside the task verify?
Make the scan a command that the system runs, not a step the agent reports. Each task in the plan carries a verify command, and the scan is part of it. The practical rules are short:
- The scan runs outside the process that wrote the code, on the committed state, not on the agent's working copy.
- The gate has a threshold decided in advance: which severities block, which are listed for the reviewer.
- A suppression is a change that goes through the same review as code, with a stated reason.
- The command, the tool version, the rule set and the result are stored with the task.
- A failing scan sends the task back to correction. It is not waived by the agent that wrote it.
This is the same idea as in secure SDLC with agents in the loop: checks are deterministic and owned by the system, and the person signs on evidence instead of on a summary.
What can a scan not say about intent?
It cannot say that the change is the change that was wanted. Consider a request such as "let a manager see only the invoices of their own team". A scan can confirm there is no injection in the query. It cannot confirm that the filter by team exists, that it is applied on every route, or that an export endpoint did not bypass it. Those are behaviors, and they are proven by tests written from the request and by a person who reads what was delivered.
The practical split is simple. SAST covers known patterns at scale. Behavior tests cover what was requested. Dependency checks cover what was added. A named person covers whether the whole matches the intent, and signs. A team that treats a green scan as the last word has moved the risk, not removed it.
What should you show the security reviewer?
A reviewer who inherits agent-written changes needs a short record, not a transcript. Give them:
- the request as written and who approved the plan;
- the scope allowed against the files actually touched;
- the scan: tool, version, rule set, threshold, result and every suppression with its reason;
- the tests that prove the requested behavior, with their results;
- the dependencies added and by whom they were accepted;
- the signature of the person who approved the delivery, tied to the commit that was checked.
That record is what a later audit will ask for. It is developed in software audit trail when an agent made the change. Detent, the end-to-end delivery system (detent-ai.com), keeps the scan inside the verify of each task and puts the signature on the plan and on the delivery. For the wider context see AI software development.
