-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Add address length validation to MsgSend and MsgMultiSend #7053
Add address length validation to MsgSend and MsgMultiSend #7053
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7053 +/- ##
=======================================
Coverage 54.68% 54.68%
=======================================
Files 540 540
Lines 36856 36856
=======================================
Hits 20153 20153
Misses 15060 15060
Partials 1643 1643 |
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.
Nice fix and welcome to go 👍
Amazing how many test cases were misusing this as well.
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!! Amazing to see happy path testing become stricter. I wonder if this is present in other modules as well??!!?!
Note: In the current usage of pubkey Address()
is expecting a pubkey length otherwise it will panic. I have a feeling .Address()
is called on pubkeys without checking to see if they are valid which will cause a node panic. I would not be surprised if someone could induce a node panic via a incorrect pubkey size!!!!
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.
Good one!!! Thanks
you're welcome, Ethan, Marko, Jonathan
I would be surprised if not. MsgSend was the first place where the client hit the issue and so I looked into bank. If someone want to check the other modules and to the same thing there, I'd appreciate if the SDK team manages that in a separate ticket. |
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.
🎉
Thanks, @webmaster128. Please update/rebase this PR and it should automatically merge. |
d419e7e
to
331f0d1
Compare
@alexanderbez rebased but automerge does not work |
@webmaster128 it's out of sync with |
@alessio thank you, I updated it again. But it is already out of sync again. Can you please take care of it one way or another? I enabled Allow edits and access to secrets by maintainers now. Hope that helps. |
Description
Since the protobuf transition, user input for AccAddress is casted instead of decoded from bech32. So a validation step that existed before does not exist anymore. As a consequence, a user can put any binary data into the system which can have unintended effects. From the client's perspective this leads to error messages at some point in signature verification instead of message validation.
I see basically two path to this:
Given that AccAddress is an alias, 2. would probably not be feasible (correct me if I'm wrong). This PR implements 1. for x/bank messages.
closes: #7015
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes