AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 47 Monero

chore: fix type casting and safety across multiple coin packages (#3791)

Public commit record

What the developer wrote

Authored by Omar Hatem

93/100 · Strong
chore: fix type casting and safety across multiple coin packages (#3791)

* chore: fix type casting and safety across multiple coin packages

* **cw_decred**: Add explicit type casts for JSON decoding in wallet and address management, including transaction history, unspents, and sync status. Fix `amount` and `fee` decoding to handle `num` values from Go.
* **cw_evm**: Apply type safety to Trezor transaction credential parsing and Etherscan API response handling. Fix potential crashes in transaction merging and spam filtering.
* **cw_solana**: Add explicit casts for RPC response data, transaction signatures, and SPL token metadata.
* **cw_tron**: Ensure proper type casting for transaction info, balances, and TRC20 transaction models.
* **cw_zcash**: Fix `crc32` byte validation and add explicit casts to `YwalletAccountInfo` migration logic.
* **cw_wownero**: Explicitly type `newWptr` as `wownero.wallet`.
* **cw_monero**: Cast serialized wallet cache to `Map<String, dynamic>`.

* Update cw_decred/lib/api/libdcrwallet.dart

Co-authored-by: malik1004x <malikowskirobert@gmail.com>

---------

Co-authored-by: malik1004x <malikowskirobert@gmail.com>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit is a broad cleanup across multiple cryptocurrency wallet packages that adds explicit type casts when handling JSON and binary data. The changes mostly prevent runtime crashes caused by unexpected data types (for example, a number arriving as an integer instead of a decimal, or a string where a list was expected). In a few places, the casts also make the code safer when parsing values that could be attacker-influenced, such as Etherscan API responses or Trezor hardware-wallet transaction data. The patch is defensive and does not appear to introduce new vulnerabilities, but it is also partial: it fixes many symptoms without addressing the underlying lack of structured validation, so some edge cases may still crash or behave incorrectly.

Recommended action

Treat this as a defensive hardening patch. Review whether any remaining uncast dynamic values in the same call sites still reach sensitive operations, and consider adding structured deserialization (e.g., generated JSON models or validation schemas) for RPC/API responses rather than relying on ad-hoc casts. Test malformed API responses and edge-case Trezor payloads to confirm crashes are resolved. No urgent security deployment is indicated solely from this diff.

Security signals we found

01

Type-safety hardening across JSON-RPC and REST API response handling

02

Explicit casts added to hardware-wallet (Trezor) transaction credential parsing

03

CRC32 byte-range validation tightened in Zcash utility

04

Decred amount/fee decoding changed from `double` to `num` to handle Go integer-encoded float64

05

No new cryptographic, authorization, or network-layer changes observed

Risk score

Why this scored 47/100

Our methodology →
Potential impact 12/30
Exploitability 8/25
Stealth signal 6/15
Affected reach 10/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.