-
-
Notifications
You must be signed in to change notification settings - Fork 188
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
keyring-controller: validate from-address in signTypedMessage #1293
Conversation
35b9b1d
to
4705ae4
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.
Looks good! Left just a small suggestion
@@ -461,6 +461,11 @@ export class KeyringController extends BaseController< | |||
) { | |||
try { | |||
const address = normalizeAddress(messageParams.from); | |||
if (!address?.length) { |
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.
Nit: maybe we can use isValidAddress
from ethereumjs-util
to be sure that what we get is an address
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.
Updated along with PR title.
cdf3025
to
8b42427
Compare
8b42427
to
67d33ef
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!
* keyring-controller: throw explicit error on undefined result from normalizeAddress * key-controller: validate sender address before attempting signature
* keyring-controller: throw explicit error on undefined result from normalizeAddress * key-controller: validate sender address before attempting signature
The
normalizeAddress
function is can returnundefined
even if the interface says otherwise.This adds explicit handling of that case in
keyring-controller
. Required for #1289 .