From af43b7d6c97e10018e564ce8ee37bc9ad380234c Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Wed, 10 Oct 2018 16:11:17 -0230 Subject: Ensure that new transactions added are using the selected address --- app/scripts/controllers/transactions/index.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/scripts/controllers') diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index ebd49f882..a57c85f50 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -166,6 +166,10 @@ class TransactionController extends EventEmitter { async addUnapprovedTransaction (txParams) { // validate const normalizedTxParams = txUtils.normalizeTxParams(txParams) + // Assert the from address is the selected address + if (normalizedTxParams.from !== this.getSelectedAddress()) { + throw new Error(`Transaction from address isn't valid for this account`) + } txUtils.validateTxParams(normalizedTxParams) // construct txMeta let txMeta = this.txStateManager.generateTxMeta({ -- cgit v1.2.3