chore: enforce npm min-release-age dependency cooldown - #416
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
@cursor review |
Co-Authored-By: Steven Zhang <szhang@launchdarkly.com>
Co-Authored-By: Steven Zhang <szhang@launchdarkly.com>
Co-Authored-By: Steven Zhang <szhang@launchdarkly.com>
Co-Authored-By: Steven Zhang <szhang@launchdarkly.com>
Co-Authored-By: Steven Zhang <szhang@launchdarkly.com>
Co-Authored-By: Steven Zhang <szhang@launchdarkly.com>
Co-Authored-By: Steven Zhang <szhang@launchdarkly.com>
Co-Authored-By: Steven Zhang <szhang@launchdarkly.com>
27215ae to
020757d
Compare
Co-Authored-By: Steven Zhang <szhang@launchdarkly.com>
| variations: [ | ||
| # {os: ubuntu-latest, node: latest}, | ||
| {os: ubuntu-latest, node: 'lts/*'}, | ||
| {os: ubuntu-latest, node: 24}, |
There was a problem hiding this comment.
What is the full version of 24 this ends up being?
There was a problem hiding this comment.
24.18.0 on the latest run — setup-node takes it from the runner tool cache rather than resolving the newest 24.x (24.19.0), which is exactly why the bundled npm is 11.16.0 and the Update NPM step is back.
There was a problem hiding this comment.
Is there a way to make it be at least 24.19.0? Without pinning it to exactly 24.19.0?
There was a problem hiding this comment.
And now what version of NPM does 24.19.0 ship with?
There was a problem hiding this comment.
11.17.0 — verified in the run for node: '^24.19.0':
Attempting to download ^24.19.0...
Acquiring 24.19.0 - x64 from .../node-24.19.0-linux-x64.tar.gz
node: v24.19.0
npm: 11.17.0
So setup-node accepts a semver range and pulls the newest 24.x that satisfies it instead of the cached 24.18.0. With that in place I've dropped the Update NPM steps again (CI + both release jobs), and release-please now uses node-version: '^24.19.0' instead of 24.x. Same across js-client-sdk#352 / node-client-sdk#77 / vue-client-sdk#97.
Co-Authored-By: Steven Zhang <szhang@launchdarkly.com>
| @@ -0,0 +1,3 @@ | |||
| min-release-age=3 | |||
There was a problem hiding this comment.
🟡 Dependency cooling-off period is effectively disabled because the wait time is far shorter than intended
The minimum wait before a newly published dependency may be installed is set to 3 (min-release-age=3 in .npmrc:1), but the setting is interpreted in minutes rather than days, so packages published only three minutes ago are still installed.
Impact: The safeguard meant to avoid pulling in just-published (potentially compromised) dependency versions provides almost no protection.
npm config units for min-release-age
npm's min-release-age config is a number of minutes, not days. The accompanying comments in .github/workflows/ci.yml:32 and .github/workflows/release-please.yml:50 indicate the intent is to use the exclusion list to allow LaunchDarkly's own freshly published packages, implying a meaningful cooling-off window for everything else. A 3-day window would need min-release-age=4320.
| min-release-age=3 | |
| min-release-age=4320 |
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Agreed — it's days (docs), so 3 is the intended 3-day window and the suggestion is wrong. Same conclusion as the earlier thread on node-client-sdk#77; no change needed.
Co-Authored-By: Steven Zhang <szhang@launchdarkly.com>
Requirements
Related issues
Supply chain hardening for legacy SDK repositories, mirroring js-core's yarn
npmMinimalAgeGate: 4320(3 days).Describe the solution you've provided
.npmrcwithmin-release-age=3(npm expresses this in days), so npm resolves only versions published more than 3 days ago. Unlike a Dependabot-level setting, this applies to every install — local development and CI alike.min-release-age-excludeexplicitly names the first-party packages this repo actually resolves (launchdarkly-js-client-sdkand its transitivelaunchdarkly-js-sdk-common), so LaunchDarkly patches can be adopted immediately while third-party releases stay quarantined. Names are listed individually rather than pattern matched..npmrcis un-ignored so the setting is committed; publishing is unaffected becausesetup-nodewrites its auth.npmrcto a tempNPM_CONFIG_USERCONFIGpath, not into the repo.npm@^11.17.0beforenpm install—min-release-age-excludelanded in npm 11.17.0, and the node 22 matrix entry bundles npm 10. The release workflow needs no change: node 24.x already bundles 11.17.0, so itsUpdate NPMstep is removed.Describe alternatives you've considered
Dependabot
cooldown— only governs Dependabot PRs, and these legacy repos aren't aiming to stay continuously updated.Additional context
Verified locally with npm 11.17.0: the gate blocks non-exempt packages, the exclude list is honored, and
npm installplus the test suite pass.Link to Devin session: https://app.devin.ai/sessions/566f0d951dfa4568b67ad0c6c1cfb7c1
Requested by: @joker23
Note
Overview
Introduces supply-chain hardening by committing a repo
.npmrcthat setsmin-release-age=3, sonpm installonly resolves dependency versions published more than three days ago.min-release-age-excludelistslaunchdarkly-js-client-sdkandlaunchdarkly-js-sdk-commonso first-party LaunchDarkly packages are not delayed..npmrcis removed from.gitignoreso the policy applies in local dev and CI; publishing auth is unchanged becausesetup-nodeuses a separate user config for registry tokens.CI and release GitHub Actions pin Node from
lts/*/24.xto^24.19.0(npm 11.x withmin-release-age-excludesupport). The globalnpm install -g npm@11.6.2steps are removed from both publish jobs inrelease-please.ymlas redundant with the pinned Node toolchain.Reviewed by Cursor Bugbot for commit e62f4cb. Bugbot is set up for automated code reviews on this repo. Configure here.