Expert · DevSecOps · topic 46 of 53 · 30 min
DevSecOps: shifting security left
Explanation
Why "shift left"?
Picture the life of a feature as a line from left to right: idea, design, code, build, test, release, run. Shift left means moving security checks towards the left side of that line, so they happen earlier. A design flaw found on a whiteboard costs a ten-minute conversation. The same flaw found in production can cost an emergency fix, a lost weekend, a breach notice to customers and a regulator, and lost trust.
In the old model, a separate security team tested the app a few days before release and handed over a long PDF of problems. Developers had already moved on, deadlines were close, and most findings were either rushed or ignored. DevSecOps (development, security and operations) replaces that with small, automatic checks in every pull request and every pipeline run, plus a few human practices like threat modelling.
Security is everyone's job
- Developers validate input, use parameterised database queries and never hard-code secrets.
- Reviewers look for missing access checks in pull requests, not just style.
- DevOps engineers add scanners to the pipeline, give every service the least privilege it needs, and keep base images patched.
- The security team becomes an enabler: it chooses tools, writes guidance, trains "security champions" (one interested developer per team) and helps with threat models.
Threat modelling: thinking like a defender
Threat modelling is a structured conversation about what could go wrong with a design before it is built. Four simple questions guide it: What are we building? What can go wrong? What are we going to do about it? Did we do a good enough job?
Start with a data flow diagram (DFD): a simple drawing of external entities (users, a payment gateway), processes (your API), data stores (databases, buckets) and the arrows between them. Then mark the trust boundaries: the places where data crosses from a less trusted zone to a more trusted one, such as from the internet into your API. Most threats sit on those boundaries.
[Student phone] --HTTPS--> | trust boundary | --> [Canteen API] --> (Orders DB)
|
+--> [Payment gateway] (external)Then walk through each element and arrow with STRIDE, a checklist of six kinds of threat. For each one, ask "could this happen here?" and note the defence.
| Letter | Threat | Canteen app example | Typical defence |
|---|---|---|---|
| S | Spoofing: pretending to be someone else | Ordering with another student's ID | Strong authentication, MFA for staff |
| T | Tampering: changing data you should not | Editing the price in the request body | Server-side checks, integrity checks, signatures |
| R | Repudiation: denying you did something | "I never placed that order" | Audit logs with user, time and action |
| I | Information disclosure: data leaks | API returns every student's phone number | Access control, return only needed fields, encryption |
| D | Denial of service: making it unavailable | A script floods the order endpoint at lunch | Rate limits, quotas, autoscaling |
| E | Elevation of privilege: gaining more rights | A student calls the admin refund endpoint | Role checks on every request, least privilege |
The OWASP Top 10 for DevOps people
OWASP (the Open Worldwide Application Security Project) is a non-profit that publishes free security guidance. Its Top 10 is a list of the most common web application risks. The table follows the 2025 edition; the 2021 edition is still widely quoted, so check owasp.org for the exact wording.
| Risk | In one line | The usual fix |
|---|---|---|
| A01 Broken Access Control | Users reach data or actions they should not | Check permissions on the server for every request; deny by default |
| A02 Security Misconfiguration | Debug mode on, default passwords, open buckets | Hardened, reviewed configuration as code; scan IaC |
| A03 Software Supply Chain Failures | Vulnerable or malicious dependencies and build tools | SCA, lockfiles, SBOMs, signed artefacts |
| A04 Cryptographic Failures | Weak or missing encryption | TLS everywhere, strong algorithms, managed keys |
| A05 Injection | Untrusted input runs as SQL or commands | Parameterised queries, input validation, SAST |
| A06 Insecure Design | The design itself has no defence | Threat modelling, secure design patterns |
| A07 Authentication Failures | Weak logins, no MFA, broken sessions | MFA, rate limiting, proven login libraries |
| A08 Software or Data Integrity Failures | Unsigned updates or untrusted data trusted | Signatures, verified pipelines, safe deserialisation |
| A09 Security Logging and Alerting Failures | Attacks happen and nobody notices | Log security events, alert on them, keep logs safe |
| A10 Mishandling of Exceptional Conditions | Errors leak details or fail open | Fail safely (closed), generic error messages, tests for errors |
Secure defaults
A secure default is a setting that is safe unless someone deliberately changes it. People rarely change defaults, so the default decides how secure most systems are. Examples: new storage buckets are private, containers run as a non-root user, debug mode is off in production, network access is denied unless allowed, and every new service account starts with no permissions.
Security gates that do not block everything
A security gate is a pipeline step that fails the build when a scanner finds a serious problem. If the gate fails on every low-severity finding, developers learn to ignore it or ask for it to be switched off. A good gate is strict about what matters and quiet about the rest.
- Severity threshold: fail on critical and high findings; show medium and low as warnings.
- Baseline: fail only on new findings in this change, and track older ones as a backlog to burn down.
- Exceptions with expiry: when a finding cannot be fixed yet (no patch exists, or it is a false positive), record an exception with an owner, a reason and an expiry date. After the date, the gate fails again.
# security-gate.yaml: read by the pipeline's gate step
fail_on: high # fail on high and critical
exceptions:
- id: DEMO-2026-0012
reason: "No fixed version of the PDF library yet; input is only from staff"
owner: priya@example.com
expires: 2026-12-31Need help?
Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.
Try:
Watch the lesson
DevSecOps: shifting security left · 1/7
DevSecOps means building security into every step of delivery, instead of one big check just before release.
Prefer a video by a teacher? Find free videos on “devsecops shift left threat modelling stride explained” on YouTube ↗
In real life: A fintech team in Pune threat-models a "split the bill" feature
Before writing code, three developers and a security champion draw the data flow for a new feature that lets friends split a restaurant bill over UPI. Walking through STRIDE, they notice the draft API takes the payer's user ID from the request body. Anyone could change it and charge a friend (spoofing and elevation of privilege). They change the design so the user ID always comes from the login token. The discussion takes 45 minutes. Found after launch, the same flaw would have meant a fraud investigation and an RBI incident report.
Practice (0/3 done)
A team adds a SAST scanner that fails the build on every finding, including low ones. What is the most likely result after a month?
Write gate_passes(findings, allowlist, today, threshold="high"). findings is a list of dicts like {"id": "F1", "severity": "critical"}; severities in order are low, medium, high, critical. allowlist maps a finding id to an expiry date "YYYY-MM-DD". The gate FAILS (return False) if any finding at or above the threshold is not covered by an exception that is still valid on today (an exception is valid up to and including its expiry date). Otherwise return True.
Threat-model a college canteen ordering app: students order and pay on their phones; canteen staff see orders on a tablet; payments go through a payment gateway; orders are stored in a database. Draw (or write) the data flow, mark trust boundaries, and list at least one threat and defence for each STRIDE letter.
Quick quiz
Read more (free)
Related help
Before this, learn
This topic builds on these. If something here feels new, open them first.
Related topics
- Secrets managementDevSecOps · same module
- Software supply chain securityDevSecOps · same module
- Kubernetes securityDevSecOps · same module
- The OWASP Top 10: the most common web risksBackend Development · Backend security
- The OWASP approach to web testingEthical Hacking and Penetration Testing (legal labs) · Web application testing: Burp Suite and the basics
- The OWASP Top 10 with fixesCyber Security: from zero to SOC analyst · Malware and web security
Questions people ask about this
Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.
What does "shift left" mean in DevSecOps?
Answer: Doing security checks earlier in the delivery process
Left is the start of the delivery line (design and code). Finding problems there is cheaper.
In STRIDE, a user claims "I never placed that order" and you cannot prove otherwise. Which threat is this?
Answer: Repudiation
Repudiation is denying an action. Audit logs with who, what and when are the defence.
Which is the best example of a secure default?
Answer: New storage buckets are private unless someone makes them public
A secure default is safe unless someone deliberately changes it.
A vulnerability has no fixed version yet. What is a sensible way to let the pipeline continue?
Answer: Add an exception with an owner, a reason and an expiry date
An expiring exception is recorded, owned and reviewed again, so it does not become permanent by accident.
Where do most threats appear on a data flow diagram?
Answer: At trust boundaries, where data crosses from a less trusted zone to a more trusted one
Trust boundaries are where input from outside must be checked, so most threats sit there.
What is the OWASP Top 10?Related
Answer: A list of the most common and serious web app security risks
The Top 10 is a free awareness list of the most common and serious risks found in real web apps.
Why refer to OWASP in a finding?Related
Answer: It is a trusted standard the client recognises
OWASP is widely recognised, which makes findings credible.
Debug mode left on in production, showing stack traces to users, is…Related
Answer: Security misconfiguration
Wrong settings in production are misconfiguration.
Under semantic versioning, a release adds a new feature without breaking anything. Version 2.3.1 becomes:Related
Answer: 2.4.0
A new backward-compatible feature bumps MINOR and resets PATCH to 0.
Pass the quiz (60% or more) or mark this topic as done when you are ready.
Your progress is saved on this device only.
Next steps
- 3 more topics in “DevSecOps” before its exam: Secrets management, Software supply chain security, Kubernetes security.
- Module 11 exam: DevSecOps · 12 questions · 20 min, without help. 4 topics of this module still to finish first.
- Then the next module, GitOps, platform engineering and DevOps careers. 53 topics left in the course before the final exam.
← Previous: Resilience patterns, capacity and chaos engineering