Add solana-token-risk tool plugin (Track D: Onchain Intelligence & Security) - #145
Draft
ccloveak wants to merge 2 commits into
Draft
Add solana-token-risk tool plugin (Track D: Onchain Intelligence & Security)#145ccloveak wants to merge 2 commits into
ccloveak wants to merge 2 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
solana-token-risk— an offline rug/honeypot risk analyzer for Solana SPL andToken-2022 mints, exposed to the agent as the
solana_token_risktool.The agent fetches chain data with whatever HTTP tool the operator allows
(
getAccountInfojsonParsed; optionallygetTokenLargestAccounts,getTokenSupply, metadata) and passes the JSON in; the plugin returns astructured 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_markdownfield the agent can paste straight into a reply.Why this design
The
tool-pluginworld has no egress — so fetch (host policy) is split fromjudge (deterministic, sandboxed). That makes this a T0 read-only component:
permissions = [], no network, no keys, no config. Fail-closed on anythingthat 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-textreference 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 inputfail-closed cases and a test proving injected authority strings never reach
the model.
cargo fmt --checkandcargo clippy(host + wasm32-wasip2targets) 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