awesome-everything RU
↑ Back to the climb

Security

Supply-chain security: config and pipeline reading

Crux Read real manifests, lockfiles, a cosign verify, and a CI workflow, predict the supply-chain behaviour, and pick the highest-leverage fix.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at senior altitude — in orbit
◷ 14 min

Supply-chain problems live in manifests, lockfiles, and pipeline YAML — not in your application code. Read each snippet, predict where the install step is exposed, and choose the fix a senior engineer would make first.

Goal

Practise the loop you run in every supply-chain review: read the manifest and pipeline, predict where untrusted bytes or untrusted code can enter, and reach for the highest-leverage control before adding more scanning.

Snippet 1 — the manifest

// package.json — and the CI step that installs it
{
  "dependencies": {
    "left-pad": "^1.3.0",
    "@acme/billing": "^2.0.0"
  }
}
// CI:  run: npm install
Quiz

Two things here weaken the install step. Which pair, and what is the single highest-leverage fix?

Snippet 2 — manifest vs lockfile

# package.json says:
"@acme/ui": "^3.1.0"

# package-lock.json (committed) pinned:
"@acme/ui": { "version": "3.1.0",
              "resolved": "https://registry.npmjs.org/@acme/ui/-/ui-3.1.0.tgz",
              "integrity": "sha512-Abc123..." }

# A new 3.4.0 was published yesterday. CI runs `npm ci`.
Quiz

With `npm ci` and this committed lockfile, which version installs, and what is the integrity field doing?

Snippet 3 — verifying provenance

# Release pipeline signs the image; deploy gate verifies before rollout:
cosign verify \
  --certificate-identity-regexp "https://github.com/acme/.*" \
  --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
  ghcr.io/acme/api@sha256:9f2b...   # pinned by digest, not :latest
Quiz

What does this cosign verify gate actually guarantee, and why is the @sha256 digest (not :latest) important?

Snippet 4 — the CI workflow

on:
  pull_request_target:          # runs in the BASE repo context
jobs:
  build:
    permissions:
      contents: write
      packages: write
    steps:
      - uses: actions/checkout@v4
        with: { ref: ${{ github.event.pull_request.head.sha }} }  # checks out PR code
      - run: npm install && npm run build   # runs untrusted code with write tokens + secrets
Quiz

Why is this workflow dangerous, and what is the first fix?

Recap

Every supply-chain review is read in manifests and pipeline YAML: caret ranges plus npm install let new or tampered bytes in, while a committed lockfile plus npm ci enforces exact versions and integrity hashes; cosign verify against an expected build identity, with the image pinned by digest, rejects impostor artifacts at the deploy gate; and a CI workflow that runs untrusted PR code with write-scoped secrets is the highest-blast-radius bug of all. Read the config, find where untrusted bytes or untrusted code meet your credentials, and fix that boundary before adding more scanning.

Continue the climb ↑Supply-chain security: harden a release pipeline end to end
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources2
expand
  1. 01
  2. 02

Trademarks belong to their respective owners. Editorial reference only.