Skip to content

Commit 1b0fd13

Browse files
cryptodev-2sGudahttmetamaskbot
authored
chore: Upgrade fast-xml-parser to 5.3.4 (GHSA-37qj-frw5-hhjh) (#39683)
<!-- 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** **Reason:** fast-xml-parser 4.x (pulled in by @metamask/snaps-utils) is vulnerable to a RangeError DoS (GHSA-37qj-frw5-hhjh). [`fast-xml-parser` Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md) The only breaking change in v5 is the ESM support **Solution:** Add a resolution to fast-xml-parser ^5.3.4 and add it to `npmPreapprovedPackages` so the safe version can be installed despite the minimal age gate. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/39683?quickstart=1) ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: ## **Manual testing steps** ## **Screenshots/Recordings** N/A (dependency upgrade). ### **Before** ### **After** ## **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] > **Medium Risk** > Dependency upgrade plus LavaMoat policy updates could cause runtime/build regressions if `@metamask/snaps-utils` expects v4 behavior or if the new globals aren’t correctly captured. > > **Overview** > **Upgrades `fast-xml-parser` to `^5.3.4` via `package.json` resolutions** (and updates `yarn.lock`, including `strnum` to `^2.1.0`) to address GHSA-37qj-frw5-hhjh. > > **Refreshes LavaMoat policies**: removes the `@metamask/snaps-utils>fast-xml-parser` allowlist entry from Browserify policies, and updates Webpack MV2 policies to allow the new `fast-xml-parser` access pattern (`exports.isExist`) instead of the old `entityName`/`val` globals. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 57261b8. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Mark Stacey <[email protected]> Co-authored-by: MetaMask Bot <[email protected]>
1 parent 9a95ccb commit 1b0fd13

File tree

10 files changed

+15
-54
lines changed

10 files changed

+15
-54
lines changed

lavamoat/browserify/beta/policy.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4274,15 +4274,6 @@
42744274
"setTimeout": true
42754275
}
42764276
},
4277-
"@metamask/snaps-utils>fast-xml-parser": {
4278-
"globals": {
4279-
"entityName": true,
4280-
"val": true
4281-
},
4282-
"packages": {
4283-
"@metamask/snaps-utils>fast-xml-parser>strnum": true
4284-
}
4285-
},
42864277
"@metamask/notification-services-controller>firebase": {
42874278
"packages": {
42884279
"@metamask/notification-services-controller>firebase>@firebase/app": true,

lavamoat/browserify/experimental/policy.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4274,15 +4274,6 @@
42744274
"setTimeout": true
42754275
}
42764276
},
4277-
"@metamask/snaps-utils>fast-xml-parser": {
4278-
"globals": {
4279-
"entityName": true,
4280-
"val": true
4281-
},
4282-
"packages": {
4283-
"@metamask/snaps-utils>fast-xml-parser>strnum": true
4284-
}
4285-
},
42864277
"@metamask/notification-services-controller>firebase": {
42874278
"packages": {
42884279
"@metamask/notification-services-controller>firebase>@firebase/app": true,

lavamoat/browserify/flask/policy.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4274,15 +4274,6 @@
42744274
"setTimeout": true
42754275
}
42764276
},
4277-
"@metamask/snaps-utils>fast-xml-parser": {
4278-
"globals": {
4279-
"entityName": true,
4280-
"val": true
4281-
},
4282-
"packages": {
4283-
"@metamask/snaps-utils>fast-xml-parser>strnum": true
4284-
}
4285-
},
42864277
"@metamask/notification-services-controller>firebase": {
42874278
"packages": {
42884279
"@metamask/notification-services-controller>firebase>@firebase/app": true,

lavamoat/browserify/main/policy.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4274,15 +4274,6 @@
42744274
"setTimeout": true
42754275
}
42764276
},
4277-
"@metamask/snaps-utils>fast-xml-parser": {
4278-
"globals": {
4279-
"entityName": true,
4280-
"val": true
4281-
},
4282-
"packages": {
4283-
"@metamask/snaps-utils>fast-xml-parser>strnum": true
4284-
}
4285-
},
42864277
"@metamask/notification-services-controller>firebase": {
42874278
"packages": {
42884279
"@metamask/notification-services-controller>firebase>@firebase/app": true,

lavamoat/webpack/mv2/beta/policy.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4337,8 +4337,7 @@
43374337
},
43384338
"@metamask/snaps-utils>fast-xml-parser": {
43394339
"globals": {
4340-
"entityName": true,
4341-
"val": true
4340+
"exports.isExist": true
43424341
},
43434342
"packages": {
43444343
"@metamask/snaps-utils>fast-xml-parser>strnum": true

lavamoat/webpack/mv2/experimental/policy.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4337,8 +4337,7 @@
43374337
},
43384338
"@metamask/snaps-utils>fast-xml-parser": {
43394339
"globals": {
4340-
"entityName": true,
4341-
"val": true
4340+
"exports.isExist": true
43424341
},
43434342
"packages": {
43444343
"@metamask/snaps-utils>fast-xml-parser>strnum": true

lavamoat/webpack/mv2/flask/policy.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4337,8 +4337,7 @@
43374337
},
43384338
"@metamask/snaps-utils>fast-xml-parser": {
43394339
"globals": {
4340-
"entityName": true,
4341-
"val": true
4340+
"exports.isExist": true
43424341
},
43434342
"packages": {
43444343
"@metamask/snaps-utils>fast-xml-parser>strnum": true

lavamoat/webpack/mv2/main/policy.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4337,8 +4337,7 @@
43374337
},
43384338
"@metamask/snaps-utils>fast-xml-parser": {
43394339
"globals": {
4340-
"entityName": true,
4341-
"val": true
4340+
"exports.isExist": true
43424341
},
43434342
"packages": {
43444343
"@metamask/snaps-utils>fast-xml-parser>strnum": true

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@
269269
"which@npm:^1.2.14": "^4.0.0",
270270
"which@npm:^1.3.1": "^4.0.0",
271271
"qs@npm:6.13.0": "^6.14.1",
272-
"@metamask/bridge-status-controller": "64.3.0"
272+
"@metamask/bridge-status-controller": "64.3.0",
273+
"fast-xml-parser": "^5.3.4"
273274
},
274275
"dependencies": {
275276
"@babel/runtime": "patch:@babel/runtime@npm%3A7.26.10#~/.yarn/patches/@babel-runtime-npm-7.26.10-fe8c62510a.patch",

yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26326,14 +26326,14 @@ __metadata:
2632626326
languageName: node
2632726327
linkType: hard
2632826328

26329-
"fast-xml-parser@npm:^4.4.1":
26330-
version: 4.4.1
26331-
resolution: "fast-xml-parser@npm:4.4.1"
26329+
"fast-xml-parser@npm:^5.3.4":
26330+
version: 5.3.4
26331+
resolution: "fast-xml-parser@npm:5.3.4"
2633226332
dependencies:
26333-
strnum: "npm:^1.0.5"
26333+
strnum: "npm:^2.1.0"
2633426334
bin:
2633526335
fxparser: src/cli/cli.js
26336-
checksum: 10/0c05ab8703630d8c857fafadbd78d0020d3a8e54310c3842179cd4a0d9d97e96d209ce885e91241f4aa9dd8dfc2fd924a682741a423d65153cad34da2032ec44
26336+
checksum: 10/0d7e6872fed7c3065641400d43cdf24c03177f05c343bfb31df53b79f0900b085c103f647852d0b00693125aa3f0e9d8b8cfc4273b168d4da0308f857dafe830
2633726337
languageName: node
2633826338
linkType: hard
2633926339

@@ -42122,10 +42122,10 @@ __metadata:
4212242122
languageName: node
4212342123
linkType: hard
4212442124

42125-
"strnum@npm:^1.0.5":
42126-
version: 1.0.5
42127-
resolution: "strnum@npm:1.0.5"
42128-
checksum: 10/d3117975db8372d4d7b2c07601ed2f65bf21cc48d741f37a8617b76370d228f2ec26336e53791ebc3638264d23ca54e6c241f57f8c69bd4941c63c79440525ca
42125+
"strnum@npm:^2.1.0":
42126+
version: 2.1.2
42127+
resolution: "strnum@npm:2.1.2"
42128+
checksum: 10/7d894dff385e3a5c5b29c012cf0a7ea7962a92c6a299383c3d6db945ad2b6f3e770511356a9774dbd54444c56af1dc7c435dad6466c47293c48173274dd6c631
4212942129
languageName: node
4213042130
linkType: hard
4213142131

0 commit comments

Comments
 (0)