Add pnpm supply-chain policy (recipe A) - #13
Merged
Merged
Conversation
Adds pnpm-policy.yaml as the source of truth for what this workspace trusts, generated into pnpm-workspace.yaml. Third-party releases wait 2 days before install: a compromised release is normally reported and yanked within hours, so the short wait catches it without stalling legitimate upgrades. The minimumReleaseAge exemption list (first-party packages under our scopes/maintainer) is derived from the pinned @constructive-io/pnpm-policy inventory package rather than hand-maintained, so it stays correct as we publish new packages. allowBuilds is scoped to the four packages whose postinstall scripts this workspace actually needs (electron, esbuild, nx, unrs-resolver), each with a real reason — everything else is denied by default. Bumps CI's pinned pnpm from 10.12.2 to 10.34.5: the allowBuilds config key pnpm-policy emits requires pnpm >= 10.16 to be honored (older pnpm silently ignores it, skipping postinstall builds pnpm-lock.yaml needs). Wires `pnpm run policy:check` into the existing CI workflow right after `pnpm install`. Ref constructive-io/constructive-planning#1464
|
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 changed
Rolls out the org pnpm supply-chain policy (recipe A) to this repo, per constructive-io/constructive-planning#1464.
pnpm-policy.yamlat the workspace root — the human-editable source of truth (2-dayminimumReleaseAgefor third-party releases,blockExoticSubdeps: true, our maintainer/scopes,allowBuilds,exceptions: []).pnpm-policyand@constructive-io/pnpm-policy(pinned exact0.2.1, the currently published version — not^0.2.1) as devDependencies."policy": "pnpm-policy generate""policy:check": "pnpm-policy check"pnpm run policyto patch the derived settings intopnpm-workspace.yamlunder theManaged by pnpm-policymarker, thenpnpm install.pnpm run policy:checkinto the existing.github/workflows/ci.yml, immediately after the existingpnpm installstep.allowBuilds
Four packages' postinstall scripts are needed by this workspace; everything else is denied by default:
electronapps/desktopruns against; without it there is no Electron runtime to launch.esbuildnxunrs-resolverDeviation: bumped CI's pinned pnpm version
CI pinned
pnpm/action-setupto10.12.2. TheallowBuildskey thatpnpm-policy generateemits (the current, non-deprecated format) requires pnpm >= 10.16 to be honored — on 10.12.2 pnpm silently ignores it (exits 0, prints an "Ignored build scripts" warning, and never runs the postinstall scripts electron/esbuild/nx/unrs-resolver need). Using the olderonlyBuiltDependencieskey instead (which 10.12.2 does run builds for) turned out to have its own problem: after running builds via that key, pnpm 10.12.2 additionally appends its own unmanagedallowBuilds: <pkg>: set this to true or falsestub topnpm-workspace.yaml, which drifts from the policy-managed file and makespolicy:checkfail on the very next install — including in CI, right after thepnpm installstep this PR addspolicy:checkafter.Rather than ship a CI step that's guaranteed to fail, I bumped
pnpm/action-setup's pinned version to10.34.5(latest 10.x, well above the 10.16 threshold). Verified this version runs postinstall scripts correctly and produces no drift. No other CI changes were made — the existing checkout/setup-node/build/lint/test steps are untouched.No git/URL transitive dependencies were found in
pnpm-lock.yaml, soblockExoticSubdeps: trueis set as the default (no override needed).Verification (all run against pnpm 10.34.5, matching the updated CI pin, and re-confirmed against the local pnpm 11.11.0)
pnpm run policy:check→pnpm-workspace.yaml matches the policy✓pnpm install --frozen-lockfile→ succeeds cleanly (withCI=trueto skip the interactive modules-purge confirmation, same as any real CI runner) ✓pnpm run policyrun twice →pnpm-workspace.yamlshasum identical before/after (deterministic) ✓Not merging
Per instructions, this PR is opened for review only — not merged.
🤖 Generated with Claude Code
https://claude.ai/code/session_01CEswUi4ANuB58rva48aHge