chore: add minimal age to package installations#270
Merged
Conversation
44c043c to
411a03b
Compare
98c532a to
0dd7ca3
Compare
0dd7ca3 to
e1f68b9
Compare
e1f68b9 to
f9f77a2
Compare
mcmire
approved these changes
Oct 17, 2025
This was referenced Oct 20, 2025
Mrtenz
added a commit
to MetaMask/core
that referenced
this pull request
Oct 20, 2025
## Explanation This bumps Yarn to the latest version (`4.10.3`), which includes support for setting an age gate for NPM packages. It's set to 3 days following the security recommendations, meaning that packages must be at least 3 days old to be installed. ## References MetaMask/metamask-module-template#270 ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [ ] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Updates Yarn to 4.10.3 and configures a 3‑day NPM minimal age gate with preapproved MetaMask and LavaMoat scopes. > > - **Tooling**: > - **Yarn version**: Require `yarn@4.10.3` in root `package.json` and enforce via `yarn.config.cjs`. > - **NPM age gate**: In `.yarnrc.yml`, set `npmMinimalAgeGate: 4320` and add `npmPreapprovedPackages` for `@metamask/*` and `@lavamoat/*`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4ce1763. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
github-merge-queue bot
pushed a commit
to MetaMask/snaps
that referenced
this pull request
Oct 20, 2025
## Explanation This bumps Yarn to the latest version (`4.10.3`), which includes support for setting an age gate for NPM packages. It's set to 3 days following the security recommendations, meaning that packages must be at least 3 days old to be installed. ## References MetaMask/metamask-module-template#270 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Upgrades Yarn to 4.10.3, adds a 3-day npm age gate with preapproved packages, and updates related configs and LavaMoat policy references. > > - **Build/Config**: > - **Yarn upgrade**: Set `yarnPath` and root `packageManager` to `yarn@4.10.3` in `.yarnrc.yml`, `package.json`, and `yarn.config.cjs`. > - **NPM age gate**: Add `npmMinimalAgeGate: 4320` and `npmPreapprovedPackages` (`@metamask/*`, `@lavamoat/*`) in `.yarnrc.yml`. > - **LavaMoat policy**: > - Update `policy.json` to reference `depcheck>readdirp>picomatch` instead of `ts-loader>micromatch>picomatch` in relevant entries. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 635d8c1. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
github-merge-queue bot
pushed a commit
to MetaMask/snaps
that referenced
this pull request
Oct 20, 2025
## Explanation This bumps Yarn to the latest version (`4.10.3`), which includes support for setting an age gate for NPM packages. It's set to 3 days following the security recommendations, meaning that packages must be at least 3 days old to be installed. ## References MetaMask/metamask-module-template#270 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Upgrades Yarn to 4.10.3, adds a 3-day npm age gate with preapproved packages, and updates related configs and LavaMoat policy references. > > - **Build/Config**: > - **Yarn upgrade**: Set `yarnPath` and root `packageManager` to `yarn@4.10.3` in `.yarnrc.yml`, `package.json`, and `yarn.config.cjs`. > - **NPM age gate**: Add `npmMinimalAgeGate: 4320` and `npmPreapprovedPackages` (`@metamask/*`, `@lavamoat/*`) in `.yarnrc.yml`. > - **LavaMoat policy**: > - Update `policy.json` to reference `depcheck>readdirp>picomatch` instead of `ts-loader>micromatch>picomatch` in relevant entries. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 635d8c1. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
This was referenced Oct 23, 2025
github-merge-queue bot
pushed a commit
to MetaMask/metamask-extension
that referenced
this pull request
Oct 24, 2025
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This bumps Yarn to the latest version (`4.10.3`), which includes support for setting an age gate for NPM packages. It's set to 3 days following the security recommendations, meaning that packages must be at least 3 days old to be installed. From the [Yarn docs](https://yarnpkg.com/configuration/yarnrc): > Minimum age of a package version according to the publish date on the npm registry in minutes to be considered for installation. > > If a package version is newer than the minimal age gate, it will not be considered for installation. This can be used to reduce the likelihood of installing compromised packages. See MetaMask/metamask-module-template#270 for reference. [](https://codespaces.new/MetaMask/metamask-extension/pull/37119?quickstart=1) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Bumps Yarn to 4.10.3 and adds a 3-day NPM package age gate with allowlist for MetaMask and LavaMoat packages. > > - **Tooling**: > - Update `package.json` `packageManager` to `yarn@4.10.3`. > - **Yarn config** (`.yarnrc.yml`): > - Add `npmMinimalAgeGate: 4320` (3 days). > - Add `npmPreapprovedPackages` allowlist: `@metamask/*`, `@lavamoat/*`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8e3cc51. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
github-merge-queue bot
pushed a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Oct 24, 2025
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Yarn 4.10.3 includes support for setting an age gate for NPM packages. I've set it to 3 days following the security recommendations, meaning that packages must be at least 3 days old to be installed. From the [Yarn docs](https://yarnpkg.com/configuration/yarnrc): > Minimum age of a package version according to the publish date on the npm registry in minutes to be considered for installation. > > If a package version is newer than the minimal age gate, it will not be considered for installation. This can be used to reduce the likelihood of installing compromised packages. See MetaMask/metamask-module-template#270 for reference. ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: ## **Related issues** Fixes: ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Sets a 3-day npm age gate in `.yarnrc.yml` and preapproves `@metamask/*` and `@lavamoat/*` packages. > > - **Config (`.yarnrc.yml`)**: > - Set `npmMinimalAgeGate: 4320` (3 days) to restrict installation of very new packages. > - Add `npmPreapprovedPackages` allowing `@metamask/*` and `@lavamoat/*` to bypass the age gate. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 00535c2. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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.
Summary
This pull request enforces a 3-day minimum release age for all NPM packages. Packages published more recently will be blocked from installation, reducing the risk of supply-chain attacks involving newly compromised releases.
Teams that need exceptions can override this restriction by listing packages under the
npmPreapprovedPackagesoption.This is a new feature included in yarn v4.10.*
Note
Adds a 3‑day npm package age gate in Yarn with allowlists for @metamask/* and @lavamoat/*, and bumps Yarn to 4.10.3.
npmMinimalAgeGate: 4320andnpmPreapprovedPackagesfor@metamask/*and@lavamoat/*in.yarnrc.yml.packageManagertoyarn@4.10.3inpackage.json.Written by Cursor Bugbot for commit f364f48. This will update automatically on new commits. Configure here.