-
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
validate addresses in qr codes #9916
Conversation
Builds ready [9ae0c2f]
Page Load Metrics (420 ± 68 ms)
|
ui/app/pages/send/send.component.js
Outdated
updateSendTo(scannedAddress) | ||
updateGas = true | ||
// Clean up QR code data after handling | ||
const toError = getToErrorObject(scannedAddress, false, network) |
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.
Wow, that is an.... interesting method name and signature 😬. It does the trick though at least!
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.
Though actually, it does give a pretty strange error on testnets 🤔
Not ETH network, set to lowercase
seems inappropriate here
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.
It might be worth using isValidAddress
and INVALID_RECIPIENT_ADDRESS_ERROR
directly perhaps, instead of using that rather confusing helper function
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.
@Gudahtt -- I was following the pattern in the file and had it working before I realized how... wonky it was. 🤦♂️
9ae0c2f
to
7a6e82f
Compare
Builds ready [7a6e82f]
Page Load Metrics (404 ± 56 ms)
|
7a6e82f
to
ba51649
Compare
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!
Builds ready [ba51649]
Page Load Metrics (428 ± 71 ms)
|
Fixes: #9889
Explanation: We didn't do any validation of the to address, and this would incorrectly interpret ERC-20 token send encoded uris as being sent to the token address. This PR just checks the validity of the address.
Valid QR code (ethereum:xxxx)
Invalid QR code (ethereum:xxxx/transfer?address=xxxx&uint256=1) vis a vis eip-681
Manual testing steps: