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.
#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
| Risk | What happens | Control |
|---|---|---|
| Prompt injection | Untrusted text instructs your LLM feature to do something harmful | Treat model output as untrusted; limit tool permissions; separate instructions from data |
| Hallucinated packages | AI suggests a dependency that doesn't exist, and attackers register it | Allow-list registries; verify every new dependency |
| Insecure generated code | AI reproduces common vulnerable patterns | SAST + human review on all AI code |
| Secret leakage | Keys pasted into prompts or committed by agents | Secret scanning, vaults, scoped tokens for agents |
| Over-privileged agents | An agent with prod access does something irreversible | Least 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
- A one-page threat model for each new service.
- SAST, dependency and secret scanning in CI, blocking on high severity.
- Mandatory review for auth, payments and data access code.
- Dependabot (or similar) with a weekly merge habit.
- 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
What AI-DLC is, how its three phases work, and how to adopt it without losing control of quality.
Write the spec first, let AI plan and build from it, and keep the spec as the source of truth.
A practical, layered defense so that faster code generation doesn't mean more production incidents.