How it works
The explanation, with examples you can run.
Know what you depend on
- Commit lockfiles and install from them in CI (
npm ci,pip install --require-hashes,go mod verify), so every build uses the exact versions you reviewed. - Produce an SBOM for each release (SPDX or CycloneDX) and keep it. When a widely used library announces a critical flaw, an SBOM search tells you which services are affected.
- Watch advisories through your platform's dependency alerts, OSV, or a commercial scanner.
Vulnerable dependencies
Scanners report a lot. Prioritise:
- Known exploited vulnerabilities (CISA's KEV catalogue, vendor notices) in internet-facing services.
- Reachable ones: your code actually calls the vulnerable function with attacker-influenced input. Several scanners can now tell you this.
- The rest, through routine updates. Tools like Dependabot or Renovate open small update pull requests continuously. Staying close to current is what makes an emergency fix a one-line bump instead of a three-major-version migration.
Agree target fix times by severity (for example critical in days, high in weeks) and track them.
Malicious dependencies
The common tricks: typosquatting (reqeusts), dependency confusion (a public package with the same name as your private one and a higher version), account takeover of a real maintainer, and protestware or sabotage by a maintainer. Defences:
- Review new dependencies before adding them: who maintains it, how widely used, how recently changed, does it need what it asks for? Fewer dependencies is a real security measure.
- Use scoped or namespaced names for private packages and pin which registry each scope comes from.
- Disable install scripts where you can (
npm config set ignore-scripts true, then allow specific packages), sincepostinstallruns arbitrary code on developer machines and CI. - Wait a little: many malicious releases are caught within days. Package managers and update bots can enforce a minimum release age before adopting a new version.
- Check health signals such as OpenSSF Scorecard (branch protection, code review, pinned dependencies, signed releases).
The build is part of the chain
Pin CI actions and base images by digest, give CI jobs least-privilege tokens, and produce signed provenance for your own artifacts. The CI/CD path covers SLSA, SBOM attestation and Sigstore signing in detail. Consumers of your software then get the same assurances you want from your own suppliers.
Check yourself
3 questions. Get them all right to finish this topic.
0 of 3 right so far. Get all three to finish this topic.