-
Notifications
You must be signed in to change notification settings - Fork 665
[rush-lib] Add support for PNPM's minimumReleaseAge setting #5405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rush-lib] Add support for PNPM's minimumReleaseAge setting #5405
Conversation
c760b75 to
eaee160
Compare
This change adds support for PNPM's minimumReleaseAge setting in Rush's pnpm-config.json file to help mitigate supply chain attacks by requiring a minimum age (in minutes) for package versions before installation. Fixes microsoft#5372
This reverts commit 6def020.
|
@microsoft-github-policy-service agree |
D4N14L
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General question, what is the value of doing this here? The NPMRC shipped with the project is equally capable, and you don't have the issue of specification in two separate places.
Though, this question isn't unique to your PR, as there are other settings that do this as well. CC @octogonz since he may have some insight/opinions here.
common/changes/@microsoft/rush-lib/add-minimum-release-age-support_2025-10-07-10-30.json
Outdated
Show resolved
Hide resolved
- Add minimumReleaseAgeExclude property to PnpmOptionsConfiguration - Update pnpm-config.schema.json with new property definition - Add documentation to template pnpm-config.json - Write minimumReleaseAge and minimumReleaseAgeExclude to package.json instead of passing as CLI args - Add PNPM version check (10.16.0+) in InstallHelpers - Remove command-line argument passing from BaseInstallManager - Update tests to verify minimumReleaseAgeExclude functionality - Fix TSDoc warning for @ character escaping Addresses code review feedback from PR microsoft#5405
|
@iclanton Let's review please ;) all the remarks were completed |
Pull Request Summary - Add PNPM minimumReleaseAge and minimumReleaseAgeExclude Support
PR Title
Summary
This PR adds support for PNPM's
minimumReleaseAgeandminimumReleaseAgeExcludesettings in Rush'spnpm-config.jsonfile. These settings help mitigate supply chain attacks by requiring a minimum age (in minutes) for package versions before they can be installed, with the ability to exclude trusted packages from this restriction.Fixes #5372
Details
Changes Implemented (Updated based on code review feedback):
Added
minimumReleaseAgeandminimumReleaseAgeExcludepropertiesIPnpmOptionsJsoninterface andPnpmOptionsConfigurationclassminimumReleaseAge: number (minutes to wait after package release)minimumReleaseAgeExclude: string[] (package names/patterns to exclude from the check)Updated JSON schema (
pnpm-config.schema.json)minimumReleaseAge(type: number)minimumReleaseAgeExclude(type: array of strings)Settings written to workspace package.json (refactored based on feedback)
InstallHelpers.generateCommonPackageJson()to write both settings tocommon/temp/package.jsonin thepnpmsectionAdded PNPM version validation
globalIgnoredOptionalDependenciesRemoved CLI argument approach
BaseInstallManager.ts.npmrcduplicate detection (no longer needed with package.json approach)Updated API documentation in
rush-lib.api.mdAdded comprehensive template documentation
Added test coverage
PnpmOptionsConfiguration.test.tsto verify both settingsminimumReleaseAgeandminimumReleaseAgeExcludeDesign decisions:
package.jsoninstead of passed as CLI args (more reliable)minimumReleaseAgeExcludesupports glob patterns (e.g.,@myorg/*) per PNPM 10.17.0+Backwards compatibility:
✅ This change is fully backwards compatible. Both settings are optional, and existing configurations will continue to work unchanged.
Performance impact:
Code Review Updates
This PR has been updated based on feedback from @D4N14L and @iclanton:
minimumReleaseAgeExcludesupportpackage.jsoninstead of CLI args@character escaping