Home/Journal/Opinion
OpinionAI SecurityDevSecOpsPractical Checklist

Secure AI Development Lifecycle: A Practical Checklist

98.9% of public Claude Code configs had no deny rules. Here is the 5-stage security lifecycle for AI-assisted dev teams - from Spec to Runtime - with specific tools at each gate.

Greywatch··9 min read

98.9% of public Claude Code configs scanned across 18,470 repositories had no deny rules configured. That is not a configuration quirk. It is a precise description of where most AI-assisted development sits today: agents generating production code with no explicit guardrails on what they could touch. Security in an AI-assisted pipeline does not live in the model. It lives in your process: the gates, the constraints, and the automated checks you build around the model.

The 5-stage AI development pipeline

Specauth model, abuse casesOWASP in AGENTS.mdGeneratedeny rules, sandboxai-generated tagsMerge GateSemgrep, gitleaksSocket, authz tests▲ Start hereDeployIAM least-priv, egressallowlist, IMDSv2RuntimeZAP/Nuclei, AI monitorcanary tokensThe Merge Gate is where most teams should start. Highest-leverage gate for AI-generated vulnerabilities.Spec → Generate → [ Merge Gate ] → Deploy → Runtime
The Merge Gate is where most teams should start. It is the highest-leverage gate for catching AI-generated vulnerabilities before they reach production.

Is AI-generated code actually less secure?

Yes. The current evidence is not ambiguous. AI-generated code passes security review at roughly 50% the rate of human-written code for equivalent functionality, against a human baseline of approximately 95% functional correctness (Veracode 2025). The model is optimising for correctness and coherence - not for the absence of exploitable conditions.

Two data points sharpen the picture. AI coding agents select insecure implementation paths 45% of the time when a secure and an insecure option are both plausible given the context. And a 19.7% hallucinated package rate - packages named but never published - creates a direct supply chain attack vector. A malicious actor registers the hallucinated name, publishes a payload, and the agent installs it. This was documented as "slopsquatting" at USENIX Security 2025.

⚠  FACT-CHECK FLAG (internal - remove before publishing)

The stats in this post (98.9% / 50% / 45% / 19.7%) need source verification before publishing. Tag Rahul to confirm sources. Do not publish until verified.

Stage 1: Spec - security starts before the first token

The agent writes what you describe. If the description is silent on security, so is the output. Three things to do at the Spec stage:

Stage 2: Generate - constrain the agent before it runs

The generation phase is where most AI security advice currently lives, and most of it is still not implemented. Three controls:

Stage 3: Merge Gate - where to start if you are starting today

The Merge Gate is the highest-leverage intervention point in the pipeline. Code has been generated but not yet deployed. Four controls to implement, in order:

SAST that blocks
Semgrep with a curated ruleset, CodeQL on critical findings. The key word is blocks. A SAST tool that advises but does not fail the merge is noise. Configure it to block the merge on any critical or high finding. Advisory-only is not a gate - it is a suggestion box.
Secrets scanning
gitleaks on every commit, installed as a pre-commit hook. AI agents write secrets into code at elevated rates because they pattern-match from training data. The hook runs before the commit lands in history - once a secret is in the git log, you have a rotation problem, not just a leak.
Dependency vetting
Socket, not npm audit. npm audit checks known CVEs. Socket checks whether a package is malicious today - install scripts, dependency confusion candidates, and slopsquatted names that agents hallucinate. This is the tooling gap that the 19.7% hallucination rate makes critical.
Authorization testing
User A cannot read User B's data. This test must exist explicitly in your suite, and it must run at the gate. It does not need to be comprehensive - it needs to exist and fail the merge if it fails. Static tooling cannot reason about authorization chains. A human wrote this test. That matters.

Stage 4: Deploy - least privilege before it goes live

What reaches the deploy stage has cleared the code-level gates. The deploy stage is about constraining what the running service can do, and how it was authorized to do it:

Stage 5: Runtime - continuous red team, not annual pentest

The first four stages are pre-production controls. Runtime is where you find what they missed.

IDOR is where static tooling consistently underperforms. A SAST rule can flag an obvious missing authorization check, but it cannot reason about whether a chain of individually correct-looking calls adds up to an authorization bypass. The attacker does not need a single broken line - they need a sequence that the tool never evaluates as a unit. Runtime testing with an adversarial agent evaluates the sequence. That is the gap the first four stages leave open, and why Runtime is not optional.

Where should I start?

Start at Stage 3: the Merge Gate. It requires no change to how your team writes code, no change to your deploy process, and no runtime access. It sits between generation and production and catches the majority of AI-generated vulnerabilities before they matter. Add Semgrep, gitleaks, and Socket this week. Add the authorization test this sprint. Then build outward from there.

Below is the full checklist, stage by stage. Use it as an internal audit.

Stage 1: Spec3 items
Stage 2: Generate3 items
Stage 3: Merge Gate — Start here5 items
Stage 4: Deploy5 items
Stage 5: Runtime4 items

Frequently asked

Is AI-generated code less secure than human-written code?
Yes, on current evidence. AI-generated code passes security review at roughly half the rate of human-written code for equivalent functionality. The model optimises for correctness and coherence, not for the absence of exploitable conditions. IDOR, broken auth, and SSRF appear at elevated rates in AI-generated codebases because those vulnerability patterns are well-represented in training data.
Where should I start with AI code security?
Start at Stage 3: the Merge Gate. It is the highest-leverage intervention point because it sits between code generation and production. Adding Semgrep with a blocking ruleset, gitleaks on pre-commit, and Socket for dependency vetting will catch the majority of AI-generated vulnerabilities before they ship. Layer the other stages around it as your process matures.
What tools do I actually need?
For the Merge Gate: Semgrep (SAST, must block on critical findings), gitleaks (secrets scanning on every commit), Socket (dependency vetting - catches slopsquatted packages that npm audit misses), and explicit authorization tests in your suite. For Runtime: OWASP ZAP or Nuclei for continuous scanning, and canary tokens from canarytokens.org to detect active exploitation.
Can automated tools catch everything?
No. IDOR and broken object-level authorization are the clearest examples. A SAST tool can flag obvious missing authorization checks but cannot reason about whether a chain of individually correct-looking calls adds up to a bypass. That gap is where runtime testing and human adversarial judgment are irreplaceable.
What does Greywatch do in this lifecycle?
Greywatch runs AI agents continuously against your production environment - the Runtime layer - with a security engineer validating every finding before it reaches you. We catch what the pipeline misses: IDOR, broken auth chains, and agentic attack surfaces that static tools cannot reason about. Every finding ships with the exact exploit that worked, reproduction steps, and a recommended fix.

The pipeline above describes what good looks like. Greywatch runs the Runtime layer for you - continuous, proven, with a human behind every finding.

Talk to the founder →