Container & supply-chain security

Image scanning, non-root containers, SBOMs, dependency CVEs, and signing. Supply-chain attacks moved this from niche to core.

About 28 min read3-question knowledge check

The mental model

Container and supply-chain security is about trusting what you ship all the way back to where it came from. A container image is not one thing you wrote — it is your code sitting on top of a base image, hundreds of third-party dependencies, and a build pipeline, any of which an attacker can poison so that you deliver their payload to production with your own signature on it. The defining shift of the last few years: attackers stopped breaking into your app and started breaking into the things your app is built from, because compromising one popular dependency or base image compromises everyone downstream at once.

The analogy that sticks: shipping a sealed food product. Your application code is the recipe you wrote. The base image is the factory the food is made in — if the factory is contaminated, every product is, no matter how clean your recipe. Dependencies are the thousands of ingredients from other suppliers; a poisoned ingredient (a malicious npm package) taints the batch. An SBOM (Software Bill of Materials) is the ingredients list on the label — without it you cannot answer "does my product contain the recalled ingredient?" when a CVE recall is announced. Image signing is the tamper-evident seal proving the box on the shelf is the exact one that left your factory, not one swapped in transit. And running as non-root is not letting the factory worker who handles one product also hold the keys to the whole plant — if they are compromised, the blast radius is one station, not the building.

Why this dominates modern security interviews: the attack surface moved. A decade ago you secured your code; now you must secure your *entire build and dependency chain*, because the highest-leverage attacks (SolarWinds, poisoned packages, typosquats) hit there. Interviewers probe whether you think about provenance (where did this come from and can I prove it?), least privilege at the container boundary (non-root, dropped capabilities, read-only filesystem), and the CVE lifecycle (scan, SBOM, patch SLA) — and whether you know that a container is isolation, not a security boundary as strong as a VM.

The full lesson continues with 15 more sections
  • Deep dive
  • Internal architecture
  • Real-world use cases
  • Best practices
  • Common mistakes
  • Performance
  • Security
  • Production troubleshooting
  • Advantages & disadvantages
  • Alternatives
  • Interview expectations
  • Interview questions
  • Facts to remember
  • Cheat sheet
  • Quick revision