Adopt pnpm supply-chain policy (recipe A) - #13
Merged
Conversation
Add pnpm-policy to gate installs: third-party releases must be 2 days old before pnpm will install them, since a compromised release is normally reported and yanked well within that window. Our own packages (the @constructive-io/@constructive-db/@launchql/@pgpm/ @pgpmjs/@pgsql scopes, published under pyramation) skip the wait — waiting on our own release protects nothing. The exempt package/scope list in pnpm-workspace.yaml is generated from pnpm-policy's inventory of what pyramation actually publishes, not hand-maintained, so it can't silently drift out of date. Run `pnpm run policy` after editing pnpm-policy.yaml, `pnpm run policy:check` to verify no drift (now wired into CI). allowBuilds is expressed via `onlyBuiltDependencies` (not the newer `allowBuilds` map) because CI pins pnpm 10.12.2, older than the 10.16 cutoff where `allowBuilds` was introduced. nx and unrs-resolver are the only packages allowed to run install scripts, both for native binary postinstall steps. Part of 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
Adopts the org's pnpm supply-chain policy (recipe A) in this workspace, via pnpm-policy.
pnpm-policy.yamlat the workspace root: 2-dayminimumReleaseAgefor third-party packages (a compromised release is normally reported and yanked within hours, so a short wait catches it without stalling upgrades),blockExoticSubdeps: true(this repo's lockfile resolves nothing from git/URL — verified),maintainers: [pyramation], and our owned scopes (@constructive-io,@constructive-db,@launchql,@pgpm,@pgpmjs,@pgsql).@constructive-io/pnpm-policy(pinned exact at0.2.1, the currently published version — not^0.2.1) andpnpm-policyas root devDependencies.policy(regenerate) andpolicy:check(drift check), both using--builds-key onlyBuiltDependencies.pnpm-workspace.yaml's managed block (minimumReleaseAge,minimumReleaseAgeExclude,blockExoticSubdeps,onlyBuiltDependencies).pnpm run policy:checkinto CI (.github/workflows/ci.yml,buildjob) immediately after the existingpnpm install --frozen-lockfilestep.allowBuilds
CI pins pnpm
10.12.2(below the 10.16 cutoff where theallowBuildskey was introduced), so this usesonlyBuiltDependenciesinstead, per the tool's--builds-keyflag. Packages allowed to run install scripts, with reasons:nx— postinstall (bin/post-install) downloads/links the native platform binary that powers Nx's task graph runner; without it the install is broken.unrs-resolver— postinstall runsnapi-postinstallto fetch the native (napi-rs) resolver binary used by eslint's TypeScript import resolver during lint.Both were flagged by pnpm's
ERR_PNPM_IGNORED_BUILDSafterpnpm add; verified by inspecting each package'spackage.jsonscripts.postinstall.Version pin
@constructive-io/pnpm-policypinned exact to0.2.1(currently published version), not caret.CI
Wired into the existing
buildjob in.github/workflows/ci.yml(no separate lint workflow exists) — added aCheck supply-chain policystep runningpnpm run policy:checkright afterInstall dependencies.Verification (all run locally against pnpm
10.12.2, matching what CI pins — the repo has nopackageManagerfield, so CI's pin is the canonical version; my locally installed pnpm is 11.11.0, which behaves differently for build approvals, see deviation below)pnpm run policy:check→pnpm-workspace.yaml matches the policypnpm install --frozen-lockfile→ succeedspnpm run policyrun twice →pnpm-workspace.yamlshasum identical before/after (deterministic), second run reportedUnchangedDeviations / notes
pnpm-lock.yamlshows a large diff beyond the two new devDependencies. This is YAML formatting churn (double- vs single-quoted keys) from being regenerated under pnpm10.12.2rather than whatever pnpm version last touched the lockfile — not a content/resolution change. Ran all verification against10.12.2since that's what CI pins.allowBuilds: {pkg: "set this to true or false"}block intopnpm-workspace.yamloutside pnpm-policy's managed section whenever it detects unapproved build scripts, even whenonlyBuiltDependenciesalready lists them. This is pnpm 11's own behavior, not pnpm-policy's; I removed the stray block each time and verified everything with pnpm10.12.2(CI's pinned version) instead, where it does not occur.packageManagerfield exists inpackage.json; CI'spnpm/action-setuppin (10.12.2) is the closest thing to a canonical version, soonlyBuiltDependencieswas the correct choice per the policy's own guidance.Part of constructive-io/constructive-planning#1464. Not merging — for review only.
🤖 Generated with Claude Code
https://claude.ai/code/session_01CEswUi4ANuB58rva48aHge