Skip to content

feat: add Kestrova action provider (Solidity security scan, x402) - #1669

Open
som2026-commits wants to merge 4 commits into
coinbase:mainfrom
som2026-commits:feat/kestrova-action-provider
Open

som2026-commits wants to merge 4 commits into
coinbase:mainfrom
som2026-commits:feat/kestrova-action-provider

Conversation

@som2026-commits

Copy link
Copy Markdown

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/evm and @x402/svm clients.

Actions:

  • kestrova_scan_preview (free, no wallet): severity counts, High/Medium detector names, one example finding and a behind_paywall summary 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) or full (1 USDC, adds an explanation and fix per finding plus PDF/SARIF).

Payment safety:

  • The x402 client is given a payment policy (registerPolicy) that keeps only the exact published terms (scheme exact, USDC, recipient, network, tier amount); anything else is never signed.
  • A maxPaymentUsdc cap (default 1.0, or KESTROVA_MAX_PAYMENT_USDC).
  • If a payment was created but the outcome is unclear (202/409/error), the action returns doNotPayAgain: true and 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-3009 to/value checked), and an unclear outcome yields doNotPayAgain.

  • pnpm jest in typescript/agentkit: 63 suites, 918 tests pass. tsc --noEmit and 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

  • Added documentation to all relevant README.md files
  • Added a changelog entry

@cb-heimdall

cb-heimdall commented Nov 20, 2026 •

Copy link
Copy Markdown

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
1 if authored by an app that is not allowlisted and lacks verified human attribution 0
Sum 1

@github-actions github-actions Bot added documentation Improvements or additions to documentation action provider New action provider typescript labels Nov 20, 2026
@som2026-commits

Copy link
Copy Markdown
Author

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.

som2026-commits and others added 3 commits December 3, 2026 20:16
…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
@som2026-commits

Copy link
Copy Markdown
Author

@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 maxPaymentUsdc (setSpendControls({ maxAmountPerPayment })), and an invalid cap fails closed before any request. Payments only go to Kestrova's pinned published terms. Lint, tsc and the full jest suite (942 tests) pass. Would you be able to review?


Generated by Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action provider New action provider documentation Improvements or additions to documentation typescript

Development

Successfully merging this pull request may close these issues.

3 participants