-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent user from editing a contract interaction created by a dapp #16498
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -1158,11 +1158,13 @@ export default class ConfirmTransactionBase extends Component { | |||
} = this.getNavigateTxData(); | |||
|
|||
let functionType; | |||
let isContractInteractionFromDapp = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this a const
and set its value to:
const isContractInteractionFromDapp = txData.type === TRANSACTION_TYPES.CONTRACT_INTERACTION && txData.origin !== 'metamask';
...and use that for the if
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in 358dacb
I don't think this is accurate. Contract interactions in general were not editable prior to v10.21.0, but simple send transactions suggested by dapps were editable. Edit: Oh, but this PR still allows simple sends from dapps to be edited, sorry I missed that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
From QA looks good! |
Fixes problem introduced in #15812
As of that PR, it became possible for users to edit contract interact transactions. That is okay if the transaction originates from MetaMask, but not if the transaction originates from a dapp. Editing the recipient or the asset type can have unexpected consequences in that case, include allowing the user to transfer tokens to a smart contract address.
This PR prevents the user from editing contract interactions from a dapp. This was the way things were prior to v10.21.0
An e2e test is added to prevent such a regression in the future