You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
crypto: LedgerShowAddress's public key comparison equality == instead of .Equals will soon result in unexpected results if we upgrade modules of tendermint/crypto
#6677
getPubKeyUnsafe returns an interface so that'll mask the problem until runtime where it'll panic.
Byte arrays have equality defined on them, but as soon as we upgrade to a new module, that type turns into a byte slice that'll panic, but will fail e.g. https://play.golang.org/p/sZdl964nL8b
Recommendation
Both versions have a defined .Equals method, we should use that and it'll guard against that sensitivity for any interfaces
During an audit, I noticed that the code for LedgerShowAddress compares PubKeySecp256k1 values by equality i.e.
cosmos-sdk/crypto/ledger_secp256k1.go
Lines 118 to 120 in 6ceedc9
and given that we are at go module github.com/tendermint/[email protected], the type of PubKeySecp256k1 is a BYTE ARRAY aka
[SIZE]byte
.getPubKeyUnsafe returns an interface so that'll mask the problem until runtime where it'll panic.
Byte arrays have equality defined on them, but as soon as we upgrade to a new module, that type turns into a byte slice that'll panic, but will fail e.g.
https://play.golang.org/p/sZdl964nL8b
Recommendation
Both versions have a defined .Equals method, we should use that and it'll guard against that sensitivity for any interfaces
The text was updated successfully, but these errors were encountered: