test: cover the address-poisoning filters in transactions.js (closes #160) #175

Merged
clawbot merged 1 commits from test/issue-160-transactions-filters into next 2026-08-10 15:53:16 +02:00

1 Commits

Author SHA1 Message Date
8dd056bc08 test: cover the address-poisoning filters in transactions.js (closes #160)
All checks were successful
check / check (push) Successful in 24s
src/shared/transactions.js had zero test coverage despite owning the four
anti-poisoning filters that README.md:730-814 documents as a core security
property: known token symbol verification, the 1,000-holder rule, the fraud
contract blocklist, and the dust threshold. A regression in any of them does
not crash, it just silently stops filtering, so the behaviour needs pinning
down in both directions.

Adds tests/transactions.test.js with fixtures built from the two real attacks
cited in the README: the fake "Ethereum"/"ETH" token at 0xD05339f9 with zero
holders, and the 1 gwei native dust transfer 0x2708ebdd from the look-alike
sender 0xC3c6B3b4. Every filter is proven to work when on and to be bypassed
when off, both thresholds are asserted at, just below, and just above their
boundary, and legitimate traffic (a plain ETH transfer and genuine USDC and
WETH transfers) is proven to survive all four rules.

Also covers the per-address merge and dedup that fetchRecentTransactions owns,
with debugFetch mocked at the module boundary. No test performs a network
request: global.fetch is a throwing stub and is asserted never to have been
called.

Several tests are named as documenting current behaviour where it diverges
from the README; no source file is modified here.
2026-08-10 13:50:48 +00:00