Wallet security checks are simulated: risk scores derive from address hex and scam checks always return false
Labels / Complexity: bug · security · High Complexity — High
Problem
The wallet-security layer in src/utils/security/ presents fabricated results as real security signals. Verified examples:
blockchainSecurity.ts line 381 simulateAddressRiskCheck — "Simulates address risk check (placeholder for real API)": it derives a deterministic fake score from the address's hex characters (// Parse first 8 hex chars as a 32-bit integer, then mod 100 for a 0–99 score), with the comment "useful for testing/demo purposes".
walletValidator.ts line 459 hasSimilarityToKnownAddresses — always return false ("placeholder implementation").
walletValidator.ts line 468 isKnownScamContract — checks against an empty hardcoded list (const knownScamContracts: string[] = [ // Add known scam contract addresses ]), so it always returns false.
transactionMonitor.ts line 484 isSuspiciousAddress — // For now, return false as placeholder.
These feed the UI through src/hooks/useSecurity.ts and src/components/security/WalletAddressInput.tsx. Consequences:
- Users are shown risk scores and warnings that are fiction. A "73/100 risk" label on an address is just
hexToInt(address) % 100; two different checks that claim to detect scams can never fire.
- The security UI creates false confidence. The presence of a risk badge implies screening happened; it did not, and users may rely on it (e.g. before approving a transfer) exactly when they should not.
- The failure is silent by design. Everything returns successfully with plausible-looking values, so nothing in tests or typechecking flags that the checks are stubs.
Root cause
src/utils/security/blockchainSecurity.ts (simulateAddressRiskCheck, line 381), walletValidator.ts (hasSimilarityToKnownAddresses, isKnownScamContract, lines 459/468), and transactionMonitor.ts (isSuspiciousAddress, line 484) — placeholder implementations that return deterministic/fixed values.
Why this is architecturally hard
- The real integrations do not exist. Genuine address-risk and scam screening requires a data provider (chainalysis-style API, blocklist service, or on-chain heuristics). The contributor must decide what the product can actually ship: a real provider integration, an on-chain heuristic (e.g. token-symbol/age checks), or explicit removal of the fake checks so the UI never implies screening exists.
- The UI contract must be redone.
WalletAddressInput/useSecurity consume the fabricated scores; if real checks are unavailable, the UI must show "unverified" instead of a fake number — a UX change, not just a backend swap.
- Tests currently pin the fiction. Any existing tests for these utils assert the deterministic values; they must be rewritten to assert the new (real or absent) behavior. Check
src/utils/security/__tests__/ before assuming none exist.
Acceptance criteria
- No code path derives a risk score from the address's hex characters;
simulateAddressRiskCheck is either backed by a real check or removed.
isKnownScamContract/hasSimilarityToKnownAddresses/isSuspiciousAddress either implement real screening or are removed, and no UI element claims to have performed those checks.
- The UI shows an explicit "not verified" state where checks do not run, instead of a fabricated score.
- Tests cover the new behavior (a real check's pass/fail, or the absence of the fake score in the UI state).
npm run typecheck, npm test, and npm run lint pass.
Out of scope
Choosing and integrating a specific third-party risk API (a separate service decision) is out of scope; this issue is about stopping the simulation and defining the honest fallback.
Getting started
src/utils/security/blockchainSecurity.ts — simulateAddressRiskCheck (line 381)
src/utils/security/walletValidator.ts — lines 459, 468
src/utils/security/transactionMonitor.ts — line 484
src/hooks/useSecurity.ts, src/components/security/WalletAddressInput.tsx — the consumers
Commands: npm run typecheck, npm test, npm run lint.
Good first files to read: src/utils/security/blockchainSecurity.ts, src/hooks/useSecurity.ts.
Wallet security checks are simulated: risk scores derive from address hex and scam checks always return false
Labels / Complexity: bug · security · High Complexity — High
Problem
The wallet-security layer in
src/utils/security/presents fabricated results as real security signals. Verified examples:blockchainSecurity.tsline 381simulateAddressRiskCheck— "Simulates address risk check (placeholder for real API)": it derives a deterministic fake score from the address's hex characters (// Parse first 8 hex chars as a 32-bit integer, then mod 100 for a 0–99 score), with the comment "useful for testing/demo purposes".walletValidator.tsline 459hasSimilarityToKnownAddresses— alwaysreturn false("placeholder implementation").walletValidator.tsline 468isKnownScamContract— checks against an empty hardcoded list (const knownScamContracts: string[] = [ // Add known scam contract addresses ]), so it always returns false.transactionMonitor.tsline 484isSuspiciousAddress—// For now, return false as placeholder.These feed the UI through
src/hooks/useSecurity.tsandsrc/components/security/WalletAddressInput.tsx. Consequences:hexToInt(address) % 100; two different checks that claim to detect scams can never fire.Root cause
src/utils/security/blockchainSecurity.ts(simulateAddressRiskCheck, line 381),walletValidator.ts(hasSimilarityToKnownAddresses,isKnownScamContract, lines 459/468), andtransactionMonitor.ts(isSuspiciousAddress, line 484) — placeholder implementations that return deterministic/fixed values.Why this is architecturally hard
WalletAddressInput/useSecurityconsume the fabricated scores; if real checks are unavailable, the UI must show "unverified" instead of a fake number — a UX change, not just a backend swap.src/utils/security/__tests__/before assuming none exist.Acceptance criteria
simulateAddressRiskCheckis either backed by a real check or removed.isKnownScamContract/hasSimilarityToKnownAddresses/isSuspiciousAddresseither implement real screening or are removed, and no UI element claims to have performed those checks.npm run typecheck,npm test, andnpm run lintpass.Out of scope
Choosing and integrating a specific third-party risk API (a separate service decision) is out of scope; this issue is about stopping the simulation and defining the honest fallback.
Getting started
src/utils/security/blockchainSecurity.ts—simulateAddressRiskCheck(line 381)src/utils/security/walletValidator.ts— lines 459, 468src/utils/security/transactionMonitor.ts— line 484src/hooks/useSecurity.ts,src/components/security/WalletAddressInput.tsx— the consumersCommands:
npm run typecheck,npm test,npm run lint.Good first files to read:
src/utils/security/blockchainSecurity.ts,src/hooks/useSecurity.ts.