Dependency and Supply-Chain Hygiene
Manage third-party packages, lockfiles, SBOMs and build integrity so your software is not compromised through what it depends on.
Intermediate · about 6 hours · difficulty 3/5
Learn first: Secure SDLC
Modern applications are mostly other people's code. A single compromised or vulnerable dependency, build tool or CI plugin can affect everything downstream, so software supply-chain security is now a core defensive discipline.
Dependency hygiene
- Pin versions and commit lockfiles (
package-lock.json,poetry.lock,go.sum) so builds are reproducible. - Prefer well-maintained packages with active maintainers; check OpenSSF Scorecard results for important dependencies.
- Watch for typosquatting and look-alike package names before installing.
- Remove unused dependencies; every package is attack surface.
- Automate update pull requests with Dependabot or Renovate and review them like any other change.
Visibility
- An SBOM (software bill of materials) in SPDX or CycloneDX format lists every component in a build, which makes answering "are we affected by this new CVE?" fast.
- Match SBOMs against vulnerability databases such as OSV.
Build integrity
- Protect CI: least-privilege tokens, pinned third-party actions (by commit SHA), branch protection and required reviews.
- Sign artifacts and container images (for example with Sigstore) and verify signatures before deploy.
- SLSA describes levels of build provenance and tamper resistance.
Pitfalls
- Automatically merging every dependency update without tests.
- CI secrets exposed to untrusted pull requests from forks.
Move on when you can generate an SBOM for a project, enable automated dependency updates, and pin your CI actions to commit hashes.
Key concepts
- Lockfiles and version pinning
- Choosing trustworthy packages
- Typosquatting awareness
- Dependabot and Renovate
- SBOMs (SPDX, CycloneDX)
- CI hardening and pinned actions
- Artifact signing with Sigstore
- SLSA levels
Mini project
For one of your GitHub projects, enable Dependabot, generate a CycloneDX SBOM in CI, pin all third-party actions to commit SHAs and check the repo with OpenSSF Scorecard.
Check yourself
How does an SBOM speed up your response when a new critical CVE is announced in a popular library?
Free resources
- SLSA framework (OpenSSF)
- OpenSSF Scorecard (OpenSSF)
- CycloneDX specification (OWASP)
- OSV vulnerability database (OSV)