Add pnpm supply-chain policy (recipe A) - #34
Merged
Merged
Conversation
Gates third-party installs behind a 2-day minimumReleaseAge: most malicious npm releases are reported and yanked within hours, so the short wait catches a compromise without meaningfully stalling upgrades. First-party packages (our own npm accounts and scopes) skip the wait since we control what we publish. The exemption/build-approval lists in pnpm-workspace.yaml are now derived by `pnpm-policy generate` from what this lockfile actually resolves, rather than hand-maintained, so they can't silently drift out of date. `pnpm run policy:check` fails CI if pnpm-policy.yaml and pnpm-workspace.yaml disagree. allowBuilds carries over the 3 packages pnpm was already flagging as ignored-build scripts (nx, unrs-resolver, @launchql/protobufjs), each with a real reason instead of the generic placeholder pnpm writes. Part of the org-wide rollout tracked in constructive-io/constructive-planning#1464. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CEswUi4ANuB58rva48aHge
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the org-wide pnpm supply-chain policy to this repo, per the recipe in constructive-io/constructive-planning#1464.
pnpm-policy.yamlat the workspace root: the human-edited source of truth.pnpm-workspace.yamlgets aminimumReleaseAge: 2dgate on third-party packages (first-party scopes/packages we publish are exempted — seeminimumReleaseAgeExclude, derived automatically from what this lockfile actually resolves), plus anallowBuildsmap for the packages allowed to run install scripts.pnpm run policy(regenerate) andpnpm run policy:check(drift check, wired into CI) scripts added.@constructive-io/pnpm-policypinned to an exact0.2.1(no caret);pnpm-policyadded as the CLI devDependency.Why 2 days
A compromised release is normally reported and yanked within hours, so a short wait catches it without meaningfully stalling upgrades.
allowBuilds set
This repo had no
onlyBuiltDependenciesentries to carry over (none existed before this change).pnpm installflagged 3 packages underERR_PNPM_IGNORED_BUILDS, now explicitly approved with real reasons:@launchql/protobufjsnxbin/post-install) downloads the platform-specific@nx/nx-<os>-<arch>native binary the task-graph engine requires to run at all.unrs-resolverblockExoticSubdeps
Left
true(default). No git- or URL-sourced dependencies found inpnpm-lock.yaml.CI
Wired into the existing
Supabase testsjob in.github/workflows/ci.yml, immediately after thepnpm installstep:Deviation to flag
This repo's CI (
.github/workflows/ci.ymlandportability.yml) pinspnpm/action-setup@v2withversion: 9. TheallowBuildskey inpnpm-workspace.yamlis native pnpm functionality introduced around pnpm 10.16 — pnpm 9 predates the "ignored build scripts" approval gate entirely. Locally (pnpm 11.11.0, nopackageManagerfield pins this repo to an older version), onlyallowBuildsactually satisfiesERR_PNPM_IGNORED_BUILDS— the olderonlyBuiltDependencieskey was tried first per the pnpm-policy tool's--builds-keycompat flag, but pnpm 11 ignored it and still blocked the three packages' scripts untilallowBuildswas added. Since this repo has nopackageManagerpin, I generated with the default (allowBuilds) key, matching actual local behavior. Recommend the org separately consider bumping the CI pnpm version pin to something >=10.16 so CI's install behavior matches local/dev; left untouched here since it's outside this recipe's scope.Verification
All three passed locally before opening this PR:
🤖 Generated with Claude Code
https://claude.ai/code/session_01CEswUi4ANuB58rva48aHge