Skip to content

Validate terms is Hex, rather than validating each erc20 token address individually#8127

Merged
jeffsmale90 merged 3 commits intomainfrom
fix/erc20-token-address-validation
Mar 8, 2026
Merged

Validate terms is Hex, rather than validating each erc20 token address individually#8127
jeffsmale90 merged 3 commits intomainfrom
fix/erc20-token-address-validation

Conversation

@jeffsmale90
Copy link
Contributor

@jeffsmale90 jeffsmale90 commented Mar 6, 2026

Explanation

Previously we used the isHexAddress function to validate the erc20 token address. This function expects the input value to be in lowercase hex.

Because we are splitting the address from the terms, now we just validate that the entire terms is valid Hex (using case-insensitive function) in the makePermissionRule function.

no-changelog because this is a fix to an unreleased change.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes shared permission decoding/validation by rejecting any non-hex terms upfront and removing per-rule tokenAddress hex checks; this can affect which permissions are accepted/rejected across all rules.

Overview
Moves hex validation to makePermissionRule by rejecting any caveat whose terms are not a strict hex string (while still allowing empty 0x), preventing downstream decoders from operating on malformed data.

Removes isHexAddress checks from the ERC20 stream/periodic decoders so mixed-case token addresses in terms are accepted, and updates tests to cover mixed-case addresses while dropping rule-specific “invalid token address characters” cases.

Written by Cursor Bugbot for commit 8e8f420. This will update automatically on new commits. Configure here.

@jeffsmale90 jeffsmale90 requested a review from a team as a code owner March 6, 2026 09:20
@jeffsmale90 jeffsmale90 enabled auto-merge March 6, 2026 09:20
@jeffsmale90 jeffsmale90 changed the title Allow mixed case hex when validating erc20 token addresses Validate terms is Hex, rather than validating each erc20 token address individually Mar 8, 2026
@jeffsmale90 jeffsmale90 force-pushed the fix/erc20-token-address-validation branch from 67bf364 to 2383c3a Compare March 8, 2026 19:55
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

- add test coverage of the above
@jeffsmale90 jeffsmale90 added this pull request to the merge queue Mar 8, 2026
Merged via the queue into main with commit 7ee3181 Mar 8, 2026
322 checks passed
@jeffsmale90 jeffsmale90 deleted the fix/erc20-token-address-validation branch March 8, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants