Skip to main content
Cybersecurity

DevSecOps Tutorial with Examples.

DevSecOps tutorial with scanners on a repo you own: threat modeling, SAST, secrets scanning, SCA and SBOMs, DAST, a CI security gate and image signing.

Architecture at a glance

Click any box to open the lesson that teaches it

DevSecOps pipeline at a glance

design → commit → gate → sign → test, with every tool taught on this site

DevSecOps pipeline at a glance A developer threat-models with pytm, commits, and a GitHub Actions security gate runs Gitleaks, Bandit and Semgrep, and pip-audit with Syft and Grype. A failure loops back to the commit; a pass builds a hardened image that cosign signs, the registry stores and verifies, the app runs, and a ZAP baseline scan tests it. Guardrail lessons from other topics sit underneath. Developer writes code Threat model pytm · STRIDE Commit push to Git CI security gate · GitHub Actions Secrets scan Gitleaks · incl. history SAST Bandit · Semgrep rule SCA + SBOM pip-audit · Syft · Grype Security gate fails on any finding fail: fix, rotate or bump, push again pass Release and run Build image non-root Sign the digest cosign sign · verify Registry pull by digest Running app staging DAST ZAP baseline scan Guardrails · lessons from other topics IaC scan · Checkov Policy as code · conftest CI secrets · Actions Sensitive vars · Terraform Vault · Ansible Safer scripts · Bash Server auth · MCP OAuth Ops controls · MCP
How it fits together (6 steps)
  1. Design: model the system and its data flows with pytm and STRIDE before writing code.
  2. Every push runs one CI job with three checks: Gitleaks for secrets (history included), Bandit and a Semgrep rule for code, and pip-audit, a Syft SBOM and Grype for dependencies.
  3. The security gate fails the build on any finding. You fix the code, rotate a leaked key or bump a pin, then push again.
  4. Release: build a hardened image, sign its digest with cosign, push it to a registry and verify the signature before it runs.
  5. Test the running app from the outside with a ZAP baseline scan.
  6. Guardrails from other topics cover infrastructure code, CI secrets, vaults and scripts.

Beginner

Start here — no prior experience needed

3 lessons

Intermediate

For developers with core concepts down

3 lessons

Advanced

Production-grade patterns for experienced engineers

1 lesson

Also part of DevSecOps (AppSec in the pipeline)

Taught in other topics. Each link opens the lesson in its home topic.

10 lessons
bash intermediate
5 min read

Write secure Bash scripts — safe temp files with mktemp, avoiding command injection, handling secrets, and setting file permissions.

github-actions beginner
5 min read

GitHub Actions masks a secret printed directly to the log — but transforming it first (base64, a substring, a hash) produces output the masker never recognizes as the secret, leaking it in full.

docker advanced
5 min read

Harden Docker images and containers: non-root users, read-only filesystems, secrets management, image scanning, and runtime policies.

docker advanced
5 min read

Use multi-stage Dockerfiles to produce small, secure production images by separating build and runtime environments.

terraform intermediate
5 min read

sensitive = true masks a secret in plan output, but state keeps it in plain text. Real runs show both, plus why an ephemeral variable is refused.

ansible beginner
5 min read

The same variable name, defined in three places, resolves to three different values depending on where you look — verified by actually stacking group_vars, host_vars, and -e against each other.

cloud-security intermediate
5 min read

Catch a public S3 bucket and SSH open to the internet in Terraform before anything is deployed: run Checkov, gate on the checks that matter, fix, re-scan.

cloud-security intermediate
5 min read

Write Rego rules and run them on a real terraform plan: untagged resources and SSH open to the internet fail, the fix passes, the policy has its own tests.

mcp advanced
5 min read

Protect an MCP server with OAuth: the 401 and resource metadata, audience and scope checks, CIMD versus DCR, token refresh, Keycloak and DPoP in the SDK.

mcp advanced
5 min read

Run MCP as several instances: nginx and the 421 Host check, a shared request-state key, SQLite, cache hints, key rotation, audit logs and Kubernetes.