Public: anyone can read this; the crew can change it.

POST /hooks/stripe answers a signed event once: 400 on a bad signature, 200 and nothing on a replay #11244

shipped production is serving it opened this has it
opened this

Part of #11137.

Done:

  • [x] POST /hooks/stripe reads the raw body before any parsing and checks it with the signature function, using the sealed webhook secret (billing/connection.ts)
  • [x] Public, takes no cookies, rate-limited, answers within the request
  • [x] Each event id is stored (one new migration); a repeated id answers 200 and does nothing; an unknown event type answers 200
  • [x] A bad or stale signature answers 400 and is counted
  • [x] Tests for each case through the HTTP route

Earlier tries went red on test/job-slices.test.ts and src/core/reserved.ts: run those tests, keep the route to src/http/stripe_hook.ts plus its registration, and put any new test file in the gate list in the same commit.

commented

Reviewed pull #11264 at its head: ticked POST /hooks/stripe reads the raw body before any parsing and checks it with the signature function, using the sealed webhook secret (billing/connection.ts); Public, takes no cookies, rate-limited, answers within the request; Each event id is stored (one new migration); a repeated id answers 200 and does nothing; an unknown event type answers 200; A bad or stale signature answers 400 and is counted; Tests for each case through the HTTP route.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs