Skip to Content
Mengty Learns
Security

Software Supply Chain Security

Securing dependencies and CI/CD pipelines with lockfiles, SHA-pinned GitHub Actions (with this repo as an honest example), pnpm audit, Renovate/Dependabot, SBOMs, and SLSA provenance.

how-tointermediateTested with pnpm 11.6.0, asvs 5.0.0 (V15), owasp_top_10 2025 (A03)Updated Nov 26, 2026

TL;DR

A03:2025 Software Supply Chain Failures covers compromised packages, tampered lockfiles, and unpinned CI pipelines. Defend with --frozen-lockfile, full 40-char SHA pinning for GitHub Actions, pnpm audit + Renovate/Dependabot, SBOMs, and SLSA provenance—and audit your own workflows honestly.

Why it exists

Attackers increasingly target the build pipeline instead of the running app: hijacking a maintainer's npm token, sneaking malicious postinstall scripts into transitive dependencies, or force-pushing a malicious commit onto a popular GitHub Action tag (@v4).

Honest audit of this repo's workflows

Look at .github/workflows/ in this repository as a real-world example of what is already in place and what still needs hardening:

ControlCurrent state in this repoGap / next step
Lockfile enforcementci.yml, quality.yml, and inbox.yml all run pnpm install --frozen-lockfile.Keep --frozen-lockfile everywhere; consider --ignore-scripts where native builds aren't needed.
Action pinninglabs.yml pins to patch tags (actions/checkout@v4.2.2, hadolint/hadolint-action@v3.5.0, opentofu/setup-opentofu@v2.0.2), while ci.yml, quality.yml, and inbox.yml still use floating major tags (actions/checkout@v4, pnpm/action-setup@v4, actions/setup-node@v4).Not SHA-pinned yet: pin every uses: across all 4 workflows to a 40-character commit SHA with a version comment.
Least-privilege GITHUB_TOKENlabs.yml and quality.yml set permissions: contents: read; inbox.yml sets permissions: issues: write.ci.yml still omits an explicit permissions: contents: read block.
# UNSAFE: floating tag can be retargeted upstream
- uses: actions/checkout@v4

# SAFE: immutable 40-char commit SHA with human-readable version comment (not run)
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

Core supply-chain controls

  1. Lockfiles (pnpm-lock.yaml): Commit the lockfile, review unexpected lockfile diffs in PRs, and always install with pnpm install --frozen-lockfile in CI.
  2. Vulnerability scanning (pnpm audit) & automated updates: Run pnpm audit --prod in CI (note: triage CVEs in dev/build tools separately from runtime exposure) and enable Renovate or Dependabot to open small, frequent update PRs (including SHA bumps for Actions).
  3. SBOM (CycloneDX / SPDX): Generate an SBOM during release builds so you can answer "which deployed apps include package X?" in seconds during a zero-day incident.
  4. Provenance / SLSA: Use signed build provenance (such as GitHub Artifact Attestations) to cryptographically bind the published artifact to the exact source commit and CI workflow.

Gotchas

  • Pinning to @v4.2.2 feels "pinned" but is still mutable: Only a 40-character commit SHA is immutable in Git.
  • Ignoring postinstall scripts: Malicious npm packages often execute code during pnpm install before your tests even start; audit new dependencies and use --ignore-scripts where feasible.
  • pnpm audit noise: A medium-severity ReDoS in a test-only devDependency should not train the team to ignore real runtime criticals—separate prod vs dev audit policies.

Production checklist

  • Every CI install uses pnpm install --frozen-lockfile.
  • Every third-party GitHub Action is pinned to a 40-character commit SHA (maintained by Renovate/Dependabot).
  • Every workflow declares explicit minimal permissions: (default contents: read).
  • Automated dependency updates and pnpm audit run on a schedule and on PRs.
  • Release artifacts emit an SBOM and signed SLSA provenance attestation.

Check yourself

Check Yourself

1. Why is actions/checkout@v4.2.2 weaker than pinning to a 40-character commit SHA?

2. What problem does an SBOM solve during a newly disclosed zero-day vulnerability (like Log4Shell)?

Sources