Three supply-chain gaps, two of which the repo already claimed to have closed. 1. Actions were pinned to floating tags (`actions/checkout@v7`). A tag is mutable, so CI executed whatever that tag pointed at on the day it ran. Now pinned to commit SHAs with the version in a trailing comment; the existing github-actions Dependabot ecosystem keeps both in sync. 2. Weekly OSV scan (.github/workflows/osv-scanner.yml). docs 06 §6 and 08 §2 both require one and none existed. It complements the per-PR audit gate: `npm audit --omit=dev --audit-level=high` only sees the production tree and only fails on high+, while OSV covers the whole lockfile against the full database. Also runs on PRs that touch package-lock.json so a bad bump is caught on the PR instead of up to a week later. It runs the scanner directly rather than the reusable SARIF workflow, because SARIF upload needs `security-events: write` plus code scanning, which this plan does not have. A non-zero exit failing the run is the alert. Switch to the reusable workflow once the repo is public and code scanning is free. osv-scanner.toml carries one suppression: gray-matter -> js-yaml@3.15.0 (GHSA-5p4m-2wfm-xmqj), which has no patched 3.x and only ever parses our own committed frontmatter at build time. It has an `untilDate` so it expires and gets re-argued rather than becoming permanent. 3. Install-script hardening. `.npmrc` asserted "ignore-scripts is applied in CI" and that sharp needed scripts. Both were false: ci.yml never set it, and sharp@0.35 ships prebuilt @img/sharp-* binaries with no install script at all. Replaced with npm 11's allowlist model, which is what docs 06 §6 actually asks for: package.json#allowScripts names the four packages that legitimately have install scripts (esbuild, workerd, lefthook, fsevents) and .npmrc sets strict-allow-scripts so anything unreviewed is a hard failure. Verified in a clean directory: with strict on and esbuild NOT allow-listed, `npm install` exits 1 with ESTRICTALLOWSCRIPTS; with it allow-listed, it succeeds. A dependency that suddenly grows a postinstall now stops the build instead of executing it. Also: job-level `permissions:` on the build job, and dependabot.yml's stale note about /workers/widgets corrected — the worker exists now; it is skipped because it is deliberately dependency-free and has no manifest to read. Verified: prettier, eslint, astro check (0 errors), knip, build + CSP guard, audit gate all green; `npm ci --dry-run` confirms lockfile and package.json stay in sync. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
12 lines
687 B
Plaintext
12 lines
687 B
Plaintext
# Supply-chain hardening (docs 06 §6). npm >= 11 resolves lifecycle scripts against
|
|
# package.json#allowScripts; `strict-allow-scripts` turns "package X has an install
|
|
# script you haven't reviewed" from a warning into a failed install. A dependency that
|
|
# suddenly grows a postinstall — the Shai-Hulud worm shape — stops the build instead of
|
|
# executing. Review it, then `npm approve-scripts <pkg>` to add it to the allowlist.
|
|
#
|
|
# The previous note here claimed CI applied `ignore-scripts` and that `sharp` needed
|
|
# scripts. Both were wrong: CI never set it, and sharp@0.35 ships prebuilt @img/sharp-*
|
|
# binaries with no install script at all.
|
|
fund=false
|
|
strict-allow-scripts=true
|