Skip to content

chore: upgrade Yarn to 4.16.0#128

Merged
Mrtenz merged 3 commits into
mainfrom
mrtenz/upgrade-yarn-4
Jun 12, 2026
Merged

chore: upgrade Yarn to 4.16.0#128
Mrtenz merged 3 commits into
mainfrom
mrtenz/upgrade-yarn-4

Conversation

@Mrtenz

@Mrtenz Mrtenz commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

Migrates from Yarn classic to Yarn 4.16.0 to align with the module template:

  • Yarn is activated via Corepack from the packageManager field; .yarnrc is replaced by .yarnrc.yml (template defaults verbatim).
  • Install-script approval moves to the LavaMoat yarn-plugin-allow-scripts, checked in under .yarn/plugins/. @lavamoat/allow-scripts bumps to ^3.0.4 and @lavamoat/preinstall-always-fail to ^2.0.0 to match the plugin. The setup script is removed.
  • build-lint-test.yml: both jobs gain corepack enable, the install becomes yarn install --immutable, and the explicit yarn allow-scripts step is dropped.

dist/index.js is regenerated; the bundled output differs slightly because ncc inlines a few helpers differently after the lockfile migration, but the source is unchanged.

Four browserslist-ecosystem transitives (pulled in via @babel/core for Jest's transforms) were briefly pinned with resolutions to dodge the 3-day npmMinimalAgeGate during the initial install, then dropped once the lockfile settled.

The bigger template gaps (workflow restructure, yarn.config.cjs, engines.node bump) remain out of scope.

Mrtenz added 2 commits June 12, 2026 20:02
Migrate to Yarn 4 using Corepack via the packageManager field. Replace
.yarnrc with .yarnrc.yml (using the template's defaults: enableScripts
false, 3-day npm minimal age gate, telemetry off, node-modules linker).
Add the LavaMoat allow-scripts Yarn plugin so install-script approval
keeps working without a separate `yarn allow-scripts` step. Bump
@lavamoat/allow-scripts ^1 -> ^3 and @lavamoat/preinstall-always-fail
^1 -> ^2 to match the plugin. Drop the now-redundant `setup` script.

Update build-lint-test.yml: enable Corepack in both jobs, switch the
install to `yarn install --immutable`, drop the explicit allow-scripts
step.

Pin three transitive browserslist deps via `resolutions` (semver,
caniuse-lite, electron-to-chromium, baseline-browser-mapping) to
versions outside the 3-day age gate. These come in via @babel/core,
which jest pulls for its internal transforms.

dist/index.js is regenerated and now contains slightly different bundled
internals after the lockfile migration; the source has not changed and
behaviour is equivalent.
After the initial Yarn 4 install with pinned resolutions, the age-gated
packages have aged out (or settled at a version Yarn picks naturally).
Removing the resolutions block leaves the lockfile stable -- yarn
install --immutable still passes -- and avoids carrying maintenance
pins that would need updating on every future dep bump.
@socket-security

socket-security Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​lavamoat/​preinstall-always-fail@​1.0.0 ⏵ 2.1.18110048 +584100
Updated@​lavamoat/​allow-scripts@​1.0.6 ⏵ 3.4.3100 +1100100 +1093100

View full report

@socket-security

socket-security Bot commented Jun 12, 2026

Copy link
Copy Markdown

Warning

MetaMask internal reviewing guidelines:

  • Do not ignore-all
  • Each alert has instructions on how to review if you don't know what it means. If lost, ask your Security Liaison or the supply-chain group
  • Copy-paste ignore lines for specific packages or a group of one kind with a note on what research you did to deem it safe.
    @SocketSecurity ignore npm/PACKAGE@VERSION
Action Severity Alert  (click "▶" to expand/collapse)
Warn Medium
Install-time scripts: npm @lavamoat/preinstall-always-fail during preinstall

Install script: preinstall

Source: echo "Don't run npm lifecycle scripts by default! Create a .yarnrc or .npmrc and set enableScripts: false. Then, whitelist them with @lavamoat/allow-scripts" && exit 1

From: package.jsonnpm/@lavamoat/preinstall-always-fail@2.1.1

ℹ Read more on: This package | This alert | What is an install script?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@lavamoat/preinstall-always-fail@2.1.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Low
Potential code anomaly (AI signal): npm @npmcli/git is 100.0% likely to have a medium risk anomaly

Notes: The code reads the user's git configuration and applies defaults to streamline automation, notably by auto-accepting new SSH host keys and bypassing prompts. This reduces friction for automation but lowers interactive security. Not inherently malicious, but the default behavior should be clearly documented and optionally opt-in or restricted per-project to mitigate potential risk.

Confidence: 1.00

Severity: 0.60

From: ?npm/@lavamoat/allow-scripts@3.4.3npm/@npmcli/git@7.0.2

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@npmcli/git@7.0.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Low
Potential code anomaly (AI signal): npm function-bind is 100.0% likely to have a medium risk anomaly

Notes: The code is a standard Function.prototype.bind polyfill implementation. It carefully handles this binding, constructor behavior, and argument binding without introducing observable malicious behavior. The dynamic Function constructor is used as part of a legitimate polyfill technique and does not indicate an attack by itself in this context.

Confidence: 1.00

Severity: 0.60

From: ?npm/@lavamoat/allow-scripts@3.4.3npm/eslint-plugin-node@11.1.0npm/jest@29.7.0npm/eslint-plugin-import@2.23.3npm/function-bind@1.1.2

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/function-bind@1.1.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Low
Potential code anomaly (AI signal): npm node-gyp is 100.0% likely to have a medium risk anomaly

Notes: The code is a legitimate Windows registry query and filesystem readability utility, with no inherent malware or backdoors. Primary security concerns are data exposure through verbose logging and the potential misuse of reg.exe with untrusted inputs. Mitigations include restricting input sources, redacting sensitive outputs in logs, and ensuring callers handle registry data securely. Overall security risk is moderate due to sensitive operations and logging exposure, but no active malicious behavior detected.

Confidence: 1.00

Severity: 0.60

From: ?npm/@lavamoat/allow-scripts@3.4.3npm/ts-jest@29.4.11npm/@vercel/ncc@0.36.1npm/jest@29.7.0npm/node-gyp@12.4.0

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/node-gyp@12.4.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Low
Potential code anomaly (AI signal): npm resolve is 100.0% likely to have a medium risk anomaly

Notes: This manifest uses a non-registry, relative-path dependency ('resolve': '../../../') which is a significant supply-chain risk because it allows arbitrary local code to be pulled in and executed without registry protections. Combined with the 'lerna bootstrap' postinstall script (which can trigger other lifecycle scripts across the monorepo), this setup increases the chance of untrusted code execution and other malicious behavior. Inspect the target of the relative path, all bootstrap-linked packages, and any lifecycle scripts before running npm install in an untrusted environment.

Confidence: 1.00

Severity: 0.60

From: ?npm/@lavamoat/allow-scripts@3.4.3npm/eslint-plugin-node@11.1.0npm/jest@29.7.0npm/eslint-plugin-import@2.23.3npm/resolve@1.22.10

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/resolve@1.22.10. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Low
Potential code anomaly (AI signal): npm signal-exit is 100.0% likely to have a medium risk anomaly

Notes: The code represents a legitimate signal-exit instrumentation module intended to provide robust exit handling and lifecycle hooks. It does not introduce executable malware or data exfiltration in this fragment. However, it significantly alters process termination behavior and could cause compatibility issues or subtle bugs if used alongside other exit-handling code in extensions. Overall, this is a non-malicious yet potentially risky integration point that should be reviewed for compatibility with other modules in the extension.

Confidence: 1.00

Severity: 0.60

From: ?npm/@lavamoat/allow-scripts@3.4.3npm/signal-exit@4.1.0

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/signal-exit@4.1.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Low
Potential code anomaly (AI signal): npm tar is 100.0% likely to have a medium risk anomaly

Notes: This module acts as a standard tar extraction wrapper using synchronous and asynchronous code paths. There is no evident malicious activity within this fragment. Security risk hinges on the behavior of the Unpack/UnpackSync implementation and how tar entries are written to disk (e.g., path traversal). No hardcoded secrets or network calls are present here. Recommend ensuring tar extraction handles path traversal and destination path sanitization in Unpack, and consider validating opt.file presence and type before streaming.

Confidence: 1.00

Severity: 0.60

From: ?npm/@lavamoat/allow-scripts@3.4.3npm/ts-jest@29.4.11npm/@vercel/ncc@0.36.1npm/jest@29.7.0npm/tar@7.5.16

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/tar@7.5.16. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Ignoring alerts on:

  • read-cmd-shim@4.0.0
  • undici@6.26.0
  • glob@13.0.6
  • write-file-atomic@5.0.1
  • npm-normalize-package-bin@3.0.1
  • lru-cache@11.5.1

View full report

@Mrtenz

Mrtenz commented Jun 12, 2026

Copy link
Copy Markdown
Member Author

@SocketSecurity ignore npm/glob@13.0.6
@SocketSecurity ignore npm/lru-cache@11.5.1

False positive.

@SocketSecurity ignore npm/undici@6.26.0

Network access expected.

@SocketSecurity ignore npm/npm-normalize-package-bin@3.0.1
@SocketSecurity ignore npm/read-cmd-shim@4.0.0
@SocketSecurity ignore npm/write-file-atomic@5.0.1

New author is ok.

@Mrtenz Mrtenz marked this pull request as ready for review June 12, 2026 18:10
@Mrtenz Mrtenz requested a review from a team as a code owner June 12, 2026 18:10
@Mrtenz Mrtenz merged commit 0cab3d5 into main Jun 12, 2026
8 checks passed
@Mrtenz Mrtenz deleted the mrtenz/upgrade-yarn-4 branch June 12, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants