Allow mixed case hex when validating erc20 token addresses#8127
Allow mixed case hex when validating erc20 token addresses#8127jeffsmale90 wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| const startTime = hexToNumber(startTimeRaw); | ||
|
|
||
| if (!isHexAddress(tokenAddress)) { | ||
| if (!isHexChecksumAddress(tokenAddress)) { |
There was a problem hiding this comment.
Checksum validation rejects valid lowercase token addresses
High Severity
Replacing isHexAddress with isHexChecksumAddress will reject valid lowercase token addresses. EIP-55 checksum validation requires a specific mixed-case pattern derived from the keccak256 hash — it does not simply "allow mixed case." All-lowercase addresses like 0xcccccccccccccccccccccccccccccccccccccccc (used in the existing unchanged "successfully decodes" test) are not valid EIP-55 checksum addresses and will now be rejected, breaking existing functionality. The splitHex utility preserves the original casing from encoded terms, so lowercase-encoded addresses will fail this stricter check.


Explanation
Previously we used the
isHexAddressfunction to validate the erc20 token address. This function expects the input value to be in lowercase hex.Now this uses
isHexChecksumAddresswhich ensures a 20byte hex value, but allows mixed case.References
Checklist
Note
Medium Risk
Updates token address validation for ERC20 stream/periodic permission decoding, which can change which permissions are accepted as valid. Risk is limited to input validation logic but affects permission gating behavior.
Overview
ERC20 stream and periodic permission decoding now accepts mixed-case token addresses. The
erc20-token-streamanderc20-token-periodicrules switch address validation fromisHexAddresstoisHexChecksumAddress, relaxing the prior lowercase-only requirement while still enforcing a 20-byte hex address.Tests are extended in both rule suites to assert successful decoding when the
tokenAddressin terms is mixed-case (case-insensitive match on decoded output).Written by Cursor Bugbot for commit b2107ce. This will update automatically on new commits. Configure here.