Skip to content

fix(x402): validate server payment requirements before signing in pay and eip3009AuthenticatedFetch#11

Open
Nexory wants to merge 1 commit into
ProjectOpenSea:mainfrom
Nexory:fix/x402-validate-payment-requirements
Open

fix(x402): validate server payment requirements before signing in pay and eip3009AuthenticatedFetch#11
Nexory wants to merge 1 commit into
ProjectOpenSea:mainfrom
Nexory:fix/x402-validate-payment-requirements

Conversation

@Nexory

@Nexory Nexory commented Jun 10, 2026

Copy link
Copy Markdown

What

The pay CLI signed the server-supplied 402 payment requirements directly via signX402Payment without any validation. This wires the existing validatePaymentRequirements guard (now exported from x402-payment) into the CLI path before signing:

  • rejects burn/zero payTo addresses,
  • enforces the expected network USDC asset,
  • with the new --max-amount flag, rejects amounts above the caller's cap.

Adds focused unit tests for the guard.

Note on scope

Re-scoped after the lib-level validatePaymentRequirements landed in main: this PR now only applies that existing guard on the pay CLI path (which still signed server requirements unvalidated) and adds the --max-amount cap plus tests. Earlier auth/manifest changes were dropped to keep this focused on the validation fix.

Testing

  • npm run type-check
  • npm run test (636/636 passing, including the new validate-payment-requirements suite)
  • npm run lint (biome, clean)

… signing

The pay CLI signed the server-supplied 402 payment requirements directly via signX402Payment without validation. Apply the existing validatePaymentRequirements guard (now exported from x402-payment) on the CLI path before signing: reject burn/zero payTo addresses and, with the new --max-amount flag, reject amounts above the caller's cap. Adds focused tests for the guard.
@Nexory Nexory force-pushed the fix/x402-validate-payment-requirements branch from 55d8f5b to e8d54a0 Compare June 16, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant