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
{{ message }}
Repository navigation
[BUG] assertValidPublicKey() utility accepts a valid-looking StrKey that actually decodes to a muxed account or contract address, when only a plain account address is expected #802
The validator checks that a string decodes successfully via StrKey but doesn't check which StrKey version byte it decoded as, so a muxed-account address (M...) or a contract address (C...) passes validation in contexts that specifically expect a plain G... account address.
Component
utils
Steps to Reproduce
Call assertValidPublicKey('M...') (a valid muxed address) where a plain account address is required by the calling context.
Observe it passing validation.
Trace what happens downstream when code written for plain G... addresses receives a muxed one instead.
Expected Behavior
The validator should accept an explicit expected-type parameter (or there should be separate validators per StrKey type) rather than one generic 'decodes successfully' check.
Actual Behavior
Code paths expecting a plain account address can receive a structurally-different muxed or contract address that happens to pass the too-permissive validator, risking confusing downstream behavior.
Environment
SDK version: 0.3.x
Node version: 20.x, 22.x
OS: macOS / Linux
Network: TESTNET
Code Example
assertValidPublicKey('MA7QIKTEY...');// passes, even where only G... addresses are valid
Error Output
N/A — no thrown error; behavior is incorrect but silent.
Difficulty
🟡 Medium
Additional Context
The validator calls the generic StrKey.isValidEd25519PublicKey OR a catch-all decode check without being specific to the single expected address type per call site.
I looked into the details for "[BUG] assertValidPublicKey() utility accepts a valid-looking StrKey that actually decodes to a muxed account or contract address, when only a plain account address is expected" and would like to contribute the fix.
I have reviewed the problem description and acceptance criteria for this issue. I have a clear, tested implementation ready with defensive error handling and 100% green CI proof.
I will deliver a clean, well-tested, and production-ready PR promptly upon assignment. Kindly assign this issue to me.
Activity
shobhamerabacha-star commentedon Oct 29, 2026
Greetings,
I looked into the details for "[BUG] assertValidPublicKey() utility accepts a valid-looking StrKey that actually decodes to a muxed account or contract address, when only a plain account address is expected" and would like to contribute the fix.
I have reviewed the problem description and acceptance criteria for this issue. I have a clear, tested implementation ready with defensive error handling and 100% green CI proof.
I will deliver a clean, well-tested, and production-ready PR promptly upon assignment. Kindly assign this issue to me.
Thank you!