Securing the Supply Chain and Secrets
Image and secret hardening.
Securing the Supply Chain and Secrets is a free Cyber Security Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cyber Security Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
The Software Supply Chain
A container image is built from base images, OS packages, and application dependencies, then pushed through a registry into the cluster. Each step is an opportunity for compromise. Supply-chain attacks insert malicious code before it ever reaches production.
- Compromised base images or dependencies.
- Tampered images in the registry.
- Malicious CI/CD pipeline steps.
Image Vulnerabilities
Images frequently ship with known-vulnerable packages. Scanning catches these before deployment.
- Old base images accumulate CVEs.
- Bloated images expand the attack surface.
- Embedded secrets in image layers leak credentials.
# Scan an image for vulnerabilities
trivy image myorg/app:1.4.2
# Scan filesystem and secrets too
trivy image --scanners vuln,secret myorg/app:1.4.2Minimal and Trusted Base Images
Reduce the surface by starting small and known-good.
- Use distroless or minimal base images (no shell, no package manager).
- Pin base images by digest, not floating tags.
- Prefer official or internally vetted bases.
A smaller image means fewer CVEs and fewer tools for an attacker to abuse post-compromise.
# Pin by digest for immutability
# FROM gcr.io/distroless/static@sha256:<digest>Image Signing and Provenance
Signing proves an image came from your pipeline and was not tampered with. Provenance (SLSA) records how it was built.
- Cosign signs and verifies images.
- Generate an SBOM to track every component.
- Attach build provenance attestations.
# Sign and verify with cosign
cosign sign myorg/app:1.4.2
cosign verify --key cosign.pub myorg/app:1.4.2Admission-Time Verification
Enforce that only signed, scanned images run. An admission controller rejects unsigned or vulnerable images at deploy time.
# Kyverno policy: verify image signatures before admission
kubectl apply -f verify-image-signature.yaml
# Restrict pulls to a trusted registry only
kubectl apply -f allowed-registries.yamlSecuring the Pipeline
The CI/CD system itself is high-value: it holds credentials and can push to production.
- Scope pipeline credentials with least privilege and short lifetimes.
- Pin and verify third-party CI actions/plugins.
- Isolate build runners; do not reuse them across trust levels.
- Protect the registry with auth and immutability.
Kubernetes Secrets Reality
Kubernetes Secrets are base64-encoded, not encrypted, by default. Anyone who can read them, or read etcd, sees plaintext.
# A 'Secret' is trivially decoded
kubectl get secret db -o jsonpath='{.data.password}' | base64 -dEncrypting Secrets at Rest
Protect etcd contents so a stolen backup or etcd access does not leak everything.
- Enable encryption at rest with an
EncryptionConfiguration. - Back it with a cloud KMS provider for envelope encryption.
- Restrict and audit direct etcd access.
External Secret Managers
The strongest pattern keeps secrets out of the cluster store entirely.
- HashiCorp Vault or cloud secret managers hold the source of truth.
- The External Secrets Operator or CSI driver injects them at runtime.
- Use workload identity so pods fetch secrets via short-lived cloud tokens, not static keys.
Secret Hygiene
Operational practices reduce secret exposure.
- Never bake secrets into images or commit them to Git.
- Scan repos and images for leaked credentials.
- Rotate secrets regularly and on suspected exposure.
- Restrict RBAC
get/list secretsto the minimum.
# Detect committed secrets in source
gitleaks detect --source .Testing the Supply Chain
When assessing, verify that unsigned or vulnerable images are actually blocked, that Secrets are encrypted at rest, and that no plaintext credentials sit in images or Git. Demonstrate findings without exfiltrating real secrets beyond proof.
Report each gap with the concrete control (signing policy, KMS encryption, external manager) that closes it.
Quick Check
Confirm your supply-chain and secrets knowledge.
Recap
You hardened the image supply chain and secret handling.
- Scan images, use minimal pinned bases, and sign with cosign.
- Enforce signed/scanned images and trusted registries at admission.
- Kubernetes Secrets are base64 only; enable KMS encryption at rest.
- Prefer external secret managers and workload identity; practice secret hygiene.
This completes the Kubernetes Security course and this lesson set.
Frequently asked questions
Is the “Securing the Supply Chain and Secrets” lesson free?
Yes — the full text of “Securing the Supply Chain and Secrets” is free to read here on the web, and the Cyber Security Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cyber Security Academy course, upgrade to CoddyKit PRO.
What will I learn in “Securing the Supply Chain and Secrets”?
Image and secret hardening. You practise Cyber Security Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Cyber Security Academy?
No prior experience is required. Cyber Security Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Securing the Supply Chain and Secrets” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Cyber Security Academy lesson?
Yes. Every Cyber Security Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Kubernetes Threat Model
- RBAC and Service Accounts
- Pod Security and Network Policies
- Securing the Supply Chain and Secrets