Skip to content

Add solana-token-risk tool plugin (Track D: Onchain Intelligence & Security) - #145

Draft
ccloveak wants to merge 2 commits into
zeroclaw-labs:mainfrom
ccloveak:plugin/solana-token-risk
Draft

Add solana-token-risk tool plugin (Track D: Onchain Intelligence & Security)#145
ccloveak wants to merge 2 commits into
zeroclaw-labs:mainfrom
ccloveak:plugin/solana-token-risk

Conversation

@ccloveak

Copy link
Copy Markdown

What

solana-token-risk — an offline rug/honeypot risk analyzer for Solana SPL and
Token-2022 mints, exposed to the agent as the solana_token_risk tool.

The agent fetches chain data with whatever HTTP tool the operator allows
(getAccountInfo jsonParsed; optionally getTokenLargestAccounts,
getTokenSupply, metadata) and passes the JSON in; the plugin returns a
structured report: 0–100 score, level, and per-finding explanations.

Checks: active mint/freeze authorities, permanent delegate, transfer hooks,
frozen-by-default accounts, pausable/paused transfers, transfer fees,
mint-close authority, non-transferable flag, confidential transfers,
scaled-UI-amount and interest-bearing display manipulation, top-1/top-10
holder concentration, mutable metadata. The report also carries a
summary_markdown field the agent can paste straight into a reply.

Why this design

The tool-plugin world has no egress — so fetch (host policy) is split from
judge (deterministic, sandboxed). That makes this a T0 read-only component:
permissions = [], no network, no keys, no config. Fail-closed on anything
that isn't a jsonParsed mint.

Chain data is treated as attacker-controlled: authority-shaped strings are
echoed only after a base58-pubkey allowlist check and always backquoted;
hostile prose planted in those fields is withheld from the report entirely.
Free-text fields (name/URI) are never echoed at all.

Layout & tests

Follows the redact-text reference layout: pure core (src/risk.rs,
no wasm deps) + thin #[cfg(target_family = "wasm")] shim (src/lib.rs).
11 host-run tests (cargo test, no network), including hostile/garbage input
fail-closed cases and a test proving injected authority strings never reach
the model. cargo fmt --check and cargo clippy (host + wasm32-wasip2
targets) are clean; the wasm component builds at ~212 KB.

Validated against live mainnet data: USDC correctly reports its active
mint/freeze authorities; PYUSD (Token-2022) reports permanent delegate
(critical), mint-close authority, and confidential transfers.

Threat model and security-tier justification are in the plugin README.

Submission

Superteam Earn bounty "Build Solana-native plugins for Zeroclaw 🦞" —
Track D: Onchain Intelligence & Security. Demo video link will be added
before marking this PR ready for review.

🤖 Generated with Claude Code

ccloveak and others added 2 commits July 27, 2026 02:29
Offline risk analyzer for SPL / Token-2022 mints: scores 0-100 with
graded findings (authorities, permanent delegate, default frozen state,
transfer hooks/fees, holder concentration, mutable metadata). Pure
analyzer with permissions = [] — the agent fetches RPC JSON via host
HTTP tools and passes it in; the plugin itself has no network access.

Track D: Onchain Intelligence & Security (Superteam Brasil bounty).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…mmary

- Authority-shaped strings are echoed only after a base58-pubkey allowlist
  check (32-44 chars) and always backquoted; hostile prose in authority
  fields is withheld from the report entirely.
- New extension checks with severity rationale: pausableConfig (paused now
  = critical live honeypot, pausable = high), confidentialTransferMint
  (medium, blinds holder analysis), scaledUiAmountConfig (medium, display
  manipulation), interestBearingConfig (low, UI overstates balance).
- New summary_markdown field renders the report for direct agent replies;
  existing JSON fields unchanged.
- Tests 8 -> 11, README check table and threat model updated to match.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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