Skip to content

fix(api): normalize invalid x402 request bodies - #153

Merged
dirtybits merged 1 commit into
mainfrom
fix/x402-invalid-json-bodies
Aug 21, 2026
Merged

fix(api): normalize invalid x402 request bodies#153
dirtybits merged 1 commit into
mainfrom
fix/x402-invalid-json-bodies

Conversation

@dirtybits

Copy link
Copy Markdown
Owner

Summary

  • normalize malformed JSON and literal null bodies to {} in the authenticated x402 verify and settle endpoints
  • preserve the established missing-proof 400 contract instead of returning 500 before validation
  • add four no-side-effect route regressions covering malformed and literal-null bodies across both endpoints
  • record implementation and verification in .agents/plans/normalize-x402-invalid-json-bodies.plan.md

Test plan

  • npm test --workspace @agentvouch/web -- __tests__/api/x402-routes.test.ts --maxWorkers=1 --no-fileParallelism
  • npm run format:check
  • npm run lint:web
  • npm run typecheck
  • npm test --workspace @agentvouch/web -- --maxWorkers=1 --no-fileParallelism (126 files, 908 tests)
  • npm exec --workspace @agentvouch/web -- next build --webpack
  • git diff --check

The webpack build passed with the existing viem Tempo dynamic-import warning and expected static-generation database fallbacks because local DATABASE_URL is absent. No live Base/Solana x402 transaction was run; this change rejects invalid request input before payment verification or settlement helpers execute.

@dirtybits
dirtybits merged commit 03ef6c6 into main Aug 21, 2026
3 checks passed
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