A working framework for AI code security, reasoning about where AI coding agents get security right by default, where they need a nudge and where gaps remain.
The conversation about AI code security and AI-generated code has, so far, been organized around a simplistic set of assumptions. Either AI-generated code is highly risky, in which case it needs aggressive review, or it is safe enough, in which case the current development workflow already handles it. Both framings are too coarse to drive useful insights.
A year of running coding agents against real and synthetic vulnerability prompts has shown us that the issues come in at least three structurally different tiers. Each tier has a different relationship to review, a different cost of remediation, and a different failure mode when controls are mismatched. This working framework is useful enough that AppSec teams can use it today to decide where their controls should sit and to understand why some interventions work while others do not.
The rest of this post walks through each tier with examples, explains why each behaves the way it does, and lays out what AppSec teams should do with the model.
Tier 1 is the good news of AI coding. There are security primitives that stock coding agents apply by default, with no special prompting, no adversarial review and no codebase signal that the agent is being judged on safety. It’s the equivalent of a well-trained junior developer who knows the basics of secure application development cold.
Concrete examples we observed consistently include:
These best practices are implemented reliably by the coding agents we have observed. They show up regardless of whether the spec mentions security at all, or whether the codebase already uses other safe primitives, and they show up in the first round, before any reviewer has weighed in.
Why this works is straightforward. These primitives are densely associated with their domain in the training data. When the agent is asked to hash a password, the canonical pattern is bcrypt. When it is asked to generate a token, the canonical pattern is crypto.randomBytes. The agent has, in effect, memorized "if you are doing X, you do it with Y," and Y happens to be the safe choice. The pattern strength is high enough that the agent does not deviate even when the prompt is sloppy.
The implication for AppSec teams is that the Tier 1 surface is mostly well addressed by modern AI coding agents and brings little risk to production environments. It’s worth performing inexpensive spot-checking to uncover any outliers, but it’s not worth investing significant review budget to hunt for vulnerabilities that aren’t there.
Tier 2 is where most of the interesting work in AI code security currently lives. These are issues the agent has the knowledge to handle, but does not handle by default. In these cases, a single hint in the prompt is generally enough to activate the full mitigation. Adversarial review surfaces and corrects the gap reliably.
A number of Tier 2 findings appear consistently in our research, each with a recognizable failure mode when the coding agent is asked to implement a related feature:
Other commonly observed Tier 2 findings include server-side template injection, XML external entity attacks, broken authorization, mass assignment and CSV formula injection.
Each of these also has a recognizable fix mode. Add a single sentence to the prompt, "validate the URL," and the agent produces a layered SSRF defense. Add "validate the path," and the agent produces a path-traversal check that resolves the path against an allowed base and rejects anything outside it. Add "deserialize safely," and the agent produces JSON parsing or a typed schema. The knowledge was always there. It was dormant, waiting for activation.
Adversarial review reliably activates Tier 2 knowledge. In our research, one round of review against a Tier 2 vulnerability produces a comprehensive mitigation in the vast majority of cases. Two rounds are enough to handle the edge cases. This is the area where multi-round review pays off most clearly. The reviewer is not surfacing techniques or insights the agent does not know. The reviewer is prompting the agent to apply knowledge it already has.
The implication for AppSec teams is that Tier 2 is the right home for adversarial-review investment. Configure a panel of reviewers focused on the classes above, run them against agent-generated code, and most Tier 2 issues will be caught and fixed. This comes with a real cost; additional review rounds use time and tokens, but the return is high. Out of the broad center of AI-generated vulnerability patterns, Tier 2 is the most addressable.
Tier 3 is where the model gets interesting and where most of the unsolved AppSec work lives. Tier 3 issues are ones the agent and its reviewers do not handle by default, even after extensive adversarial review, because the fix requires specific factual knowledge that the reviewer simply doesn’t have.
Tier 3 splits into two sub-tiers, which are worth distinguishing because the controls for each are different.
The fix for these requires reasoning about the system as a whole, not memorizing a single fact. Tier 3a issues are tractable for adversarial reviewers, because the reviewer can often spot the flaw by working through the code, but in our observations they are not surfaced reliably without a review that specifically targets business logic. They require a reviewer to be prompted to ask what invariants this code violates when called in unexpected ways.
Tier 3b is where multi-round review fails most clearly. The reviewer does not have the facts it needs to generate the findings. No amount of adversarial pressure across rounds will produce knowledge the reviewer never held to begin with. Multi-round review converges on the boundary of what the reviewer already knows, and Tier 3b issues sit, by definition, outside that boundary.
The control surface for Tier 3 is fundamentally different from Tier 2. Tier 3a requires reasoning-focused review, often by a reviewer prompted specifically on business-logic invariants rather than vulnerability classes. Tier 3b requires external knowledge injection. The reviewer needs access to current threat intelligence, current CVE feeds, vendor documentation, or cloud-provider quirks, depending on the specific factual gap.
Neither of these controls is automatic in most AI code review pipelines today. AppSec teams that are running Tier 1 and Tier 2 controls without a Tier 3 layer have a hole in their pipeline that the pipeline itself cannot detect.
A team that invests heavily in adversarial review on Tier 1 is wasting budget. The agent gets Tier 1 right without help. The review rounds look for issues that aren't there, find nothing useful, and consume significant time and tokens.
A team that skips specific hints to address Tier 2 issues is leaving easy mitigations on the table. The hint approach works best when the prompt is under the AppSec team's control, as they have the most experience with where security controls can fail and the best practices for addressing the gaps. Adversarial review is the right control for Tier 2.
A team that runs five rounds of adversarial review and certifies the result as "secure" without external knowledge augmentation is almost certainly shipping Tier 3 issues. The pipeline's own framing of its work is misleading. The convergence point is not safety. It is the reviewers' working memory.
The right shape of an AI code security program is layered. Tier 1 accepts the agent's defaults and spot-checks to find outliers. Tier 2 introduces adversarial review with reviewers focused on specific vulnerability classes. Tier 3a brings business-logic-focused reviewers operating on the system as a whole. And finally, Tier 3b brings knowledge augmentation through threat-intel feeds, CVE databases, cloud documentation and current standards references.
Each layer requires a different investment, a different review prompt, and a different evaluation approach. Bundling them under "we run AI code review" obscures whether the pipeline is actually addressing the issues the team is paying it to address.
For an AppSec leader picking up this framework, here is a short list of starting moves:
A three-tier model gives AppSec teams a vocabulary to ask the right questions about an AI code review pipeline. Which tier is this control addressing? Is the control the right shape for the tier? What is the pipeline silently missing? The questions are simple, but the answers are not always comfortable.
We have used this framework internally to make decisions about where to invest in our own research, and it has held up. It is not finished, but we think it is the right shape for the conversation the AI code security community needs to have over the next year.
Key takeaways
Shane Schisler is a Distinguished Engineer at Contrast Security, where he studies how LLM coding agents interact with security tooling and how they introduce or suppress vulnerabilities in the code they produce.
Get the latest content from Contrast directly to your mailbox. By subscribing, you will stay up to date with all the latest and greatest from Contrast.