Secure SDL: building security into every phase

The Security Development Lifecycle in plain language, plus the new threats that come with AI-generated code and LLM features.

Key takeaways

  • Secure SDL adds one security activity to each lifecycle phase.
  • The earlier you find a flaw, the cheaper it is to fix.
  • AI adds new risks, such as prompt injection, hallucinated packages and leaked secrets, that need explicit controls.

A Security Development Lifecycle (SDL), popularized by Microsoft in the 2000s, is simple: for every phase of the SDLC, add one security habit. It's how you avoid bolting security on at the end, which is the most expensive place to add it.

RequirementsSecurity reqsDesignThreat modelBuildSAST · depsVerifyDAST · pentestReleaseSign · SBOMRespondIncident planFix early: cheapFix in production: up to 100x the costShift left: security in every phase
Shift left: a security activity in every phase.

#The activities, phase by phase

#Requirements: define security needs

Write down what must be protected and from whom. Example: "Customer PII is encrypted at rest; only the billing service can read card tokens."

#Design: threat model

Draw the data flows and ask STRIDE questions: can someone Spoof, Tamper, Repudiate, leak Information, Deny service or Elevate privileges? An hour of threat modeling often saves weeks.

#Build: secure coding and scanning

  • Static analysis (SAST) in CI.
  • Dependency scanning (SCA) for known vulnerabilities.
  • Secret scanning on every commit.

#Verify: test like an attacker

Dynamic scans (DAST), fuzzing, and periodic penetration tests for important systems.

#Release: sign and document

Signed artifacts, a software bill of materials (SBOM) and a final security review for high-risk changes.

#Respond: be ready for incidents

An incident response plan, a security contact, and a habit of turning every incident into a fix and a lesson.

#New risks in the AI era

RiskWhat happensControl
Prompt injectionUntrusted text instructs your LLM feature to do something harmfulTreat model output as untrusted; limit tool permissions; separate instructions from data
Hallucinated packagesAI suggests a dependency that doesn't exist, and attackers register itAllow-list registries; verify every new dependency
Insecure generated codeAI reproduces common vulnerable patternsSAST + human review on all AI code
Secret leakageKeys pasted into prompts or committed by agentsSecret scanning, vaults, scoped tokens for agents
Over-privileged agentsAn agent with prod access does something irreversibleLeast privilege, approval steps, sandboxes

Warning: An AI agent with write access to production and no approval step is a security incident waiting to happen.

#A minimum viable SDL for small teams

  1. A one-page threat model for each new service.
  2. SAST, dependency and secret scanning in CI, blocking on high severity.
  3. Mandatory review for auth, payments and data access code.
  4. Dependabot (or similar) with a weekly merge habit.
  5. A written "what we do when we're breached" page.

It's not perfect security. It's consistent security, which beats perfect security that nobody does.

Keep reading

AI-era lifecycle

AI-DLC: the AI-Driven Development Lifecycle

What AI-DLC is, how its three phases work, and how to adopt it without losing control of quality.

AI-era lifecycle

Spec-driven development with AI agents

Write the spec first, let AI plan and build from it, and keep the spec as the source of truth.

AI-era lifecycle

Quality gates for AI-generated code

A practical, layered defense so that faster code generation doesn't mean more production incidents.