Skip to content

Commit

Permalink
fix(snaps): Patch @metamask/snaps-utils (#28377)
Browse files Browse the repository at this point in the history
## **Description**

This PR patches the `@metamask/snaps-utils` package after
MetaMask/snaps#2876.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28377?quickstart=1)

## **Related issues**

## **Manual testing steps**

## **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/develop/.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/develop/.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.
  • Loading branch information
GuillaumeRx authored Nov 11, 2024
1 parent 54588f9 commit d876ccb
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 22 deletions.
26 changes: 26 additions & 0 deletions .yarn/patches/@metamask-snaps-utils-npm-8.4.1-90481bac4b.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/dist/json-rpc.cjs b/dist/json-rpc.cjs
index 6061f7b8b42f0521b0718d616e5a12a1a7520068..11d0233a7bd4b610a99da6a3d105840e88e108e6 100644
--- a/dist/json-rpc.cjs
+++ b/dist/json-rpc.cjs
@@ -68,7 +68,7 @@ function createOriginRegExp(matcher) {
const escaped = matcher.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
// Support wildcards
const regex = escaped.replace(/\\\*/gu, '.*');
- return RegExp(`${regex}$`, 'u');
+ return RegExp(`^${regex}$`, 'u');
}
/**
* Check whether an origin is allowed or not using a matcher string.
diff --git a/dist/json-rpc.mjs b/dist/json-rpc.mjs
index bfa1c2dbbed46a2221ef708afdb97b15db84bc1b..81bc2150cf5d6a9bdabe8d43b04352b299bc1c4d 100644
--- a/dist/json-rpc.mjs
+++ b/dist/json-rpc.mjs
@@ -63,7 +63,7 @@ function createOriginRegExp(matcher) {
const escaped = matcher.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
// Support wildcards
const regex = escaped.replace(/\\\*/gu, '.*');
- return RegExp(`${regex}$`, 'u');
+ return RegExp(`^${regex}$`, 'u');
}
/**
* Check whether an origin is allowed or not using a matcher string.
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,12 @@
"@metamask/network-controller@npm:^17.0.0": "patch:@metamask/network-controller@npm%3A21.0.0#~/.yarn/patches/@metamask-network-controller-npm-21.0.0-559aa8e395.patch",
"@metamask/network-controller@npm:^19.0.0": "patch:@metamask/network-controller@npm%3A21.0.0#~/.yarn/patches/@metamask-network-controller-npm-21.0.0-559aa8e395.patch",
"@metamask/network-controller@npm:^20.0.0": "patch:@metamask/network-controller@npm%3A21.0.0#~/.yarn/patches/@metamask-network-controller-npm-21.0.0-559aa8e395.patch",
"path-to-regexp": "1.9.0"
"path-to-regexp": "1.9.0",
"@metamask/snaps-utils@npm:^8.4.1": "patch:@metamask/snaps-utils@npm%3A8.4.1#~/.yarn/patches/@metamask-snaps-utils-npm-8.4.1-90481bac4b.patch",
"@metamask/snaps-utils@npm:^8.3.0": "patch:@metamask/snaps-utils@npm%3A8.4.1#~/.yarn/patches/@metamask-snaps-utils-npm-8.4.1-90481bac4b.patch",
"@metamask/snaps-utils@npm:^8.1.1": "patch:@metamask/snaps-utils@npm%3A8.4.1#~/.yarn/patches/@metamask-snaps-utils-npm-8.4.1-90481bac4b.patch",
"@metamask/snaps-utils@npm:^8.4.0": "patch:@metamask/snaps-utils@npm%3A8.4.1#~/.yarn/patches/@metamask-snaps-utils-npm-8.4.1-90481bac4b.patch",
"@metamask/snaps-utils@npm:^7.4.0": "patch:@metamask/snaps-utils@npm%3A8.4.1#~/.yarn/patches/@metamask-snaps-utils-npm-8.4.1-90481bac4b.patch"
},
"dependencies": {
"@babel/runtime": "patch:@babel/runtime@npm%3A7.25.9#~/.yarn/patches/@babel-runtime-npm-7.25.9-fe8c62510a.patch",
Expand Down Expand Up @@ -345,7 +350,7 @@
"@metamask/snaps-execution-environments": "^6.9.1",
"@metamask/snaps-rpc-methods": "^11.5.0",
"@metamask/snaps-sdk": "^6.9.0",
"@metamask/snaps-utils": "^8.4.1",
"@metamask/snaps-utils": "patch:@metamask/snaps-utils@npm%3A8.4.1#~/.yarn/patches/@metamask-snaps-utils-npm-8.4.1-90481bac4b.patch",
"@metamask/transaction-controller": "^38.3.0",
"@metamask/user-operation-controller": "^13.0.0",
"@metamask/utils": "^9.3.0",
Expand Down
33 changes: 13 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6152,13 +6152,6 @@ __metadata:
languageName: node
linkType: hard

"@metamask/slip44@npm:^3.1.0":
version: 3.1.0
resolution: "@metamask/slip44@npm:3.1.0"
checksum: 10/83f902c455468f1ec252d0554cd4ebf8da1fc9a27ec7199b81e265e5e8710fad86eaa71d86f24500f9db6626007ad71b1380b239e2104e7e558a061393b066fa
languageName: node
linkType: hard

"@metamask/slip44@npm:^4.0.0":
version: 4.0.0
resolution: "@metamask/slip44@npm:4.0.0"
Expand Down Expand Up @@ -6286,40 +6279,40 @@ __metadata:
languageName: node
linkType: hard

"@metamask/snaps-utils@npm:^7.4.0":
version: 7.8.1
resolution: "@metamask/snaps-utils@npm:7.8.1"
"@metamask/snaps-utils@npm:8.4.1":
version: 8.4.1
resolution: "@metamask/snaps-utils@npm:8.4.1"
dependencies:
"@babel/core": "npm:^7.23.2"
"@babel/types": "npm:^7.23.0"
"@metamask/base-controller": "npm:^6.0.2"
"@metamask/key-tree": "npm:^9.1.2"
"@metamask/permission-controller": "npm:^11.0.0"
"@metamask/rpc-errors": "npm:^6.3.1"
"@metamask/slip44": "npm:^3.1.0"
"@metamask/slip44": "npm:^4.0.0"
"@metamask/snaps-registry": "npm:^3.2.1"
"@metamask/snaps-sdk": "npm:^6.1.0"
"@metamask/snaps-sdk": "npm:^6.9.0"
"@metamask/superstruct": "npm:^3.1.0"
"@metamask/utils": "npm:^9.1.0"
"@metamask/utils": "npm:^9.2.1"
"@noble/hashes": "npm:^1.3.1"
"@scure/base": "npm:^1.1.1"
chalk: "npm:^4.1.2"
cron-parser: "npm:^4.5.0"
fast-deep-equal: "npm:^3.1.3"
fast-json-stable-stringify: "npm:^2.1.0"
fast-xml-parser: "npm:^4.3.4"
fast-xml-parser: "npm:^4.4.1"
marked: "npm:^12.0.1"
rfdc: "npm:^1.3.0"
semver: "npm:^7.5.4"
ses: "npm:^1.1.0"
validate-npm-package-name: "npm:^5.0.0"
checksum: 10/572108aafbad970910ffb3605cf9eb4675ede0d69ff2bd37515da7f071de2065a55c73d6dc44dbe70bbd9c3ff0dfe29d40fd16badd925a4b8504db293265ca2f
checksum: 10/c68a2fe69dc835c2b996d621fd4698435475d419a85aa557aa000aae0ab7ebb68d2a52f0b28bbab94fff895ece9a94077e3910a21b16d904cff3b9419ca575b6
languageName: node
linkType: hard

"@metamask/snaps-utils@npm:^8.1.1, @metamask/snaps-utils@npm:^8.3.0, @metamask/snaps-utils@npm:^8.4.0, @metamask/snaps-utils@npm:^8.4.1":
"@metamask/snaps-utils@patch:@metamask/snaps-utils@npm%3A8.4.1#~/.yarn/patches/@metamask-snaps-utils-npm-8.4.1-90481bac4b.patch":
version: 8.4.1
resolution: "@metamask/snaps-utils@npm:8.4.1"
resolution: "@metamask/snaps-utils@patch:@metamask/snaps-utils@npm%3A8.4.1#~/.yarn/patches/@metamask-snaps-utils-npm-8.4.1-90481bac4b.patch::version=8.4.1&hash=421c26"
dependencies:
"@babel/core": "npm:^7.23.2"
"@babel/types": "npm:^7.23.0"
Expand All @@ -6344,7 +6337,7 @@ __metadata:
semver: "npm:^7.5.4"
ses: "npm:^1.1.0"
validate-npm-package-name: "npm:^5.0.0"
checksum: 10/c68a2fe69dc835c2b996d621fd4698435475d419a85aa557aa000aae0ab7ebb68d2a52f0b28bbab94fff895ece9a94077e3910a21b16d904cff3b9419ca575b6
checksum: 10/cc1e10898c81361283aef46d48197177346f17febd8b005d486a9988c6a636ddf5369f7ccc8c22466091daf60fe8e1a8f6fc5790229efc15e8b4449f33a4d214
languageName: node
linkType: hard

Expand Down Expand Up @@ -19333,7 +19326,7 @@ __metadata:
languageName: node
linkType: hard

"fast-xml-parser@npm:^4.3.4, fast-xml-parser@npm:^4.4.1":
"fast-xml-parser@npm:^4.4.1":
version: 4.4.1
resolution: "fast-xml-parser@npm:4.4.1"
dependencies:
Expand Down Expand Up @@ -26467,7 +26460,7 @@ __metadata:
"@metamask/snaps-execution-environments": "npm:^6.9.1"
"@metamask/snaps-rpc-methods": "npm:^11.5.0"
"@metamask/snaps-sdk": "npm:^6.9.0"
"@metamask/snaps-utils": "npm:^8.4.1"
"@metamask/snaps-utils": "patch:@metamask/snaps-utils@npm%3A8.4.1#~/.yarn/patches/@metamask-snaps-utils-npm-8.4.1-90481bac4b.patch"
"@metamask/test-bundler": "npm:^1.0.0"
"@metamask/test-dapp": "npm:8.7.0"
"@metamask/transaction-controller": "npm:^38.3.0"
Expand Down

0 comments on commit d876ccb

Please sign in to comment.