Back to Coding

How Do You Use AI for a Security Review?

How Do You Use AI for a Security Review?
AI Tutorials Team 13 March 2026

Security review is a strong use of these tools and a dangerous one to over-trust. They reliably catch the well-documented vulnerability classes, which is genuinely valuable, and a clean result tells you almost nothing about whether the system is secure.

What does it catch reliably?

  • Injection. User input concatenated into a query or a command.
  • Hard-coded secrets. Keys, passwords and tokens in the source.
  • Unsafe deserialisation. Untrusted data reconstructed into objects.
  • Path traversal. User input used to build a file path.
  • Weak cryptography. Outdated algorithms and poor random values.
  • Missing output encoding. Data rendered without escaping.

All of these are local, well documented and heavily represented in training data, which is exactly the profile that suits pattern recognition.

What does it miss?

Authorisation logic, which is where most real breaches live. Whether this user should be allowed to see this record is a question about your business rules, and a model reading the code cannot know that the check is wrong or absent.

Missing checks in general are the blind spot: review reads what is present, and the vulnerability is frequently the absence of something.

What else is invisible?

Anything that depends on how the system is deployed and configured, on how components interact, or on assumptions made in one place and violated in another. A perfectly written function can be reachable by somebody who should not reach it, and the code shows nothing.

What is the prompt?

Review this for security. First check the standard vulnerability classes and report anything found with the line and the attack it enables. Then, separately, tell me what security-relevant checks you would expect to see here that are absent, given that this code handles [what it handles] and is reachable by [who]. Say explicitly what you cannot assess from this code alone.

Why ask for what is absent?

Because it partially addresses the blind spot. A model asked what checks it would expect will name authentication, authorisation, rate limiting and validation, and their absence from the code becomes a question rather than an invisible gap.

It produces false positives and it surfaces real omissions that a defect-hunting review never mentions.

Should it replace scanning tools?

No, and it complements them. Established scanners have curated rules, low false positive rates for known patterns and no capacity to reason about intent. The combination covers more than either.

What about dependencies?

A separate check with a proper tool. Whether a library has a known vulnerability is a database lookup against current advisories, and asking a model is asking about its training data, which is out of date by definition.

Who should still look at it?

Somebody who knows the system, for anything handling money, personal data, credentials or access control. The automated pass removes the mechanical vulnerabilities so that human attention goes to the design questions, which is where it is actually needed.

What about code that handles authentication?

The area where a clean automated result is least meaningful. Authentication code is usually short, looks conventional and fails through subtle mistakes: a comparison that leaks timing, a token that is validated for signature but not expiry, a session that is not invalidated on logout.

Some of those are catchable if you name them, which is an argument for a specific prompt rather than a general one. The broader point is that this is the category where using an established library rather than writing it yourself is nearly always correct, and a review comment suggesting exactly that is more valuable than any list of findings about the hand-rolled version.

What is the sentence worth remembering?

A clean security review means no known pattern was found. It is not a statement about whether the system can be attacked, and treating it as one is how organisations end up confident about something nobody assessed.