Skip to content

fix: verify webhooks after Vercel JSON parsing - #701

Merged
devswha merged 1 commit into
mainfrom
hotfix/polar-webhook-body
Aug 18, 2026
Merged

fix: verify webhooks after Vercel JSON parsing#701
devswha merged 1 commit into
mainfrom
hotfix/polar-webhook-body

Conversation

@devswha

@devswha devswha commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Fix

Vercel's plain Node /api helper may supply an already-parsed JSON body even with bodyParser:false. Re-serialize that object before Standard Webhooks verification.

This stays fail-closed: only an exact byte match to Polar's signed compact JSON is accepted. Arrays and oversized bodies remain rejected.

Production evidence

A signed-shape smoke request reached /api/polar-webhook but returned 400 before signature/config evaluation, identifying the parsed-body adapter gap.

Verification

  • webhook unit tests: 6 pass, including parsed Vercel body acceptance and tamper rejection
  • npm run lint: pass
  • npm test: 1684 pass, 2 skipped

@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
patina Ready Ready Preview Aug 18, 2026 9:27am

Request Review

@devswha
devswha merged commit 25f411e into main Aug 18, 2026
8 checks passed
@devswha
devswha deleted the hotfix/polar-webhook-body branch August 18, 2026 09:30
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