SECURITY ENGINEERING · PART 8 · WRITING SECURE CODE · PROCESS · 106 OF 229

Secure SDLC Explained: Shift Left in Practice

Security is cheapest when it is built in, not bolted on. This episode explains the secure software development lifecycle: what happens in each phase from requirements to operations, what "shift left" really means, why a bug caught in design costs a fraction of one caught in production, the activities a security engineer adds at each stage, and the maturity models (OWASP SAMM, BSIMM) that measure a programme.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 9
  9. 10
  10. 11
  11. 12
  12. 13
  13. 14
  14. 15
  15. 16
  16. 17
  17. 18
  18. 19
  19. 20
  20. 21
  21. 22
  22. 23
  23. 24
  24. 25
  25. 26
  26. 27
  27. 28
  28. 29
  29. 30
  30. 31
  31. 32
  32. 33
  33. 34
  34. 35
  35. 36
  36. 37
  37. 38
  38. 39
  39. 40
  40. 41
  41. 42
  42. 43
  43. 44
  44. 45
  45. 46
  46. 47
  47. 48
  48. 49
  49. 50
  50. 51
  51. 52
  52. 53
  53. 54
  54. 55
  55. 56
  56. 57
  57. 58
  58. 59
  59. 60
  60. 61
  61. 62
  62. 63
  63. 64
  64. 106
  65. 107
  66. 108
  67. 109
  68. 110
  69. 111
  70. 112
  71. 113
  72. 114
  73. 115
  74. 116
  75. 117
  76. 118
  77. 119
  78. 120
  79. 121
  80. 122
  81. 123
  82. 124
  83. 125
  84. 126
  85. 127
  86. 128
  87. 129
  88. 130
  89. 131
  90. 132
  91. 133
  92. 134
  93. 135
  94. 136
  95. 137
  96. 138
  97. 139
  98. 140
  99. 141
  100. 142
  101. 143
  102. 144
1 / 13

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • Security in every phase
  • shift left to cut cost
  • threat model in design
  • automate in the pipeline
  • close the loop

Notes

The cost curve

Here is the reason the whole field cares about process. A security flaw found during design is a change to a diagram. Found during coding, it is a few lines. Found in testing, it is a bug ticket and a rebuild. Found in production, it is an incident, an emergency patch and possibly a breach with legal cost. Studies have long put the difference at roughly ten times per phase. Shift left simply means moving security work earlier in the line, where it is cheap.

Why early is cheaper
  • design: change a diagram
  • coding: change a few lines
  • testing: a bug ticket and a rebuild
  • production: an incident, a patch, maybe a breach
  • studies put the gap at roughly 10x per phase
  • "shift left" = move security work earlier in the line

Requirements

The first phase is requirements. Before any code, decide what secure means for this product. What data does it handle, and how sensitive is it? Which regulations apply? Then write security requirements the same way you write functional ones, so they can be tested and signed off. And think in abuse cases: not just what the feature should do, but how someone could misuse it. These become acceptance criteria. The next episode covers requirements and abuse cases in detail.

Security in requirements
  • what data is handled, and how sensitive is it?
  • which regulations apply? (GDPR, PCI, HIPAA)
  • security requirements, written like any other requirement
  • abuse cases: how could this feature be misused?
  • these become acceptance criteria and tests
  • covered next episode

Design

The design phase is where security engineering has the most leverage. The key activity is threat modeling: looking at the design and asking, methodically, what can go wrong. You choose secure patterns for authentication, authorization, cryptography and data flow, and you decide on controls before anything is built. An hour with a whiteboard here can remove an entire class of vulnerability that would otherwise take a penetration test to find. Episodes four and five cover it.

Security in design
  • threat modeling: what can go wrong with this design? (STRIDE, episode 4)
  • choose secure patterns: authn, authz, crypto, data flow, trust boundaries
  • decide controls before build
  • the cheapest place to remove a whole class of bug
  • a diagram and an hour beats a pentest finding

Build

In the build phase, developers follow secure coding standards for their language and framework, which the middle of this part covers in detail. Automated tools join the pipeline: static analysis to scan the code, software composition analysis to check dependencies, and secret scanning on every commit. The most effective versions run in the developer's editor and at commit time, so feedback arrives in seconds, while the code is fresh, not weeks later in a report.

Security in build
  • secure coding standards for the language and framework
  • input validation, output encoding, safe APIs
  • SAST: scan code as it is written
  • SCA: check dependencies
  • secret scanning on commits
  • pre-commit hooks and IDE plugins give instant feedback to the developer

Test

The test phase verifies security the way you verify features. Dynamic analysis scans the running application. Security unit tests pin each fixed vulnerability so it cannot return. Fuzzing throws random input at parsers to find crashes. A manual penetration test precedes major releases. And the pipeline gates on sensible thresholds: block on new highs and criticals, rather than demanding zero findings, which teams quickly learn to bypass.

Security in test
  • DAST: scan the running app
  • security unit tests: a test per fixed vulnerability, so it never returns
  • fuzzing: random inputs to find crashes (episode 16)
  • manual pentest before major releases
  • gate the pipeline on severity thresholds, not on zero findings

Deploy and operate

Deployment and operations continue the work. At deploy: hardened configuration, secrets pulled from a vault, least privilege, and signed artifacts so you know what shipped. In operations: monitoring, logging, alerting, and patching the running estate. Incident response stands ready. These phases are large enough to be their own parts of this course, Parts nine through fourteen. The point for now is that the lifecycle is a loop, not a line.

Release and run
  • deploy: hardened config, secrets from a vault, least privilege, signed artifacts
  • operate: monitoring and logging, alerting, patching
  • incident response ready
  • vulnerability management on the running estate
  • these are Parts 9 to 14
  • the lifecycle is a loop, not a line

Close the loop

The most mature teams close the loop. A production incident becomes a new security requirement for next time. A penetration test finding becomes a static analysis rule, so the same bug is caught automatically from then on. A recurring class of mistake becomes a coding guideline. Metrics show where to invest. The goal of the whole lifecycle is captured in one sentence: the same mistake should never ship twice. That is what turns reactive security into engineering.

Feedback
  • a production incident becomes a new security requirement
  • a pentest finding becomes a SAST rule, so it is caught in future automatically
  • a class of bug becomes a secure-coding guideline
  • metrics guide where to invest
  • the goal: the same mistake never ships twice

Who does what

A word on roles, because it decides whether this works. Developers own the security of their own code; it cannot be outsourced to a separate team at the end. Security engineers enable them: tools, standards, threat models, reviews and training. A common pattern is a security champion, a developer on each team with extra security focus and a line to the security team. The aim is not a gate that says no at the last minute, but security capability spread across engineering.

Roles
  • developers own the security of their code
  • security engineers provide: tools, standards, threat models, reviews, training
  • security champions: a dev on each team, extra focus
  • the goal is NOT a gate team that says no at the end
  • it is capability spread across engineering

Maturity models

You do not have to invent this. Maturity models describe what a good programme looks like and let you measure yours. OWASP SAMM helps you assess and improve practices across the lifecycle. BSIMM is a survey of what real firms actually do, so you can compare. Microsoft's Security Development Lifecycle was the original detailed version. And the NIST secure software development framework is widely referenced in regulation. Pick one, assess honestly, and fix the biggest gaps first.

Measuring the programme
  • OWASP SAMM: assess and improve security practices across the lifecycle
  • BSIMM: a survey of what real firms actually do
  • Microsoft SDL: the original detailed lifecycle
  • NIST SSDF (SP 800-218): secure software development framework, widely referenced
  • use one to find your gaps

Common mistakes

Mistakes. Treating security as a single gate at the end, which creates conflict and gets bypassed. A four hundred page standard nobody reads, instead of a few enforced rules. Tools that flood developers with noise and no triage. Blocking the pipeline on every low finding, which trains people to disable it. Skipping threat modeling, the highest-value activity. Making one team responsible for security instead of all of engineering. And never feeding incidents back into the process.

Avoid these
  • security only as an end-of-line gate
  • a huge standard nobody reads
  • tools that only add noise, with no triage
  • blocking on every low finding
  • no threat modeling
  • no feedback from incidents

Say it like this

In the interview: a secure lifecycle puts security into every phase. Abuse cases in requirements, threat modeling in design, secure coding with static analysis and dependency scanning in the build, dynamic testing and pentests before release, hardening and monitoring in operations, and feedback from incidents into the next round. Developers own their code; security enables and measures. I would cite OWASP SAMM or the NIST framework for maturity.

In the interview
  • "Security in every phase: requirements and abuse cases, threat modeling in design, secure coding with SAST, SCA
  • and secret scanning in build, DAST and pentests in test, hardening and monitoring in ops, and feedback into requirements. Developers own
  • it; we enable and measure."

Interview questions

Q1What is a secure SDLC?

A software development lifecycle with security activities built into every phase: security requirements and abuse cases, threat modeling in design, secure coding and static analysis in build, security testing before release, and hardening, monitoring and feedback in operations.

Q2What does "shift left" mean in security?

Moving security activities earlier in the development process, closer to design and coding, rather than only testing at the end. Because fixing a flaw gets more expensive at each later phase, finding it earlier reduces cost and risk.

Q3Why is it cheaper to fix vulnerabilities early?

An issue found in design is a change to a diagram; in coding, a few lines; in testing, a bug ticket; in production, a potential incident, emergency patch and breach. Each later phase adds rework, coordination and risk, with studies suggesting roughly a tenfold increase per phase.

Q4What security activities belong in each SDLC phase?

Requirements: security requirements and abuse cases. Design: threat modeling and secure architecture. Build: secure coding, SAST, SCA and secret scanning. Test: DAST, fuzzing and penetration testing. Deploy: hardening and secret management. Operate: monitoring, patching and incident response, feeding back into requirements.

Q5What is a security champion?

A developer embedded in a product team who takes on extra security responsibility, acts as a link to the security team, promotes secure practices and helps with threat modeling and reviews. Champions scale security expertise across engineering.

Q6What are OWASP SAMM and BSIMM?

OWASP SAMM (Software Assurance Maturity Model) is a framework to assess and improve software security practices. BSIMM (Building Security In Maturity Model) is a data-driven study of what organisations actually do. Both help measure and benchmark a programme.

Q7Who is responsible for secure code?

The developers who write it own its security, supported by security engineers who provide standards, tools, threat models, reviews and training. Treating security as something a separate team adds at the end leads to conflict and gaps.

Q8What is the NIST SSDF?

The Secure Software Development Framework (NIST SP 800-218): a set of high-level secure development practices grouped into preparing the organisation, protecting software, producing well-secured software and responding to vulnerabilities. It is widely referenced in US software supply chain requirements.