Phase 3: DevSecOps & Supply Chain Security
๐ง Beginner Mental Model (Explain Like Iโm 5)
Think of your CI/CD pipeline as a pharmaceutical bottling line:
- Trivy & SBOMs: X-ray scanners that list every ingredient inside your container image and reject any bottle containing known poison (CVEs).
- GitHub OIDC: A biometric badge that lets GitHub Actions talk to AWS for 15 minutes without ever storing a static password.
- Cosign & Kyverno: A tamper-proof wax seal stamped onto the container image at the factory; if anyone modifies the image before it reaches Kubernetes, the admission gate refuses to run it.
๐งญ Step-by-Step Execution Playbook for Phase 3
- Step 1 (Scan & Sign): Scan images with Trivy and sign digests keyless with Cosign in Lesson 1.
- Step 2 (Keyless Cloud Auth): Replace AWS secrets in CI with OIDC federation in Lesson 2.
- Step 3 (Runtime Secrets & Rotation): Sync secrets into K8s via External Secrets Operator (Lesson 3) and automate dual-user zero-downtime rotation (Lesson 4).
๐ Deep-Dive Index
1. Secret Management & Scanning
- Git Security: TruffleHog, Talisman pre-commit hooks to block secrets.
- Runtime Secrets: External Secrets Operator (ESO) syncing AWS Secrets Manager to Kubernetes Secrets. HashiCorp Vault.
2. Software Supply Chain (SBOMs & Scanning)
- Container Scanning: Trivy, Grype. Differentiating between OS-level CVEs and application-dependency CVEs.
- SBOMs: Generating Software Bill of Materials using Syft (SPDX vs CycloneDX formats).
- Cryptographic Signing: Sigstore/Cosign. Keyless signing via OIDC.
3. Kubernetes Admission Control
- Dynamic Admission Webhooks: Mutating vs Validating webhooks.
- Kyverno / OPA Gatekeeper: Writing policies to enforce security standards at the Kubernetes API level before pods are scheduled.
๐ ๏ธ Job-Essential Exercises
- The Vulnerable Build CI Pipeline:
- Write a GitHub Action that builds a Docker image. Add a step to run Trivy. Introduce an outdated dependency (e.g., an old Log4j or Express.js version). Ensure Trivy breaks the pipeline.
- The Cryptographic Supply Chain:
- Once the image passes Trivy, add a GitHub Action step to sign the Docker image using Cosign. Push the signed image to Amazon ECR or GitHub Container Registry.
- The Admission Shield:
- Install Kyverno on a Kubernetes cluster. Write a
ClusterPolicythat blocks any pod deployment if the container image does not possess a valid Cosign signature from your public key. Try tokubectl applyan unsigned NGINX image and watch the API reject it.
- Install Kyverno on a Kubernetes cluster. Write a