-
Notifications
You must be signed in to change notification settings - Fork 23
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
fix: security report fix #206
Conversation
types/cross_chain.go
Outdated
@@ -94,6 +94,9 @@ func EncodePackageHeader(header PackageHeader) []byte { | |||
copy(packageHeader[PackageTypeLength:PackageTypeLength+TimestampLength], timestampBytes) | |||
|
|||
relayerFeeLength := len(header.RelayerFee.Bytes()) | |||
if relayerFeeLength > 32 { |
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.
Please remove this.
It is ok if PackageHeader
is wrong, as the protocol will handle this.
x/authz/migrations/v2/keys.go
Outdated
@@ -61,12 +61,13 @@ func ParseGrantKey(key []byte) (granterAddr, granteeAddr sdk.AccAddress, msgType | |||
// key is of format: | |||
// <granterAddressLen (1 Byte)><granterAddress_Bytes><granteeAddressLen (1 Byte)><granteeAddress_Bytes><msgType_Bytes> | |||
kv.AssertKeyAtLeastLength(key, 2) | |||
granterAddrLen := key[0] | |||
// prevent granterAddrLen overflow |
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.
Please dont change this, as we did not use this, let us keep consistent with cosmos-sdk.
x/group/internal/orm/key_codec.go
Outdated
@@ -82,6 +82,9 @@ func stripRowID(indexKey []byte, secondaryIndexKey interface{}) (RowID, error) { | |||
switch v := secondaryIndexKey.(type) { | |||
case []byte: | |||
searchableKeyLen := indexKey[0] | |||
if 1+int(searchableKeyLen) > len(indexKey) { |
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.
Please dont change this as we dont use it.
x/staking/migrations/v1/types.go
Outdated
@@ -219,12 +219,22 @@ func ParseValidatorQueueKey(bz []byte) (time.Time, int64, error) { | |||
return time.Time{}, 0, fmt.Errorf("invalid prefix; expected: %X, got: %X", ValidatorQueueKey, prefix) | |||
} | |||
|
|||
if prefixL+8 > len(bz) { | |||
return time.Time{}, 0, fmt.Errorf("timeBzl is out of bounds") |
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.
We dont use this, so no need to change it.
x/staking/types/keys.go
Outdated
@@ -221,11 +221,18 @@ func ParseValidatorQueueKey(bz []byte) (time.Time, int64, error) { | |||
} | |||
|
|||
timeBzL := sdk.BigEndianToUint64(bz[prefixL : prefixL+8]) | |||
if prefixL+8+int(timeBzL) > len(bz) { | |||
return time.Time{}, 0, fmt.Errorf("ts is out of bounds") |
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.
So is here.
Description
implemented changes according to the feedback in the security report
Rationale
issues such as overflow errors were raised
Example
none
Changes
please refer to the security report and the changed files