From 746210a64a4a28e74c7e9a35d7d90155cb7318d9 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 1 Feb 2021 11:36:33 -0800 Subject: [PATCH] Reject eth_getEncryptionPublicKey for ledger hw wallets Fixes #10111 Determine if the msgParams/address for the newRequestEncryptionPublicKey is a ledger keyring via getKeyringForAccount and return a promise rejection. --- app/scripts/metamask-controller.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index ad648382194c..a61a40ed0093 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -1643,6 +1643,13 @@ export default class MetamaskController extends EventEmitter { * Passed back to the requesting Dapp. */ async newRequestEncryptionPublicKey(msgParams, req) { + const address = msgParams + const keyring = await this.keyringController.getKeyringForAccount(address) + if (keyring.type === 'Ledger Hardware') { + return new Promise((_, reject) => { + reject(new Error('Ledger does not support eth_getEncryptionPublicKey.')) + }) + } const promise = this.encryptionPublicKeyManager.addUnapprovedMessageAsync( msgParams, req,