1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

Patch signature controller to catch message promise (#19927)

This commit is contained in:
Matthew Walsh 2023-07-07 17:01:21 +01:00 committed by Dan J Miller
parent f31702653e
commit 779609de8d
3 changed files with 39 additions and 2 deletions

View File

@ -0,0 +1,17 @@
diff --git a/dist/SignatureController.js b/dist/SignatureController.js
index b58b27e84aa84393afb366d4585c084d0380d21d..0629bcf517db744ccfa40e4d7d8f2829fa95559e 100644
--- a/dist/SignatureController.js
+++ b/dist/SignatureController.js
@@ -237,8 +237,11 @@ _SignatureController_keyringController = new WeakMap(), _SignatureController_isE
yield __classPrivateFieldGet(this, _SignatureController_instances, "m", _SignatureController_requestApproval).call(this, messageParamsWithId, approvalType);
}
catch (error) {
+ signaturePromise.catch(() => {
+ // Expecting reject error but throwing manually rather than waiting
+ });
__classPrivateFieldGet(this, _SignatureController_instances, "m", _SignatureController_cancelAbstractMessage).call(this, messageManager, messageId);
- throw eth_rpc_errors_1.ethErrors.provider.userRejectedRequest('User rejected the request.');
+ throw eth_rpc_errors_1.ethErrors.provider.userRejectedRequest(`MetaMask ${messageName} Signature: User denied message signature.`);
}
yield signMessage(messageParamsWithId, version, signingOpts);
return signaturePromise;

View File

@ -196,7 +196,8 @@
"fast-json-patch@^3.1.1": "patch:fast-json-patch@npm%3A3.1.1#./.yarn/patches/fast-json-patch-npm-3.1.1-7e8bb70a45.patch",
"request@^2.83.0": "patch:request@npm%3A2.88.2#./.yarn/patches/request-npm-2.88.2-f4a57c72c4.patch",
"request@^2.88.2": "patch:request@npm%3A2.88.2#./.yarn/patches/request-npm-2.88.2-f4a57c72c4.patch",
"request@^2.85.0": "patch:request@npm%3A2.88.2#./.yarn/patches/request-npm-2.88.2-f4a57c72c4.patch"
"request@^2.85.0": "patch:request@npm%3A2.88.2#./.yarn/patches/request-npm-2.88.2-f4a57c72c4.patch",
"@metamask/signature-controller@^4.0.1": "patch:@metamask/signature-controller@npm%3A4.0.1#./.yarn/patches/@metamask-signature-controller-npm-4.0.1-013e64c9fd.patch"
},
"dependencies": {
"@actions/core": "^1.10.0",

View File

@ -4683,7 +4683,7 @@ __metadata:
languageName: node
linkType: hard
"@metamask/signature-controller@npm:^4.0.1":
"@metamask/signature-controller@npm:4.0.1":
version: 4.0.1
resolution: "@metamask/signature-controller@npm:4.0.1"
dependencies:
@ -4702,6 +4702,25 @@ __metadata:
languageName: node
linkType: hard
"@metamask/signature-controller@patch:@metamask/signature-controller@npm%3A4.0.1#./.yarn/patches/@metamask-signature-controller-npm-4.0.1-013e64c9fd.patch::locator=metamask-crx%40workspace%3A.":
version: 4.0.1
resolution: "@metamask/signature-controller@patch:@metamask/signature-controller@npm%3A4.0.1#./.yarn/patches/@metamask-signature-controller-npm-4.0.1-013e64c9fd.patch::version=4.0.1&hash=7f339b&locator=metamask-crx%40workspace%3A."
dependencies:
"@metamask/approval-controller": ^3.3.0
"@metamask/base-controller": ^3.0.0
"@metamask/controller-utils": ^4.0.0
"@metamask/message-manager": ^7.0.0
"@metamask/utils": ^5.0.2
eth-rpc-errors: ^4.0.2
ethereumjs-util: ^7.0.10
immer: ^9.0.6
lodash: ^4.17.21
peerDependencies:
"@metamask/approval-controller": ^3.3.0
checksum: d678cf1763cfe9e13c0e5d357fcc44bd4580efc44a6fdca61ba6eed059c47c780fafaf08a075466a4886fbb9c6332544752bf7d25d515a37213c800cfc181665
languageName: node
linkType: hard
"@metamask/slip44@npm:^3.0.0":
version: 3.0.0
resolution: "@metamask/slip44@npm:3.0.0"