T09 · Insecure Skill Coding Practices
- Location
scripts/eth_payment.py:78- Finding
Payment requests accept malformed addresses and unsafe numeric amounts
- Content
View full analysis
- Remediation
View remediation
bool: return ( len(address) == 42 and address.startswith("0x") and all(c in "0123456789abcdefABCDEF" for c in address[2:]) ) amount_decimal = Decimal(args.amount) if not amount_decimal.is_finite() or amount_decimal <= 0: raise ValueError("Amount must be finite and greater than zero") scaled = amount_decimal * (Decimal(10) ** decimals) if scaled != scaled.to_integral_value(): raise ValueError(f"Amount exceeds the token's {decimals}-decimal precision") amount_raw = int(scaled) ``` ]]>
