CWE-407 array scans exist but bounded by Bitcoin consensus (p2ms max n=20, taptree max depth 128). No adversarial scaling possible. No intertangle, leaked context, logged secrets, or thundering herd.
37 lines
1.7 KiB
Text
37 lines
1.7 KiB
Text
CLEAN — all 5 MOADs scanned 2026-03-31
|
|
|
|
Target: bitcoinjs-lib (bitcoinjs/bitcoinjs-lib)
|
|
Source: ~/git/bitcoinjs-lib
|
|
Files: ~7800 lines TypeScript across 30 source files
|
|
|
|
MOAD-0001 (CWE-407): CLEAN
|
|
Reviewed all .includes(), .indexOf(), .find(), .filter() inside loops.
|
|
Three candidate sites found, all bounded by Bitcoin consensus rules:
|
|
- psbt.ts:2020 getSortedSigs(): pubkeys.map + partialSig.filter = O(P*S)
|
|
BUT p2ms max n=20 (consensus enforced in p2ms.ts:146), max 400 comparisons.
|
|
- psbt.ts:636 tapScriptSig loop + allHashses.find() = O(S*H)
|
|
Both bounded by per-input signature count, realistically <20.
|
|
- psbt.ts:1331 pubkeys.map + partialSig.find() = O(P*S)
|
|
Same p2ms bounds as above.
|
|
- bip371.ts:564 tapLeafScript.find + canFinalizeLeaf (tapScriptSig.find) = O(L*S)
|
|
Bounded by taptree depth (max 128 leaves). Not in hot loop.
|
|
All array scans are on cryptographic key/signature lists with hard upper bounds.
|
|
No adversarial scaling possible.
|
|
|
|
MOAD-0002 (Intertangle): CLEAN
|
|
__CACHE in psbt.ts is instance-scoped per Psbt object, not shared global state.
|
|
_ECCLIB_CACHE in ecc_lib.ts is a global singleton but holds a stateless crypto
|
|
interface (no mutable state coupling subsystems). No god objects found.
|
|
|
|
MOAD-0003 (Leaked Context): CLEAN
|
|
No AsyncLocalStorage, no ThreadLocal, no thread-scoped carriers.
|
|
Pure computation library with no request-scoped context.
|
|
|
|
MOAD-0004 (Logged Secret): CLEAN
|
|
Only console.warn calls found (address.ts:78, address.ts:255, psbt.ts:1700),
|
|
all for future segwit version warnings. No secret material logged.
|
|
|
|
MOAD-0005 (Thundering Herd): CLEAN
|
|
No shared cache with get+miss+compute+put pattern.
|
|
__CACHE is per-instance transaction state, not shared-resource caching.
|
|
No synchronization issues.
|