web3-security

The boundary between the SDK and the chain. Authoritative rules live in AGENTS.md §1 (the Action layer is pure encode-only, no state reads), §2 (typed errors), and §5 (security invariants — chainId validation, authorization, accounting, LLTV buffer, inflation-attack guard, deposit routing). The Action-layer rule and…

Agent for Codex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/morpho-org/sdks/web3-security
Clone the repo
git clone --depth 1 https://github.com/morpho-org/sdks

Made for: Codex.

Per session 3 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,946 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin unknown No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00003 $0.01946
Opus 5 $0.00002 $0.00973
Sonnet 5 $0.00001 $0.00389
Haiku 4.5 $0.00000 $0.00195

Measured today against content hash 5c766620ee94, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

web3-security scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/pr-review-engine/agents/web3-security.md · 88 lines

How it starts

The opening of the file, as written. The whole thing — 88 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Web3 Security

The boundary between the SDK and the chain. Authoritative rules live in AGENTS.md §1 (the Action layer is pure encode-only, no state reads), §2 (typed errors), and §5 (security invariants — chainId validation, authorization, accounting, LLTV buffer, inflation-attack guard, deposit routing). The Action-layer rule and the chainId-validation invariant from §5 are the load-bearing parts; everything below is the application surface.

What to flag

Contract interaction shape

  • Address / function-signature mismatch. A readContract / writeContract / simulateContract call whose abi and address came from different registries (e.g. MORPHO_ADDRESS on chain A with an ABI loaded for chain B). The SDK pins ABIs + addresses in-package per §7; flag any call that constructs them dynamically without chainId gating.
  • Argument order / type drift. A functionName call whose args tuple doesn't match the ABI signature in argument count, ordering, or width (e.g. uint128 where the ABI declares uint256, leading to silent truncation).
  • Missing chainId validation before signing or sending. Per §5 — chainId validation is a security invariant. Every code path that produces a Transaction, a signed permit, or a typed-data signature must verify client.chain.id matches the expected chain before encoding. Flag any signing/sending path that trusts the caller's client without re-checking.

Transaction parameter integrity

  • Calldata encoding errors. encodeFunctionData calls whose abi and args don't match; selectors hand-rolled instead of derived via viem; magic hex literals for selectors that aren't pinned with a comment showing the source signature.
  • value field on a non-payable call or vice versa — either reverts onchain, but the SDK should fail in the encoder, not the chain.
  • gas / gasPrice / maxFeePerGas overrides that bypass viem's defaults silently. Flag any encoder-layer hardcoded gas; runtime estimation is fine, hardcoding is a footgun.

Read the full file on GitHub · 88 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 88 lines · 3 tokens per session scan A 5c766620ee94

Subscribe to this mod's changes

web3-security is an agent published in the GitHub repository morpho-org/sdks (40 stars, last pushed today), licensed MIT. It adds 3 tokens to every session and 1,946 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-01.