For most of software engineering's history, security was a second thought. You built the application, shipped it to production, and then — maybe — someone from the security team ran a scan. If vulnerabilities were found, they became tickets that competed with feature work for sprint capacity. Critical findings might get fixed. Medium findings went to the backlog. Low findings went to die.
This model worked — barely — when applications were monoliths deployed quarterly to on-premise servers behind a corporate firewall. The attack surface was small. The deployment velocity was slow. The firewall was (perceived as) sufficient.
That world is gone. In 2026, applications are distributed systems of hundreds of microservices, deployed dozens of times per day, running on shared Kubernetes clusters, consuming third-party APIs, training AI models on external data, and exposed to the entire internet. The attack surface isn't a perimeter to defend — it's the entire application. Security as an afterthought doesn't just fail to protect you. It actively endangers you.
A Brief History of Security as an Afterthought
The Perimeter Era (1990s–2000s)
Security meant firewalls and antivirus. The assumption: everything inside the network is trusted, everything outside is hostile. Applications were built with zero security considerations because the network perimeter was supposed to handle it.
What broke it: SQL injection, cross-site scripting, and every other application-layer vulnerability that firewalls can't see. The 2000s were a decade of web application exploits that sailed right through perimeter defenses because the applications themselves had no security.
The Scan-and-Fix Era (2000s–2010s)
Security teams adopted vulnerability scanners. Applications were built, then scanned, then (sometimes) fixed. Penetration testing became an annual ritual. Security was still separate from development — a checkpoint at the end of the process.
What broke it: Agile and DevOps. When you deploy quarterly, a pre-release security scan is feasible. When you deploy daily, it's a bottleneck. Scan-and-fix can't keep pace with continuous delivery. And the scans only find known vulnerability patterns — novel attacks slip through.
The Shift-Left Movement (2015–2020)
"Shift left" — move security earlier in the development process. SAST tools in the IDE. Dependency scanning in CI. Container image scanning before deployment. The idea was right: find vulnerabilities where they're cheapest to fix (in development, not production).
What broke it: Shift-left without cultural change just meant developers received more alerts earlier. Alert fatigue set in. False positive rates for SAST tools ranged from 40–80%. Developers learned to ignore security alerts the way urban residents learn to ignore car alarms. The tools moved left, but the mindset didn't.
The Supply Chain Reckoning (2020–2024)
SolarWinds (2020), Codecov (2021), Log4Shell (2021), 3CX (2023), xz-utils (2024). In four years, the industry learned that your code is only a fraction of your attack surface. The libraries you depend on, the tools you build with, the CI/CD pipeline that assembles your artifacts — every link in the chain is a potential compromise point. Scanning your own code is necessary but radically insufficient.
The Regulatory Turning Point (2024–2027)
The EU's regulatory response — NIS2 (2024), DORA (2025), CRA (2027), AI Act (2026) — codified what the industry had learned the hard way. Security is no longer a best practice — it's a legal obligation. The CRA explicitly requires "security by design and by default" for products with digital elements. DORA requires financial entities to integrate security into their ICT risk management framework. NIS2 requires essential entities to manage supply chain security.
The afterthought era is legislatively over.
What "Baked In" Actually Means
Security by design is a phrase that gets used in marketing decks and ignored in architecture reviews. Here's what it means concretely:
1. Threat Modelling Before Writing Code
Before the first line of code is written for a new feature or service, the team spends 1–2 hours identifying:
- What are we building? Data flow diagram — what data enters, where it's stored, where it goes
- What can go wrong? STRIDE analysis — spoofing, tampering, repudiation, information disclosure, denial of service, elevation of privilege
- What are we going to do about it? For each threat, a specific control: input validation, encryption, authentication, rate limiting, logging
- How will we verify it works? Security acceptance criteria — testable statements that become part of the definition of done
This 1–2 hour investment eliminates security findings that would take days to fix post-development. It's the highest-ROI security activity in the entire SDLC.
2. Secure Architecture Patterns as Templates
Don't rely on developers to independently discover secure architecture. Provide patterns:
- Authentication: Here's the standard way to authenticate users in our platform (OIDC + token validation middleware). Don't build your own
- API input validation: Here's the standard validation library with OWASP-compliant rules. Import it; don't write regex
- Secret management: Here's how secrets are managed (Vault + CSI driver). Never put secrets in environment variables, config files, or source code
- Data encryption: Here's the encryption library with approved algorithms and key management. Don't choose your own cipher
- Logging: Here's the structured logging library that automatically redacts PII. Use it everywhere
Each pattern is documented, maintained, and updated by the platform/security team. Developers consume them like any other library.
3. Security Requirements in the Definition of Done
A feature isn't "done" when it works. It's done when it works securely:
- All inputs validated against schema
- Authentication and authorisation enforced on every endpoint
- Sensitive data encrypted at rest and in transit
- Structured logging with no PII in log output
- Rate limiting on public-facing endpoints
- SBOM generated and vulnerability scan passed
- Threat model updated if new data flows were added
These aren't optional extras — they're acceptance criteria. If they're not met, the story isn't complete.
4. Automated Enforcement
Humans forget. Automation doesn't:
- Pre-commit: Secret detection (gitleaks, truffleHog) prevents credentials from reaching the repository
- CI pipeline: SAST, SCA, container scanning, IaC scanning — automated, fast, blocking on critical findings
- Admission control: Kyverno/OPA policies enforce security requirements at the cluster level — no unsigned images, no privileged pods, no missing resource limits
- Runtime: Falco/Tetragon detect anomalous behaviour in production — the last line of defense when everything else was bypassed
For the Kubernetes admission control and runtime security patterns that enforce security by design at the infrastructure level, see Kubernetes Recipes.
Kubernetes Recipes
A practical guide for container orchestration and deployment by Grzegorz Stencel & Luca Berton (Apress).
Watch on Skillshare →Security by Design for AI Workloads
AI workloads introduce new dimensions to security by design that traditional application security doesn't cover:
- Training data provenance: Where did the data come from? Was it tampered with? Can you prove its lineage? Data poisoning is the AI equivalent of supply chain compromise
- Model integrity: Can you verify that the model in production is the model you trained? Model signing and attestation — the AI equivalent of image signing
- Prompt injection: LLM-powered features need input sanitisation that goes beyond traditional input validation. Prompt injection is a new attack category that didn't exist 3 years ago
- Output filtering: AI models can produce harmful, biased, or data-leaking outputs. Output filters are a security control, not just an ethics feature
- Inference isolation: Multi-tenant inference serving requires isolation guarantees — one tenant's prompts must not leak to another's responses
The EU AI Act makes these concerns regulatory requirements for high-risk AI systems. Security by design for AI isn't optional — it's the law.
The Cultural Shift
Technology alone doesn't make security a first-class citizen. Culture does:
- Security is everyone's job: Not a department, not a gate, not a review board. Every developer, every product manager, every architect considers security as naturally as they consider performance or reliability
- Security metrics on dashboards: If your team tracks deployment frequency and error rates but not vulnerability counts and MTTR for security findings, security isn't a first-class concern
- Security in hiring: Ask security questions in technical interviews. Not penetration testing trivia — practical questions about how candidates handle input validation, authentication, and secret management in their code
- Security in incentives: If the bonus structure rewards shipping features but doesn't penalise shipping vulnerabilities, you've told your team what you actually value
Root Cause Analysis: Principles and Benefits
Master root cause analysis techniques for systematic problem solving. In collaboration with Starweaver.
Start on Coursera →What Open Empower Delivers
We help enterprises transition from security-as-afterthought to security-by-design:
- Threat modelling workshops: Train your teams to threat-model new features in 1–2 hours, with templates and facilitation
- Secure architecture patterns: Authentication, encryption, secret management, logging — pre-built, documented, maintained patterns for your platform
- Automated security pipeline: SAST, SCA, container scanning, admission control — integrated into your CI/CD in under 60 seconds per build
- AI security assessment: Data provenance, model integrity, prompt injection defenses, output filtering — security by design for AI workloads
- Cultural transformation: Security champions programme, blameless post-mortem facilitation, developer security training
- Regulatory alignment: CRA "security by design" requirements, DORA ICT risk management, NIS2 supply chain security — mapped to your architecture
Security was never optional — we just pretended it was. The regulations caught up. The threats caught up. It's time your architecture caught up too. Let's design it right from the start.
Luca Berton
