{"slug": "your-x402-endpoint-is-one-header-away-from-working-for-free", "title": "Your x402 Endpoint Is One Header Away From Working for Free", "summary": "A developer building Argus, an adversarial testing tool for AI agents that move money, released a GitHub Action battery that probes x402 payment endpoints for validation failures such as serving resources before payment verification. In field reports, the team's own run against a live x402 resource on Vercel failed closed at the gate with zero cost charged, a ten-window idempotency battery against the mcp-tool-idempotency library passed 10/10 with one documented at-least-once window, and a pre-registered gate-hook battery against agentic-finance-graph 0.3.7 caught a race in which seven of eight parallel gate checks were allowed, roughly $1,400 of simultaneous spend against a $250-per-168h window.", "body_md": "We built an adversarial battery for AI agents that move money — here's what it caught when we pointed it at real x402 payment flows.\n\nThe x402 protocol is refreshingly simple: GET without payment → 402 with payment requirements → retry with a payment header → facilitator verifies and settles → 200. Simple enough that teams ship it in an afternoon. And simple enough that one missing header or one wrong comparison turns a paid resource into a free one — or a valid payment into a silent failure.\n\nWe are building Argus, an adversarial testing tool for exactly this class of systems. This post is a field report, not a pitch.\n\nThe happy path everyone tests — and the one nobody does\n\nA correct x402 implementation has two hard jobs:\n\nRefuse everything that isn't a valid payment. Wrong scheme, wrong asset, replayed nonce, expired quote, wrong payTo, unsigned body — every one of these must end in 402, not in a served resource.\n\nAccept valid payments exactly once. Retried signature, double-spend window, settle-after-verify failure semantics.\n\nThe failure mode in category 1 is scary in a quiet way: your endpoint works, tests pass, demo looks great — and the resource is served for free because the payment validation happens after the handler.\n\nWhat the battery does\n\nArgus ships as a GitHub Action (Argus battery on the Marketplace) — you wire it into CI, it spawns the real engine locally, drives your SUT over 127.0.0.1, and issues verdicts as a check run:\n\nFamily\n\nArgus plays\n\nYour SUT is\n\nSessions\n\nBC  bad client / buyer  seller  9\n\nS-BS    bad seller  buyer   6\n\nVerdicts are registry-grade: PASS, FAIL, DOCUMENTED (refusal probe with documented behavior — evidence, not failure), HARNESS_ERROR. A resource served despite an invalid payment is always FAIL. No judgment calls.\n\nThe engine itself is delivered as a sealed, Ed25519-signed bundle; the Action verifies the seal — manifest schema, key id, signature over the canonical manifest, tree_sha256 of the tarball — before running anything. A broken seal means zero execution.\n\nField report 1: our own run held at the gate\n\nWe eat our own food. In a recent BC run against our own console (the system under test was a live x402 resource on Vercel), the gate failed with a bare gate failed: fetch failed.\n\nThat message is useless — Node's fetch hides the real cause inside error.cause. We fixed the diagnostics first ([ENOTFOUND: ...], [ECONNREFUSED: ...], timeouts now land in evidence), and here's the part we're proud of:\n\nthe gate failed closed: the battery stopped at the gate instead of running half-armed;\n\nnothing was charged — the run returned its quota, clean cost 0;\n\nthe battery verdicts stayed honest.\n\nWhen money is involved, \"fail closed and explain\" is the feature. A harness that runs on a flaky network produces false FAILs — and false positives in payment testing teach people to ignore results.\n\nField report 2: an external engagement that shipped a fix\n\nNot x402 this time, but the same money-lifecycle class: we ran a ten-window idempotency battery against mcp-tool-idempotency — a library that gives exactly-once semantics to MCP tool calls, i.e. to \"AI agent did something expensive\" moments.\n\nTen windows probed: charge replay, retry-after-commit, in-flight takeover, cross-instance races, TTL boundaries. Result: 10/10 PASS on the release, with one documented at-least-once window coordinated with the maintainer before publication — and the upstream release (v0.2.0) now covers every window on both backends. The full engagement — before-state reproduction, disclosure, post-release verification — is sealed in our public registry.\n\nField report 3: a race in a live payment gate, closed in one day\n\nOn 24 Nov we pointed a pre-registered gate-hook battery at agentic-finance-graph 0.3.7 — an agent payment stack that enforces a $250-per-168h spending window. Six of the seven frozen expectations matched. The seventh caught a race: eight parallel gate checks, seven were allowed — roughly $1,400 of simultaneous pending spend against a $250 cap. No settlement ever happened (the race sits in the pending-check path), but one burst is all it would take.\n\nWe froze the transcripts and posted the finding. The vendor's reply, verbatim: \"The race is real on our side, and it is ours to fix.\" They wrote eight tests before touching the code, then deployed read-evaluate-insert under one advisory lock per agent and reference — live at 09:40 UTC the same day. A re-check against the patched gate: 1 allow, 7 blocks, exactly as the spec demands.\n\nThat is the whole loop working end to end: pre-registered expectations → adversarial run → sealed evidence → vendor fix → public re-check. Every stage is verifiable in the registry; none of it requires trusting us.\n\nThe proof layer: why \"trust us\" isn't enough\n\nEvery claim above is pinned in a hash-chained attestation registry with Ed25519 signatures. Records pin evidence by SHA-256; a CI verifier re-checks every pinned byte on each push and fails the build on any drift. We learned this one the hard way: a lint commit once reformatted a pinned test file, and CI turned red within minutes. That's the system working as intended.\n\nYou don't have to trust us. Verify in one command:\n\nbash\n\ngit clone [https://github.com/igor-vii/Argus-Agent-Test-Lab](https://github.com/igor-vii/Argus-Agent-Test-Lab)\n\ncd Argus-Agent-Test-Lab && node tools/registry/verify-registry.mjs\n\nThe track record so far\n\nThis is not one lucky find. The lab currently holds 32 signed records (23 seals, 5 findings, 4 corrections) against ~20 external subjects — from protocol SDKs (Cloudflare agents, Circle batching, Coinbase CDP) to live community gateways. Four fixes have shipped by three vendors in response to our runs, and two independent third parties have re-verified the registry chain with the verifier above. Every hostile battery ran at $0.00 — free endpoints, no keys, no settlements. Full table with links to every record and verbatim vendor quotes: TRACK_RECORD.md.\n\nTry it on your x402 endpoint\n\nInstall Argus battery into your workflow.\n\nDrop an argus.sut.json contract into your repo root.\n\nRun CI — verdicts land as a check run with per-session annotations and a JSONL evidence artifact.\n\nThe first paid run shows the price and balance; no silent charges. Zero balance returns 402 — the protocol's own error, used against the protocol's own customers, which we think is the right kind of recursion.\n\nLanding: [https://argus-lab.tech?utm_source=devto](https://argus-lab.tech?utm_source=devto) · Proof repo: [https://github.com/igor-vii/Argus-Agent-Test-Lab](https://github.com/igor-vii/Argus-Agent-Test-Lab)\n\nIf you ship an x402 resource and want a battery scenario added to the lab registry, open an issue — scenario families grow with real-world flows, not synthetic ones.", "url": "https://wpnews.pro/news/your-x402-endpoint-is-one-header-away-from-working-for-free", "canonical_source": "https://dev.to/igorvii/your-x402-endpoint-is-one-header-away-from-working-for-free-11d0", "published_at": "2026-11-24 13:39:23+00:00", "updated_at": "2026-11-24 13:46:44.997580+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "ai-safety", "agent-protocols", "developer-tools"], "entities": ["Argus", "x402", "Vercel", "mcp-tool-idempotency", "agentic-finance-graph", "GitHub"], "also_reported_by": [], "takeaway": "An x402 endpoint that validates payment after the handler serves the resource for free, so payment checks must run before the handler and every invalid scheme, asset, nonce, quote, payTo or unsigned body must return 402.", "recommendation": {"advice": "Run an adversarial payment battery in CI that replays bad schemes, nonces, quotes and unsigned bodies against your x402 endpoint, and fail closed when the gate cannot reach the system under test.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/your-x402-endpoint-is-one-header-away-from-working-for-free", "markdown": "https://wpnews.pro/news/your-x402-endpoint-is-one-header-away-from-working-for-free.md", "text": "https://wpnews.pro/news/your-x402-endpoint-is-one-header-away-from-working-for-free.txt", "jsonld": "https://wpnews.pro/news/your-x402-endpoint-is-one-header-away-from-working-for-free.jsonld"}}