Skip to content

fix: improve Message class - #207

Merged
ItsANameToo merged 10 commits into
feat/mainsailfrom
fix/message-verify
Nov 5, 2026
Merged

ItsANameToo merged 10 commits into
feat/mainsailfrom
fix/message-verify

Conversation

@shahin-hq

@shahin-hq shahin-hq commented Nov 5, 2026 •

Copy link
Copy Markdown

Security issues fixed

  • Signatures were infinitely malleable. Only r/s were checked. Any v byte (00, 1d, zz), a missing v, or any trailing data still verified. So one valid signature had unlimited accepted string forms, which breaks any dedupe, replay or rate-limit check keyed on the signature string.
  • Malformed input crashed instead of failing. Non-hex or short signatures, bad public keys and invalid UTF-8 threw ValueError/TypeError. These are Errors, not Exceptions, so typical catch (Exception) blocks missed them and returned 500s. That's attacker-triggerable error noise. Verification now fails closed with false.
  • Validity depended on app-side checks. Correctness relied on each integrator adding its own regex. Moving that into the SDK removes the risk of an app forgetting it.

To be clear, no forgery was possible: r/s were always checked against the public key.

Compatibility fixes

  • 0x-prefixed signatures from ARK Vault and the TS SDK failed to verify.
  • v of 0/1, which ethers accepts, was rejected.
  • Verification now matches the TS SDK: recover the signer's address and compare.

Checklist

  • Documentation (if necessary)
  • Tests (if necessary)
  • Ready to be merged

@shahin-hq
shahin-hq marked this pull request as ready for review November 5, 2026 11:24
@ItsANameToo
ItsANameToo merged commit e0e4d85 into feat/mainsail Nov 5, 2026
2 checks passed
@ItsANameToo
ItsANameToo deleted the fix/message-verify branch November 5, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants