Skip to content

feat: read trustPolicy, trustPolicyExclude, and trustPolicyIgnoreAfter from pnpm-config.json#5751

Merged
iclanton merged 5 commits intomicrosoft:mainfrom
fpapado:feat/pnpm-trust-policy
Apr 15, 2026
Merged

feat: read trustPolicy, trustPolicyExclude, and trustPolicyIgnoreAfter from pnpm-config.json#5751
iclanton merged 5 commits intomicrosoft:mainfrom
fpapado:feat/pnpm-trust-policy

Conversation

@fpapado
Copy link
Copy Markdown
Contributor

@fpapado fpapado commented Apr 7, 2026

Summary

This PR closes #5750, by adding support for these options in pnpm-config.json.

From a user's perspective, they can now adopt a stricter trust policy, providing defence-in-depth for supply chain vulnerabilities, particularly hijacking of dependency maintainers' tokens and publishing outside of CI. The trustPolicyExclude and trustPolicyIgnoreAfter options provide a migration path for adopting the setting, by avoiding errors on known-good (or assumed-good) versions of packages.

Details

I largely followed the implementation for minimumRelease and minimumReleaseAgeExclude, adding the setting to PnpmOptionsConfiguration and any of the related interfaces. I also updated the docs, largely matching what pnpm describes.

This should not have backwards compatibility issues, since these properties are optional (though I suppose if a repo was specifying them assuming they worked, they will now be enforced; I forget if pnpm-config.json is permissive about unknown properties)

How it was tested

I added unit tests to ensure that the config gets passed on.

I'm now looking through the docs about the current recommendation for linking locally, so I can test this on our monorepo at DoorDash.

Impacted documentation

The docs at https://rushjs.io/pages/configs/pnpm-config_json/ are affected, though if I understood the process right, they are covered by the docs changes here? Let me know if not, and I can update the site manually or in whichever process 😌

(Note to self to double-check the api-extractor result, now that I've edited some of the comments)

fpapado and others added 2 commits April 7, 2026 12:00
…settings

Add first-class support for pnpm trust policy settings in Rush's
pnpm-config.json. These settings protect against dependency hijack
attacks by blocking installations where a package's trust level has
decreased. Each setting has a separate pnpm version check:
trustPolicy (>=10.21.0), trustPolicyExclude (>=10.22.0), and
trustPolicyIgnoreAfter (>=10.27.0).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@fpapado
Copy link
Copy Markdown
Contributor Author

fpapado commented Apr 7, 2026

@microsoft-github-policy-service agree company="DoorDash"

@fpapado fpapado changed the title feat: add pnpm trustPolicy, trustPolicyExclude, and trustPolicyIgnoreAfter feat: read trustPolicy, trustPolicyExclude, and trustPolicyIgnoreAfter from pnpm-config.json Apr 7, 2026
fpapado and others added 3 commits April 9, 2026 15:25
Co-authored-by: Ian Clanton-Thuon <iclanton@users.noreply.github.com>
...this setting is named like that in user-facing and internal
Rush config, but must be surfaced as trustPolicyIgnoreAfter
in the synthesised package.json.
@iclanton iclanton enabled auto-merge (squash) April 15, 2026 15:46
@iclanton iclanton merged commit f022484 into microsoft:main Apr 15, 2026
6 checks passed
@github-project-automation github-project-automation bot moved this from Needs triage to Closed in Bug Triage Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

[rush] Support for pnpm's trustPolicy setting(s) in pnpm-config.json

2 participants