Securing the Software Supply Chain
This lesson explains the controls that make sure only trusted, scanned and unmodified artifacts reach production, since most of the code a workload runs, base images, open-source packages and build tools, was written by someone else.
Learning outcomes
After completing this lesson, you will be able to:
- Explain how AWS CodeArtifact restricts builds to trusted sources.
- Describe image scanning and the export of software bills of materials.
- Explain how image signing and immutability verify integrity.
- Explain how dependency confusion attacks are prevented.
Trusted sources
Builds should obtain dependencies only from trusted sources. The following list describes how this is enforced.
- AWS CodeArtifact as the only package source for builds, with upstream connections to public registries. Package origin controls block upstream versions of internal package names, which prevents dependency confusion attacks.
- ECR pull-through cache for public container images, so builds pull from a repository you control and scan.
- Restrict build environments' network egress so they cannot fetch from arbitrary locations.
The following diagram shows where a malicious public package is stopped in a dependency confusion attack when installs go through CodeArtifact.

Scanning and SBOMs
Amazon Inspector scans ECR images on push and continuously, and can export a software bill of materials (SBOM) in CycloneDX or SPDX format for every resource it monitors. In pipelines, the Inspector SBOM Generator and CI/CD integration scan artifacts before they are pushed, so a build fails on critical vulnerabilities instead of a finding appearing after deployment.
SBOMs and pre-push scanning
Integrity: signing and immutability
Supply chain controls make sure that what is deployed is exactly what was built and approved. Container images are signed with AWS Signer and Notation, and an admission controller such as Kyverno or Gatekeeper on EKS verifies the signature before a pod can run. ECR tag immutability prevents a trusted tag, such as v1.4, from being overwritten with a different image. Lambda packages are protected by a code signing configuration that references Signer profiles; set to Enforce, it rejects unsigned or altered code. Build artefacts are encrypted with KMS, stored in buckets that only the pipeline roles can access, and recorded with their digests so any change can be detected. The following table summarises the controls.
| Artifact | Control |
|---|---|
| Container images | Sign with AWS Signer and Notation; verify signatures at deployment with an admission controller (for example Kyverno or Gatekeeper on EKS) |
| Image tags | ECR tag immutability, so a trusted tag cannot be overwritten with a different image |
| Lambda packages | Code signing configuration with Signer profiles, set to Enforce |
| Build artifacts | Encrypt with KMS, restrict bucket access to the pipeline roles, and record digests |
Keeping artefacts intact
Securing the pipeline itself
The deployment pipeline is itself a target and must be secured. The following list describes the recommended controls.
- Require reviews and branch protection, so one compromised developer account cannot push to production.
- Give each stage a narrowly scoped role; only the deploy stage can change production.
- Use OIDC federation for external CI systems instead of stored access keys.
- Keep build secrets in Secrets Manager, referenced from the buildspec, never in source.
- Log and alert on changes to pipeline definitions and build projects.
Securing the pipeline itself
A company finds that a build pulled a malicious package from a public registry with the same name as one of its internal libraries, but a higher version number. How can this be prevented with minimal changes to developer workflows?
This is dependency confusion. Route all package installs through CodeArtifact, publish internal packages there, and set package origin controls on internal names to block upstream versions. Developers keep using the same tools, pointed at CodeArtifact.
How does CodeArtifact help prevent dependency confusion?
Show answer
With package origin controls, which stop public packages from replacing internal ones of the same name.
Exam Tips
Remember for the exam
- Use CodeArtifact with package origin controls to prevent dependency confusion.
- Inspector scans ECR images and exports SBOMs; scan in the pipeline before deployment too.
- Sign images with AWS Signer and Notation and verify at deployment.
- Enable ECR tag immutability so trusted tags cannot be overwritten.
- Enforce Lambda code signing for function packages.
- Use OIDC instead of stored keys for external CI systems.