Skip to content

Fix/pnpm minimum release age#5798

Open
willporter-workos wants to merge 2 commits intomicrosoft:mainfrom
willporter-workos:fix/pnpm-minimum-release-age
Open

Fix/pnpm minimum release age#5798
willporter-workos wants to merge 2 commits intomicrosoft:mainfrom
willporter-workos:fix/pnpm-minimum-release-age

Conversation

@willporter-workos
Copy link
Copy Markdown

Summary

Setting minimumReleaseAge or minimumReleaseAgeExclude in common/config/rush/pnpm-config.json had no effect. pnpm silently ignored these settings, meaning packages could be resolved that were newer than the configured minimum release age. This unintended behavior defeats the security benefit of the feature.

The settings were being written to common/temp/package.json under the pnpm key, but pnpm does not read minimumReleaseAge from package.json. pnpm only reads it from .npmrc (as minimum-release-age) or pnpm-workspace.yaml.

Fixes #5752

Details

Removed minimumReleaseAge and minimumReleaseAgeExclude from InstallHelpers.generateCommonPackageJson() — they were written to package.json's pnpm section, which pnpm does not consult for these settings.

Instead, BaseInstallManager.prepareAsync() now appends minimum-release-age=<minutes> and minimum-release-age-exclude[]=<package> lines to the generated common/temp/.npmrc via the existing linesToAppend mechanism. Using linesToAppend (rather than linesToPrepend) ensures pnpm-config.json values take precedence over any value the user may have also set in their committed .npmrc, consistent with how other Rush pnpm settings behave. A warning is emitted if minimum-release-age is detected in both places.

This fix handles both workspace mode (WorkspaceInstallManager) and non-workspace mode (RushInstallManager) since both inherit from BaseInstallManager. The existing pnpm version check warning (requires pnpm >= 10.16.0) was moved to the same location as the fix.

Backwards compatibility: no breaking change. Repos that had minimumReleaseAge set were already getting no effect; they will now get the intended enforcement.

How it was tested

Built and ran the @microsoft/rush-lib test suite via rush test --to @microsoft/rush-lib — all tests pass.

The fix was also manually validated by tracing the code path: BaseInstallManager.prepareAsync() calls Utilities.syncNpmrc() with the generated lines, which writes common/temp/.npmrc. pnpm reads minimum-release-age from this file during rush update/rush install.

Impacted documentation

The minimumReleaseAgeMinutes field is documented on the pnpm-config.json schema page. No doc change is required since the public API (the pnpm-config.json field) is unchanged — this is purely a bug fix in how the value is propagated to pnpm.

…ignored

pnpm does not read these settings from package.json's `pnpm` key.
Write them to the generated .npmrc as `minimum-release-age` and
`minimum-release-age-exclude[]` instead, which pnpm actually reads.

Fixes microsoft#5752
@willporter-workos willporter-workos force-pushed the fix/pnpm-minimum-release-age branch from 9776295 to 509dcd3 Compare May 8, 2026 19:19
@willporter-workos
Copy link
Copy Markdown
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

[rush] minimumReleaseAge in pnpm-config.json is written to package.json but pnpm only reads it from .npmrc/pnpm-workspace.yaml

1 participant