Repository navigation
feat: add Kestrova action provider (Solidity security scan, x402) - #1669
som2026-commits wants to merge 4 commits into
Conversation
🟡 Heimdall Review Status
|
|
Hi team, a gentle follow-up on this provider. Is there anything you'd like changed before a review (scope, naming, tests, docs)? One addition I can make if useful: a free action that checks a deployed contract by address (Base, Ethereum, BNB Chain, Arbitrum, Optimism, Polygon) before an agent interacts with it. It reads the verified source, follows proxies, and returns severity counts, with no wallet or payment needed. That seems a natural fit for AgentKit wallets. Happy to add it to this PR or keep the PR as is, whichever you prefer. |
…VM + Solana) kestrova_contract_risk_verdict returns low / medium / high with up to 5 reasons before an agent buys a token, approves a spender or calls a contract. EVM chains and Solana token mints / programs. Same pinned x402 payment policy and maxPaymentUsdc cap as the paid scans; kestrova_get_scan_price gains a verdict tier.
Same enforcement as the x402 action provider (coinbase#1678): setSpendControls caps the signed amount, and an invalid maxPaymentUsdc fails closed before any request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TWRVDL9QN7rT8Bjv1GRFFu
|
@phdargen I merged the latest main into this branch and aligned the Kestrova provider with #1678: every payment is now capped by x402 spend controls at Generated by Claude Code |
Description
Adds a Kestrova action provider (TypeScript) so agents that write or deploy Solidity can check a contract for known vulnerability patterns before deploying it. Kestrova runs Slither static analysis as a hosted service; the preview is free and full results are paid per call with x402 (USDC on Base or Solana mainnet), reusing AgentKit's existing
@x402/fetch,@x402/evmand@x402/svmclients.Actions:
kestrova_scan_preview(free, no wallet): severity counts, High/Medium detector names, one example finding and abehind_paywallsummary of what a paid result would add.kestrova_get_scan_price(free): live price for the wallet's network, checked against the published terms, so the agent can ask the user before paying.kestrova_buy_scan(paid):findings(0.25 USDC, every finding with file/line as JSON) orfull(1 USDC, adds an explanation and fix per finding plus PDF/SARIF).Payment safety:
registerPolicy) that keeps only the exact published terms (schemeexact, USDC, recipient, network, tier amount); anything else is never signed.maxPaymentUsdccap (default 1.0, orKESTROVA_MAX_PAYMENT_USDC).doNotPayAgain: trueand the free recovery endpoint instead of retrying.Automated static analysis, not an audit; the action descriptions say so.
Tests
Unit tests:
kestrovaActionProvider.test.ts(14). They cover the pinned-terms check (recipient, asset, amount, network, scheme), the free preview, price lookup and tampered terms, and refusal on an unsupported network or a price above the cap. A full x402 flow signs locally with a throwaway key against mocked fetch: tampered terms are never signed, exact terms are paid once (EIP-3009to/valuechecked), and an unclear outcome yieldsdoNotPayAgain.pnpm jestintypescript/agentkit: 63 suites, 918 tests pass.tsc --noEmitand eslint/prettier pass.Live (built package, free actions only, no payment):
Network: base-mainnet / solana-mainnet (getNetwork stub; no funds)
kestrova_scan_preview (reentrant Vault.sol) -> counts {"High":1,"Informational":2}, detectors ["reentrancy-eth"]
kestrova_get_scan_price findings -> base-mainnet 0.25 payable true; solana-mainnet 0.25 payable true
kestrova_get_scan_price full -> base-mainnet 1 payable true; solana-mainnet 1 payable true
Checklist