Module 23 · DevSecOps & Application Security · Lesson 67 of 75
The secure development lifecycle and threat modelling
Why fixing security early is cheaper, the stages of a secure SDLC, secure coding principles, and a STRIDE threat model of a real feature.
In this lesson · about 40 minutes
- Describe security activities at each stage of the SDLC
- Apply core secure-coding principles
- Threat-model a feature with STRIDE and a data flow diagram
Shift left, and keep watching right
"Shift left" moves security earlier in the timeline. It does not replace testing and monitoring in production ("shield right"); you need both.
Security in each stage of the SDLC
| Stage | Security activity |
|---|---|
| Requirements | Security and privacy requirements, abuse cases ("as an attacker, I want to...") |
| Design | Threat modelling, secure architecture review |
| Code | Secure coding standards, IDE linters, peer review, pre-commit secret scanning |
| Build | SAST, SCA, secrets scanning, IaC and container scanning in CI |
| Test | DAST, API testing, penetration testing for big changes |
| Release / deploy | Signed artefacts, approved images, policy checks |
| Operate | Monitoring, WAF, runtime protection, bug bounty, patching |
Frameworks: NIST SSDF (SP 800-218), OWASP SAMM (maturity model), Microsoft SDL, and OWASP ASVS for web application requirements.
Secure coding principles
- Validate input on the server (allow-lists, types, lengths) and encode output for its context (HTML, JavaScript, SQL, shell).
- Parameterised queries, never string-built SQL.
- Use proven libraries for authentication, sessions and cryptography; never write your own crypto.
- Least privilege for the app's database account, cloud role and file access.
- Fail securely: errors deny access and do not leak stack traces.
- Secrets in a vault or secrets manager, never in code.
- Log security events without logging secrets or personal data.
Threat modelling
Four questions (from the Threat Modeling Manifesto): What are we building? What can go wrong? What are we going to do about it? Did we do a good job? Draw a data flow diagram with processes, data stores, external entities, data flows and trust boundaries (where data crosses from less to more trusted). Then walk each element through STRIDE:
| Threat | Violates | Example control |
|---|---|---|
| Spoofing | Authentication | MFA, signed tokens |
| Tampering | Integrity | Signatures, server-side validation |
| Repudiation | Non-repudiation | Audit logs |
| Information disclosure | Confidentiality | Encryption, access checks |
| Denial of service | Availability | Rate limits, quotas |
| Elevation of privilege | Authorisation | Role checks on every request |
Other approaches: PASTA (risk-centric), LINDDUN (privacy), attack trees. Tools: OWASP Threat Dragon, Microsoft Threat Modeling Tool, or a whiteboard.
Performance-based question (PBQ)
STRIDE the password-reset feature
Your team is building "forgot password": the user enters an email, receives a link with a token, and sets a new password. You list threats in the design review.
Pick the STRIDE category for each threat.
- The page says 'no account with that email', revealing which emails are customers
- An attacker guesses a short reset token and takes over the account
- A bot requests 50,000 reset emails, getting the mail domain blocked
- Changing user_id in the reset request sets another user's password
- No log is kept of resets, so a user can deny requesting one
- The token in the link can be modified to extend its expiry time
Check your understanding0 of 3 correct
Quiz score: 0 of 3
Written by Noviq Academy in its own words. All labs are simulations: no real systems are touched, and every name, address, password and hash is made up. The offensive techniques taught here are for defending systems and for authorised testing only; never scan, access or test a system without the owner's written permission. Tool and product names belong to their owners, and command output may differ slightly from yours. Read-aloud uses your device's built-in voices.