sriram1983007 commited on
Commit
a5b7dc4
·
verified ·
1 Parent(s): 8c7a045

Strict look-alike check: 179 of 179 real attacks (sra-riskgate 1.10.0, MCP 0.18.0)

Browse files
Files changed (1) hide show
  1. README.md +4 -4
README.md CHANGED
@@ -202,7 +202,7 @@ Of v2's 3 unsafe approvals, 2 were prompt injections that the companion SDK's de
202
  **Tested on real attacks:** in 90 days of real USDC and USDT payments on Ethereum mainnet, the companion
203
  library's look-alike check rejected **171 of 179 (95.5%)** real address-poisoning attacks before payment, covering
204
  **$3,327,346 of $3,328,160 lost**, and wrongly rejected **0 of 4967 (0.0%)** normal payments. The 8
205
- it did not reject (imitating only 3 characters at each end) were held as new payees. Each attack is confirmed by
206
  its on-chain poisoning transfer, not by the library's own rule; author-measured. [Dataset, method and every
207
  case](https://huggingface.co/datasets/sriram1983007/sra-real-world-poisoning)
208
 
@@ -298,7 +298,7 @@ If this is useful for your agent, a ❤️ like on this page helps others find i
298
  { "mcpServers": { "sra-riskgate": { "command": "uvx", "args": ["sra-riskgate-mcp"] } } }
299
  ```
300
 
301
- Pass the payment's own text as `untrusted_text` so self-asserted claims are held. From 0.9.2, the payment tools also take `account_code` (the sender's `eth_getCode` result) and hold if the account is delegated to a contract not listed in `SRA_EXPECTED_DELEGATES`. Every tool fails closed, and the agent should only pay on `approve`. From 0.13.0, set `SRA_ALLOWED_TOKENS=USDC,USDT,USDB,USDG` (or any subset) so the payment tools also check those stablecoins; it is a server setting only, so a manipulated agent cannot turn a token on. From 0.14.0, `SRA_EXTRA_TOKENS` describes stablecoins the SDK does not list, as JSON (`symbol`, `chain_id`, `contract`, `decimals`), so every tool recognises them too. From 0.16.0, set a screening provider's key (`SRA_CHAINALYSIS_API_KEY`, `SRA_TRM_API_KEY` or `SRA_TRM_KEYLESS=1`, `SRA_RANGE_API_KEY`, `SRA_WEBACY_API_KEY`, or `SRA_ELLIPTIC_API_KEY` with `SRA_ELLIPTIC_API_SECRET`) and the payment tools also screen the sender and payee with it: a sanctions match rejects, and a provider with no answer holds. A half-configured provider is a configuration error, never screening silently switched off. From 0.17.0, `SRA_BUDGET_TOTAL`, `SRA_BUDGET_PER_PAYEE`, `SRA_MAX_PAYMENTS_PER_HOUR` and `SRA_AMOUNT_SPIKE_FACTOR` hold payments that break a rolling budget or look unlike the wallet's history, `SRA_RECEIPT_KEY` adds a signed receipt to every payment decision (checked with `verify_receipt`), and `SRA_POLICY_FILE` keeps all the rules in one reviewed file. From 0.17.2, the server requires sra-riskgate 1.9.1, so `uvx sra-riskgate policy validate` checks the file you give `SRA_POLICY_FILE`, and `uvx sra-riskgate receipt verify result.json --key-env SRA_RECEIPT_KEY` checks a saved receipt with no server running. The server is listed in the official MCP Registry and on [Glama](https://glama.ai/mcp/servers/sriram1983007-dev/sra-riskgate-mcp), and rated Grade A (trust score 98/100, November 2026) on [mcprush](https://mcprush.com/sriram1983007-dev/sra-riskgate-mcp).
302
 
303
  **Coding agents:** the [agent-payment-guard](https://github.com/sriram1983007-dev/agent-payment-guard) Agent Skill teaches Claude Code and other agents to run this check before paying: `npx skills add sriram1983007-dev/agent-payment-guard`.
304
 
@@ -309,7 +309,7 @@ Pass the payment's own text as `untrusted_text` so self-asserted claims are held
309
  The `sra-riskgate` SDK runs fast deterministic checks before the model is involved: an offline match against the OFAC SDN list's crypto addresses (a dated snapshot, not a screening service), supported asset and chain, address and amount validation, a per-payment ceiling, USDC depeg in both directions, and a scan for payment text that claims its own verification. From 0.8.0 it can also hold the first payment to a new payee (`known_recipients`) and always reject addresses you block (`blocked_addresses`). It never raises on bad payment data: invalid payments are rejected and anything unexpected becomes `hold`. From 0.9.0, `check_transaction(tx, ...)` checks the exact transaction an agent is about to sign: a USDC `transfer` gets the same checks, and token approvals (including unlimited `approve()`), other functions, other contracts and native ETH are held. From 0.11.0, check_authorization(typed_data, ...) does the same for x402 payments, which the agent pays by signing an EIP-3009 authorization instead of sending a transaction: the signature must be for USDC on that chain, from the agent’s wallet, and valid for at most an hour by default, and the decoded payment then gets every check above. From 0.12.0, Circle Arc is supported (5042 mainnet, 5042002 testnet): on Arc, USDC is the native asset, so a plain native send is checked as a USDC payment, read at 18 decimals and rounded up to a whole micro-USDC before the payment check. From 0.12.1, EIP-7702 code delegation is always held (`CODE_DELEGATION`): a type-4 transaction or any `authorizationList` hands the whole account to contract code, on every chain if signed with chain id 0, and `check_delegation()` holds a signed authorization before the agent signs it. From 0.13.0, Circle Gateway batched x402 payments (nanopayments) are checked: an authorization signed for Gateway's `GatewayWalletBatched` domain with Circle's GatewayWallet contract gets its own validity limit (default 8 days, since Gateway requires at least 3 and Circle's SDK signs for 7) and every payment check above, while a look-alike Gateway contract is held. Shown live on Arc Testnet: a Gateway payment approved and accepted by Circle, three unsafe ones stopped before signing. From 0.14.0, Circle Wallets (developer-controlled) requests are checked before they are sent to Circle, which signs as soon as it accepts them: transfers, contract executions (an `approve()` is held), typed-data and transaction signing, with `sign/message` and wallet upgrades always held. `guard_circle_wallets()` wraps Circle's Python SDK so blocked requests never reach Circle (`pip install "sra-riskgate[circle]"`). Shown live on Arc Testnet: a USDC payment from a Circle wallet approved and completed, an unlimited approval, an unknown payee and an unlimited permit stopped before reaching Circle. From 0.15.0, a payee that imitates one of your known payees (address poisoning: the same first and last characters, such as `0x2ffb…b7ee` for `0x2ffb88…472deb7ee`) is rejected as `LOOKALIKE_RECIPIENT`, naming the payee it imitates. From 0.16.0, pass the sender's account code (the result of `eth_getCode`) as `account_code`: an account already delegated through EIP-7702 to a contract you did not expect is held as `ACCOUNT_DELEGATED` and the agent is told to stop signing, because that contract can move the wallet's funds without another signature (list the delegates you trust in `expected_delegates`). Shown live on Base Sepolia (2026-10-30): an agent's USDC transfer ([tx](https://sepolia.basescan.org/tx/0x575f36cbd56e323e4191de267fe8c229900a85fab925d3c16d6c4ee3da6a67f2)) and an x402 EIP-3009 payment ([tx](https://sepolia.basescan.org/tx/0x22c23ed654570f6c96a2beea478232aa8b72a3215ecacbad095c9e149f87be1f)) were approved and settled on chain, while an unlimited approval, a look-alike payee, a 30-day x402 authorization and a self-vouching request were stopped before signing. From 0.17.0, smart accounts are covered: `check_user_operation(user_op, chain_id=...)` decodes the calls an ERC-4337 UserOperation makes (Coinbase Smart Wallet, CDP smart accounts, Safe, Kernel, Nexus, SimpleAccount) and checks each one, so an unlimited `approve()` hidden in a batch next to a payment is held and payments to the same payee are summed against your limit; self-calls, delegatecalls and unexpected paymasters are held too. Tested against callData produced by viem and permissionless for seven account types. From 0.18.0, the SDK also checks what actually settled: `verify_settlement(receipt, ...)` confirms a mined receipt holds exactly the approved USDC payment (right payer, payee and amount, and for x402 the approved authorization), and `verify_gateway_balances(...)` confirms a Circle Gateway payment from balances read before and after. An x402 server asking for a signature valid longer than an hour (`maxTimeoutSeconds`) is held before the agent signs. From 0.19.0, `verify_settlement` checks any ERC-20 on any EVM chain, and from 0.20.0 named stablecoins fill in the contract and decimals (`token="USDT"` on Ethereum, `"USDB"` from Bridge on Ethereum and Base, `"USDG"` on Ethereum and Robinhood Chain, and USDC), each read on chain before release. 0.20.0 also adds `check_allowances(owner, {spender: allowance})` for pull payments such as loan repayments and subscriptions, which need no new signature: an unlimited, oversized or unexpected standing allowance is held, and one held by a sanctioned or blocked spender is rejected. From 1.0.0, the checks before signing cover them too: `check_payment`, `check_transaction`, `check_user_operation` and Circle Wallets transfers check USDT, USDB and USDG as well as USDC once you enable them with `allowed_tokens=["USDC", "USDT", "USDB", "USDG"]` (USDC only by default, so upgrading never starts approving a token you did not choose). The token is read from the contract called, approvals and permits are held for every token, and a smart-account batch is summed across tokens. Read on chain, USDC and USDG implement EIP-3009 (USDG's support was confirmed on 2026-11-14 and its x402 signatures are checked from 1.6.0; earlier releases held them), so an x402 signature for USDT or USDB is held: it could never settle. From 1.0.0 the public API follows semantic versioning ([details](https://github.com/sriram1983007-dev/sra-riskgate#usdt-usdb-and-usdg-100)). From 1.1.0, `register_stablecoin(symbol, chain_id, contract, decimals)` adds any US-dollar stablecoin on any EVM chain (a testnet dollar, PYUSD, an L2's own stablecoin), and every check then treats it like a built-in token; it is still held until enabled with `allowed_tokens`, and a registration can never change USDC, USDT, USDB or USDG ([details](https://github.com/sriram1983007-dev/sra-riskgate#your-own-stablecoin-or-chain-110)). From 1.2.0 and 1.3.0, `with_dispute_window()`, `payment_messages()` and `dispute_messages()` build this model's exact training prompts, and `parse_payment_verdict()` / `parse_dispute_verdict()` read its answer, failing closed. From 1.4.0, `check_payment(screening_providers=[...])` adds outside address screening: Chainalysis's and TRM Labs' free sanctions APIs, Range and Webacy are built in (TRM from 1.5.0), and any other provider plugs in with `CallableProvider`. A provider's sanctions match or severe risk rejects, high risk holds, and a provider with no usable answer holds; only the sender's and recipient's addresses are sent. The adapters are built from each provider's published API documentation and tested against responses shaped like it; none has yet been run against a live provider account ([details](https://github.com/sriram1983007-dev/sra-riskgate#screening-providers-chainalysis-range-webacy-and-your-own-140)).
310
 
311
  ```bash
312
- pip install --upgrade "sra-riskgate>=1.9.1"
313
  ```
314
 
315
  ### 💻 Command line (1.9.0+)
@@ -450,7 +450,7 @@ Depeg checks run only when a `peg_feed` is supplied.
450
 
451
  ## 🚀 Transformers Quickstart
452
 
453
- **Shortcut:** `pip install "sra-riskgate>=1.9.1"` gives `payment_messages()` and `dispute_messages()`, which build the exact prompts below for you, and `parse_payment_verdict()` / `parse_dispute_verdict()`, which read the answer and fail closed.
454
 
455
  The model was trained on a specific prompt format, and it only performs as benchmarked when you use that format exactly:
456
 
 
202
  **Tested on real attacks:** in 90 days of real USDC and USDT payments on Ethereum mainnet, the companion
203
  library's look-alike check rejected **171 of 179 (95.5%)** real address-poisoning attacks before payment, covering
204
  **$3,327,346 of $3,328,160 lost**, and wrongly rejected **0 of 4967 (0.0%)** normal payments. The 8
205
+ it did not reject (imitating only 3 characters at each end) were held as new payees; with `lookalike_check="strict"` (1.10.0+) all 179 were rejected, still with 0 normal payments wrongly rejected. Each attack is confirmed by
206
  its on-chain poisoning transfer, not by the library's own rule; author-measured. [Dataset, method and every
207
  case](https://huggingface.co/datasets/sriram1983007/sra-real-world-poisoning)
208
 
 
298
  { "mcpServers": { "sra-riskgate": { "command": "uvx", "args": ["sra-riskgate-mcp"] } } }
299
  ```
300
 
301
+ Pass the payment's own text as `untrusted_text` so self-asserted claims are held. From 0.9.2, the payment tools also take `account_code` (the sender's `eth_getCode` result) and hold if the account is delegated to a contract not listed in `SRA_EXPECTED_DELEGATES`. Every tool fails closed, and the agent should only pay on `approve`. From 0.13.0, set `SRA_ALLOWED_TOKENS=USDC,USDT,USDB,USDG` (or any subset) so the payment tools also check those stablecoins; it is a server setting only, so a manipulated agent cannot turn a token on. From 0.14.0, `SRA_EXTRA_TOKENS` describes stablecoins the SDK does not list, as JSON (`symbol`, `chain_id`, `contract`, `decimals`), so every tool recognises them too. From 0.16.0, set a screening provider's key (`SRA_CHAINALYSIS_API_KEY`, `SRA_TRM_API_KEY` or `SRA_TRM_KEYLESS=1`, `SRA_RANGE_API_KEY`, `SRA_WEBACY_API_KEY`, or `SRA_ELLIPTIC_API_KEY` with `SRA_ELLIPTIC_API_SECRET`) and the payment tools also screen the sender and payee with it: a sanctions match rejects, and a provider with no answer holds. A half-configured provider is a configuration error, never screening silently switched off. From 0.17.0, `SRA_BUDGET_TOTAL`, `SRA_BUDGET_PER_PAYEE`, `SRA_MAX_PAYMENTS_PER_HOUR` and `SRA_AMOUNT_SPIKE_FACTOR` hold payments that break a rolling budget or look unlike the wallet's history, `SRA_RECEIPT_KEY` adds a signed receipt to every payment decision (checked with `verify_receipt`), and `SRA_POLICY_FILE` keeps all the rules in one reviewed file. From 0.17.2, the server requires sra-riskgate 1.9.1, so `uvx sra-riskgate policy validate` checks the file you give `SRA_POLICY_FILE`, and `uvx sra-riskgate receipt verify result.json --key-env SRA_RECEIPT_KEY` checks a saved receipt with no server running. From 0.18.0, `SRA_LOOKALIKE_CHECK=strict` also rejects a payee imitating a known one by only 3 characters at each end (all 179 real poisoning attacks in the dataset, with no normal payment wrongly rejected). The server is listed in the official MCP Registry and on [Glama](https://glama.ai/mcp/servers/sriram1983007-dev/sra-riskgate-mcp), and rated Grade A (trust score 98/100, November 2026) on [mcprush](https://mcprush.com/sriram1983007-dev/sra-riskgate-mcp).
302
 
303
  **Coding agents:** the [agent-payment-guard](https://github.com/sriram1983007-dev/agent-payment-guard) Agent Skill teaches Claude Code and other agents to run this check before paying: `npx skills add sriram1983007-dev/agent-payment-guard`.
304
 
 
309
  The `sra-riskgate` SDK runs fast deterministic checks before the model is involved: an offline match against the OFAC SDN list's crypto addresses (a dated snapshot, not a screening service), supported asset and chain, address and amount validation, a per-payment ceiling, USDC depeg in both directions, and a scan for payment text that claims its own verification. From 0.8.0 it can also hold the first payment to a new payee (`known_recipients`) and always reject addresses you block (`blocked_addresses`). It never raises on bad payment data: invalid payments are rejected and anything unexpected becomes `hold`. From 0.9.0, `check_transaction(tx, ...)` checks the exact transaction an agent is about to sign: a USDC `transfer` gets the same checks, and token approvals (including unlimited `approve()`), other functions, other contracts and native ETH are held. From 0.11.0, check_authorization(typed_data, ...) does the same for x402 payments, which the agent pays by signing an EIP-3009 authorization instead of sending a transaction: the signature must be for USDC on that chain, from the agent’s wallet, and valid for at most an hour by default, and the decoded payment then gets every check above. From 0.12.0, Circle Arc is supported (5042 mainnet, 5042002 testnet): on Arc, USDC is the native asset, so a plain native send is checked as a USDC payment, read at 18 decimals and rounded up to a whole micro-USDC before the payment check. From 0.12.1, EIP-7702 code delegation is always held (`CODE_DELEGATION`): a type-4 transaction or any `authorizationList` hands the whole account to contract code, on every chain if signed with chain id 0, and `check_delegation()` holds a signed authorization before the agent signs it. From 0.13.0, Circle Gateway batched x402 payments (nanopayments) are checked: an authorization signed for Gateway's `GatewayWalletBatched` domain with Circle's GatewayWallet contract gets its own validity limit (default 8 days, since Gateway requires at least 3 and Circle's SDK signs for 7) and every payment check above, while a look-alike Gateway contract is held. Shown live on Arc Testnet: a Gateway payment approved and accepted by Circle, three unsafe ones stopped before signing. From 0.14.0, Circle Wallets (developer-controlled) requests are checked before they are sent to Circle, which signs as soon as it accepts them: transfers, contract executions (an `approve()` is held), typed-data and transaction signing, with `sign/message` and wallet upgrades always held. `guard_circle_wallets()` wraps Circle's Python SDK so blocked requests never reach Circle (`pip install "sra-riskgate[circle]"`). Shown live on Arc Testnet: a USDC payment from a Circle wallet approved and completed, an unlimited approval, an unknown payee and an unlimited permit stopped before reaching Circle. From 0.15.0, a payee that imitates one of your known payees (address poisoning: the same first and last characters, such as `0x2ffb…b7ee` for `0x2ffb88…472deb7ee`) is rejected as `LOOKALIKE_RECIPIENT`, naming the payee it imitates. From 0.16.0, pass the sender's account code (the result of `eth_getCode`) as `account_code`: an account already delegated through EIP-7702 to a contract you did not expect is held as `ACCOUNT_DELEGATED` and the agent is told to stop signing, because that contract can move the wallet's funds without another signature (list the delegates you trust in `expected_delegates`). Shown live on Base Sepolia (2026-10-30): an agent's USDC transfer ([tx](https://sepolia.basescan.org/tx/0x575f36cbd56e323e4191de267fe8c229900a85fab925d3c16d6c4ee3da6a67f2)) and an x402 EIP-3009 payment ([tx](https://sepolia.basescan.org/tx/0x22c23ed654570f6c96a2beea478232aa8b72a3215ecacbad095c9e149f87be1f)) were approved and settled on chain, while an unlimited approval, a look-alike payee, a 30-day x402 authorization and a self-vouching request were stopped before signing. From 0.17.0, smart accounts are covered: `check_user_operation(user_op, chain_id=...)` decodes the calls an ERC-4337 UserOperation makes (Coinbase Smart Wallet, CDP smart accounts, Safe, Kernel, Nexus, SimpleAccount) and checks each one, so an unlimited `approve()` hidden in a batch next to a payment is held and payments to the same payee are summed against your limit; self-calls, delegatecalls and unexpected paymasters are held too. Tested against callData produced by viem and permissionless for seven account types. From 0.18.0, the SDK also checks what actually settled: `verify_settlement(receipt, ...)` confirms a mined receipt holds exactly the approved USDC payment (right payer, payee and amount, and for x402 the approved authorization), and `verify_gateway_balances(...)` confirms a Circle Gateway payment from balances read before and after. An x402 server asking for a signature valid longer than an hour (`maxTimeoutSeconds`) is held before the agent signs. From 0.19.0, `verify_settlement` checks any ERC-20 on any EVM chain, and from 0.20.0 named stablecoins fill in the contract and decimals (`token="USDT"` on Ethereum, `"USDB"` from Bridge on Ethereum and Base, `"USDG"` on Ethereum and Robinhood Chain, and USDC), each read on chain before release. 0.20.0 also adds `check_allowances(owner, {spender: allowance})` for pull payments such as loan repayments and subscriptions, which need no new signature: an unlimited, oversized or unexpected standing allowance is held, and one held by a sanctioned or blocked spender is rejected. From 1.0.0, the checks before signing cover them too: `check_payment`, `check_transaction`, `check_user_operation` and Circle Wallets transfers check USDT, USDB and USDG as well as USDC once you enable them with `allowed_tokens=["USDC", "USDT", "USDB", "USDG"]` (USDC only by default, so upgrading never starts approving a token you did not choose). The token is read from the contract called, approvals and permits are held for every token, and a smart-account batch is summed across tokens. Read on chain, USDC and USDG implement EIP-3009 (USDG's support was confirmed on 2026-11-14 and its x402 signatures are checked from 1.6.0; earlier releases held them), so an x402 signature for USDT or USDB is held: it could never settle. From 1.0.0 the public API follows semantic versioning ([details](https://github.com/sriram1983007-dev/sra-riskgate#usdt-usdb-and-usdg-100)). From 1.1.0, `register_stablecoin(symbol, chain_id, contract, decimals)` adds any US-dollar stablecoin on any EVM chain (a testnet dollar, PYUSD, an L2's own stablecoin), and every check then treats it like a built-in token; it is still held until enabled with `allowed_tokens`, and a registration can never change USDC, USDT, USDB or USDG ([details](https://github.com/sriram1983007-dev/sra-riskgate#your-own-stablecoin-or-chain-110)). From 1.2.0 and 1.3.0, `with_dispute_window()`, `payment_messages()` and `dispute_messages()` build this model's exact training prompts, and `parse_payment_verdict()` / `parse_dispute_verdict()` read its answer, failing closed. From 1.4.0, `check_payment(screening_providers=[...])` adds outside address screening: Chainalysis's and TRM Labs' free sanctions APIs, Range and Webacy are built in (TRM from 1.5.0), and any other provider plugs in with `CallableProvider`. A provider's sanctions match or severe risk rejects, high risk holds, and a provider with no usable answer holds; only the sender's and recipient's addresses are sent. The adapters are built from each provider's published API documentation and tested against responses shaped like it; none has yet been run against a live provider account ([details](https://github.com/sriram1983007-dev/sra-riskgate#screening-providers-chainalysis-range-webacy-and-your-own-140)).
310
 
311
  ```bash
312
+ pip install --upgrade "sra-riskgate>=1.10.0"
313
  ```
314
 
315
  ### 💻 Command line (1.9.0+)
 
450
 
451
  ## 🚀 Transformers Quickstart
452
 
453
+ **Shortcut:** `pip install "sra-riskgate>=1.10.0"` gives `payment_messages()` and `dispute_messages()`, which build the exact prompts below for you, and `parse_payment_verdict()` / `parse_dispute_verdict()`, which read the answer and fail closed.
454
 
455
  The model was trained on a specific prompt format, and it only performs as benchmarked when you use that format exactly:
456