Skip to content

chore(audit): add static analysis sweep script#7

Merged
satyakwok merged 1 commit into
mainfrom
chore/audit-static-script
May 11, 2026
Merged

chore(audit): add static analysis sweep script#7
satyakwok merged 1 commit into
mainfrom
chore/audit-static-script

Conversation

@satyakwok
Copy link
Copy Markdown
Member

Summary

Mirror of frontend/scripts/audit-static.sh adapted for the V2 (Leptos / Rust) codebase. 9 grep-shaped rules covering bug classes we've actually shipped here.

Rules

# Severity What it catches
1 yellow Hardcoded chain names (site-identity vs network-aware)
2 red Hardcoded gRPC endpoints outside config.rs
3 yellow Hardcoded scan domains (verify intentional surface text)
4 red Explorer URL with ?network= before path (V1 bug class — preventive)
5 yellow .unwrap()/.expect() in app paths (WASM panic = blank screen)
6 red todo!() / unimplemented!() in shipped code
7 red println! / eprintln! / dbg! left in code
8 yellow TODO / FIXME / XXX / HACK markers
9 red Raw JSON-RPC outside the EVM bridge layer

Whitelists encoded

  • api/evm.rs — hand-rolled JSON-RPC bridge for EVM-shaped reads (eth_call etc don't have gRPC equivalents; alloy-providers would add ~400 KB gzipped WASM)
  • main.rs — axum startup banner uses eprintln! (conventional)
  • Leptos use_context().expect() — context-boot idiom (provider guaranteed at app root)

Run

```bash
bash scripts/audit-static.sh
```

Exit code = number of hard errors. CI can set -e on it.

Verified

0 hard errors on current main. Yellow output is review-only and reflects intentional design (site-identity branding, leptos context idiom, EVM bridge layer).

Test plan

  • CI green
  • bash scripts/audit-static.sh; echo \$? returns 0 on main

Mirror of frontend/scripts/audit-static.sh adapted for the V2 (Leptos /
Rust) codebase. 9 grep-shaped rules covering bug classes we've actually
shipped here:

  1. hardcoded chain naming literals (verify site-identity vs network-aware)
  2. hardcoded grpc endpoints outside config.rs
  3. hardcoded scan domains (verify intentional)
  4. explorer URL with ?network= before path (V1 bug class — preventive)
  5. .unwrap()/.expect() in app paths (WASM panics blank-screen)
  6. todo!()/unimplemented!() macros in shipped code
  7. println!/eprintln!/dbg! left in code (use leptos::logging)
  8. TODO/FIXME/XXX/HACK markers
  9. raw JSON-RPC use outside the EVM bridge layer

Whitelists encoded for known-intentional patterns: api/evm.rs as the
hand-rolled JSON-RPC bridge for EVM-shaped reads, main.rs for the
axum startup banner, leptos use_context().expect() context-boot idiom.

Verified: 0 hard errors on current main. Run from repo root:

  bash scripts/audit-static.sh
@satyakwok satyakwok merged commit c472f28 into main May 11, 2026
6 checks passed
@satyakwok satyakwok deleted the chore/audit-static-script branch May 11, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant