Module 11 · Project 11 · Add Security to the Pipeline (DevSecOps) · Lesson 38 of 48

Supply chain, CI credentials and cluster guardrails

Protect what goes into your software and how it gets to production: pinned versions, SBOMs, signed images, short-lived CI credentials, and policies the cluster enforces.

In this lesson · about 30 minutes

  • Explain software supply-chain attacks and three defenses
  • Replace long-lived CI secrets with OIDC and least privilege
  • Describe Pod Security, admission policies and runtime detection

The software supply chain

Your production app is built from your code plus hundreds of packages, a base image, CI actions, and the build system itself. Attackers increasingly target those: a hijacked package, a malicious CI action, a tampered build. Defenses:

  • Pin versions: commit lock files (package-lock.json), pin base images by digest, and pin third-party CI actions to a commit SHA, not a moving tag.
  • Keep dependencies fresh: Dependabot or Renovate open small update PRs that run through all your checks.
  • SBOM (software bill of materials): a list of every component in an image (Syft, Trivy). When the next big CVE drops, you can answer "are we affected?" in minutes.
  • Sign images with Cosign (Sigstore) after they pass the scans, and let the cluster run only signed images from your registry.

CI credentials

CI holds the keys to your registry and cloud, so it's a top target.

  • Use OIDC instead of stored cloud keys: the CI job proves who it is to AWS and gets temporary credentials for one role, valid for minutes. No long-lived secret to leak.
  • Give each workflow the least privilege it needs (permissions: contents: read, a deploy role that can only push to one registry).
  • Don't run untrusted pull requests from forks with secrets available.
  • With GitOps (Project 08), CI doesn't need cluster credentials at all.
# GitHub Actions: get short-lived AWS credentials via OIDC
permissions:
  id-token: write
  contents: read
steps:
  - uses: aws-actions/configure-aws-credentials@<pinned-sha>
    with:
      role-to-assume: arn:aws:iam::123456789012:role/notes-ci-push
      aws-region: us-east-1

Guardrails in the cluster

  • Pod Security Standards: label a namespace pod-security.kubernetes.io/enforce: restricted, and Kubernetes rejects Pods that run as root, are privileged or mount the host.
  • Policy as code (Kyverno or OPA Gatekeeper): your own rules, checked when anything is applied. "Images must come from ghcr.io/you and be signed." "Every container needs limits." "No latest tags."
  • Runtime detection (Falco): watches what containers actually do and alerts on surprises, like a shell started inside a production container or a write to /etc.
  • RBAC and network policies (Project 07) limit who and what can reach what.
# the container settings these policies expect
securityContext:
  runAsNonRoot: true
  allowPrivilegeEscalation: false
  readOnlyRootFilesystem: true
  capabilities: { drop: ["ALL"] }

Hands-on lab (simulated terminal)

Lab: scan, fix and sign

The notes repo, with Trivy, Gitleaks and Cosign installed.

Step 1 of 4. Type each command and press Enter. Nothing runs on your computer.

Lab: scan, fix and sign

1. Scan the whole Git history for secrets with Gitleaks.

you@laptop:~/notes$

Check your understanding0 of 3 correct

Question 1

1.Why use OIDC for CI access to AWS?

Question 2

2.What is an SBOM for?

Question 3

3.Someone opens a shell inside a production container. Which tool notices?

Key terms

Say the meaning to yourself, then tap a card to check.

Quiz score: 0 of 3

Tip: answer every quiz question correctly first.

Written by Noviq Academy in its own words. The labs are simulations: no real servers are touched. When you build the projects yourself, use a practice virtual machine or a free-tier cloud account you control, watch your cloud spending, and never run cleanup or delete commands on a machine you care about. Tool names belong to their owners; versions and output are shown for learning and may differ slightly from yours. Read-aloud and the whiteboard voice use your device's built-in voices.