Skip to content

fix(api): reject invalid explicit author chain contexts - #242

Open
dirtybits wants to merge 1 commit into
mainfrom
fix/reject-invalid-author-chain-context
Open

dirtybits wants to merge 1 commit into
mainfrom
fix/reject-invalid-author-chain-context

Conversation

@dirtybits

Copy link
Copy Markdown
Owner

Summary

GET /api/author/[pubkey] treats a missing chainContext for an EVM-shaped address as the Base Sepolia default. Before this change, an explicitly supplied but unrecognized context (for example eip155:999) normalized to null and took that same default path.

The route now keeps the raw query value long enough to distinguish an omitted context from an invalid explicit one. Unsupported non-empty values receive 400 { "error": "Unsupported chain context" } before any Base trust or identity lookup. The normal missing-context default and the existing explicit Base-mainnet rejection remain unchanged.

Test plan

  • RED: npm test --workspace @agentvouch/web -- __tests__/api/author-route.test.ts --maxWorkers=1 --no-fileParallelism failed before the route change: eip155:999 reached the Base Sepolia branch instead of returning a client error.
  • Focused route test after the fix: 10 tests passed.
  • npm run format:check — passed.
  • npm run lint — passed.
  • npm run typecheck — passed with Node v24.10.0.
  • npm test — passed: web 152 files / 1,312 tests; CLI 13 files / 77 tests.
  • git diff --check origin/main...HEAD — passed.
  • npm exec --workspace @agentvouch/web -- next build --webpack compiled successfully and completed TypeScript, but exited during /sitemap.xml prerender because this cron checkout has no gitignored web/.env.local / DATABASE_URL. The pre-existing ox/viem dynamic-import warning remained. No environment or application configuration was changed.

Scope and rollback

Two files only: web/app/api/author/[pubkey]/route.ts and web/__tests__/api/author-route.test.ts. No database, chain, dependency, or money-flow changes.

Rollback is a revert of this commit; no persisted state requires cleanup.

This branch was successfully deployed

1 active deployment
Preview — e0287371 Deployed Oct 14, 2026 by vercel[bot]
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