Interview Prep/DevSecOps/Supply Chain Security

A Dockerfile downloads a binary with `curl | sh`. How do you make it safe?

IntermediateScenarioSupply Chain Security
Answer

Situation read → You are executing whatever the server returns at build time. A compromised URL means a compromised image.

What I'd do →

  1. Pin an explicit version in the URL.
  2. Verify a SHA-256 checksum stored in the repo: echo "<sha256> tool.tgz" | sha256sum -c -.
  3. Prefer verifying a signature (cosign verify-blob, GPG) from the publisher.
  4. Better: use a package from your internal proxy, or copy from a pinned image with COPY --from=.

Why → A checksum committed in the repo ties the build to a reviewed artifact.

Interview tip → curl | sh in a Dockerfile is a code review red flag.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Supply Chain Security