Coding Workflows Workflow Intermediate

AI Security Review Workflow

Review code for what an attacker would do, not just what tests catch — anchor the model as a security engineer, run a threat-focused review, then back the findings with auth and input tests.

The problem

A normal review optimizes for correctness and readability, and a security bug sails right through it because nobody was looking for one. Security review is a different lens: you assume an attacker, you go looking for the input that isn't validated and the auth check that isn't there, and you treat 'it works' as beside the point. Doing that with AI means first putting the model in a security mindset instead of a general-helper one, reviewing against the failure classes that actually cause breaches, and proving the risky paths with tests rather than trusting a clean read.

Recommended workflow

Each step uses an existing NewPrompt tool, pre-filled by a matching resource. Open the resource to read it, or jump straight into the tool with the inputs ready.

  1. Put the model in a security mindset

    A general assistant reviews for bugs; a security engineer reviews for attackers. Anchor the model in that role first, so the review ranks threats by likelihood and impact instead of listing style nits.

    Outcome The model reviewing as a security engineer, not a generalist.
  2. Review for the threats that cause breaches

    Run the review against the real failure classes — injection, broken auth, unvalidated input, leaked secrets, unsafe deserialization — and rank findings by exploitability, not by how easy they are to spot.

    Outcome Risk-ranked security findings, each with an attack path.
  3. Prove the risky paths with tests

    For the auth and input paths the review flagged, write tests that try to break them — wrong credentials, missing tokens, malformed input — so a fix is provable and a regression gets caught.

    Outcome Tests that exercise the attack paths, not just the happy one.

Expected outcome

A review that surfaces the vulnerabilities a correctness pass misses, ranked by exploitability, with tests guarding the auth and input paths — so the risky change is defensible, not just 'looks fine'.

Best for

  • Reviewing auth, input handling, or anything internet-facing
  • A security pass before a release or audit
  • Reviewing changes that touch sensitive data

Not for

  • A routine correctness review — use the AI Code Review Workflow
  • Designing security architecture from scratch — this reviews existing code

FAQ

AI security review workflow vs AI code review workflow: what's the difference?

The code review workflow optimizes for correctness, maintainability, and tests; security is one focus among several. This is a dedicated security pass: it anchors a security-engineer mindset, reviews against breach failure classes, and writes tests for the attack paths. Different lens, different output.

What does the AI security review workflow produce?

Security findings ranked by exploitability, each with an attack path, plus tests exercising the flagged auth and input paths. It's a review artifact you act on, not certified-secure code — NewPrompt supplies the prompts and step order; you run them in your AI tool and own the security judgment.

How do I run the AI security review workflow?

Work the three steps in order: use the role-prompt generator to anchor the model as a security engineer, run the security code review prompt against threat classes, then write auth and input tests from the flagged paths. You run each prompt in your own AI tool.

What do I need before starting the AI security review workflow?

The specific code you're reviewing — ideally the diff or module touching auth, input handling, or anything internet-facing — plus enough context on how it's called. The review ranks by exploitability, so pointing it at the risky surface matters more than pasting the whole codebase.

Do I still need a normal review?

Usually yes. This catches security issues a correctness review misses; it doesn't replace the broader review for logic and maintainability. Run both on changes where security matters.

Does it find every vulnerability?

No tool does. It puts the model in the right mindset and points it at the failure classes that actually cause breaches, which catches far more than a generic review — but security review assists human judgment; it doesn't replace a real audit for high-stakes systems.

Part of these projects

Complete build journeys that include this workflow as a stage.

Guides for this workflow

Recommended next workflow

Tip: Each step's resource opens its tool pre-filled — start at step one and carry the output forward.