Skip to content

conformance: x402 core conformance-vector set + stdlib runner (#2178) - #2776

Open
msaleme wants to merge 2 commits into
x402-foundation:mainfrom
msaleme:feat/conformance-vectors
Open

msaleme wants to merge 2 commits into
x402-foundation:mainfrom
msaleme:feat/conformance-vectors

Conversation

@msaleme

@msaleme msaleme commented Jul 3, 2026 •

Copy link
Copy Markdown

Summary

An open, dependency-free x402 conformance-vector set — delivering the open-source conformance harness proposed in #2178.

A protocol with governance but no conformance vectors is a promise, not a guarantee: two implementations can each claim x402 compliance and still diverge on the same request. This set lets an implementer prove conformance.

What's here (conformance/)

  • 52 core conformance vectors (vectors/x402-core/) — each a normative x402 requirement plus the request that exercises it (payment-challenge structure, recipient/amount integrity, session security, spending limits, facilitator trust, info disclosure, cross-chain confusion, replay/double-spend, authorization bypass, settlement finality, protocol abuse).
  • run_conformance.py — stdlib-only runner (no dependencies): --validate (offline schema check) and --url (replay each vector against your endpoint and report the response against each requirement).
  • schema.json — the vector schema.

Design

Vectors are data, not a reference implementation — you test your x402 code against them. They're generated from the Apache-2.0 agent-security-harness so they stay faithful to a maintained suite (provenance in each vector's source).

Roadmap (in the README): optional machine-checkable assert blocks for auto-judging deterministic vectors, and an extension conformance set alongside the relevant extension spec.

Why it matters

While building the harness these vectors come from, adversarial review of its own reference verifier caught three fail-open defects in that harness code (a credential-release check trusting a self-asserted flag, a scope check that failed open on an omitted field, and an SSRF blocklist that missed most of the RFC1918 172.16/12 range) — each fixed and guarded by a negative test before release. Fail-open is easy to ship even in code written to catch it; that is exactly why machine-checkable conformance vectors are worth having.

Apache-2.0, matching this repo. Happy to align vectors to your preferred layout/schema.

@vercel

vercel Bot commented Jul 3, 2026

Copy link
Copy Markdown

@msaleme is attempting to deploy a commit to the Coinbase Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the unverified Pull request contains unverified commits label Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for your contribution @msaleme!
Note that we require commit signing, please rebase and verify your commits.

See here for instructions: https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification

The team will not review this PR before ALL commits have been verified and it will be closed after 1 week of inactivity.

Unverified commits:

  • e64cbbd: unsigned
  • 68e959d: unsigned

msaleme added 2 commits July 3, 2026 10:18
…02-foundation#2178)

52 dependency-free x402 core conformance vectors (a normative requirement +
the request that exercises it) with a JSON schema and a stdlib runner that
replays them against a live implementation. Delivers the open-source
conformance harness proposed in x402-foundation#2178.

Vectors are generated from the Apache-2.0 agent-security-harness so they stay
faithful to a maintained suite (provenance in each vector's source field).
Building them against a reference x402 hardening implementation surfaced three
fail-open defects (credential-release flag-trust, scope fail-open, SSRF
172.16/12 range gap) — all disclosed and guarded.

Signed-off-by: Michael K. Saleme <mikesaleme@gmail.com>
…rness's own reference verifier (not an external implementation)

Signed-off-by: Michael K. Saleme <mikesaleme@gmail.com>
@msaleme
msaleme force-pushed the feat/conformance-vectors branch from 68e959d to 5f7ead7 Compare July 3, 2026 15:27
@github-actions github-actions Bot removed the unverified Pull request contains unverified commits label Jul 3, 2026
@ahouramasoud1369-alt

Copy link
Copy Markdown

Verified

@msaleme

msaleme commented Aug 3, 2026

Copy link
Copy Markdown
Author

Checking in on this one. Current state from my side:

  • check-verified-commits is passing. Both commits show as verified, so the signing request from the automated comment above is resolved.
  • labeler is passing.
  • The only red check is Vercel, reporting Authorization required to deploy. That is a deploy authorization on the Coinbase Vercel team, which I do not think a fork contributor can satisfy.

No reviews yet, so I wanted to confirm the PR is not waiting on something from me. Happy to rebase, split it into smaller pieces, or narrow the scope if that would make it easier to review.

@msaleme

msaleme commented Aug 8, 2026

Copy link
Copy Markdown
Author

@CarsonRoscoe @phdargen apologies for the direct tag. I'm trying to get this routed rather than
continue bumping it.

I found a possible routing gap: conformance/ is not matched by .github/CODEOWNERS, and there is
no catch-all rule. That may explain why no automatic reviewer was requested.

Could one of you point me to the appropriate reviewer or owning team for this path? If a CODEOWNERS
entry would help, I'm happy to submit that separately.

One other question: does the failing Vercel check block merge? It reports Authorization required to deploy against the Coinbase team, which does not appear actionable by a fork contributor. The
remaining checks are green and both commits are verified.

If PR size is the obstacle, I can split the runner, schema, README, and a representative vector set
from the remaining vectors. Otherwise, I would prefer to keep the complete conformance set
together.

@shibutatsu shibutatsu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this together. I checked the current PR head and ran the offline validator successfully. The corpus is useful staging material, but I see two issues that need to be separated before it can arbitrate x402 core conformance.

First, the live runner does not execute most of the vector semantics. It only consumes path, headers, and body; fields such as variants, n_requests, concurrent_requests, or attacker inputs are ignored. For example, X4-002, X4-011, and X4-043 all reduce to one ordinary GET request, and response bodies are not recorded even for disclosure checks. The report therefore cannot support the stated requirement for those vectors. I would either encode concrete executable request cases plus observation/assertion rules, or mark these entries as metadata-only and exclude them from --url replay until that exists.

Second, the normative source needs to be explicit per vector. Requirements such as OATR presence, a fixed manifest TTL, session-token controls, or application rate limits do not appear to be x402 core requirements. Marking them MUST under an x402-core directory can make an otherwise conforming implementation look non-conformant. A pinned x402 spec version and exact section or requirement reference should be required for core vectors; harness-specific hardening checks can live in a separately named optional security profile.

Once those boundaries are explicit, the dependency-free format and reproducible data layout could be a solid base for shared vectors.

@msaleme

msaleme commented Aug 17, 2026

Copy link
Copy Markdown
Author

You are right on both points. I checked the full corpus rather than only the examples.

At the current head, replay() consumes only request.path, request.headers, and request.body. Forty-six of the 52 vectors contain none of those fields. They therefore fall back to /: 45 issue a bare GET and X4-024 issues a body-less POST. The runner records only status and headers, so disclosure-body expectations cannot be evaluated.

--validate currently checks that request is a dict, but not that it contains an executable request or assertion rules. Those vectors can therefore validate despite not being meaningfully replayable.

You are also right on normativity. The current schema has no required pinned x402 specification version or exact section reference. The source field identifies provenance; it does not establish normative authority. Treating these as MUST core-conformance vectors is not supportable on that basis.

I will narrow the PR accordingly:

  1. Require pinned spec version and exact requirement reference for x402-core.
  2. Move non-core hardening checks to a separately named optional profile.
  3. Mark vectors without concrete request and assertion semantics as metadata-only, excluding them from --url replay.
  4. Record response bodies where a vector's assertion requires them.

This reduces the scope of the PR, but makes its conformance claims defensible. Thank you for the careful review.

@ahouramasoud1369-alt

Copy link
Copy Markdown

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

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants