The mistake
A webhook handler that reads the event body and acts on it without stripe.webhooks.constructEvent; one that verifies JSON.stringify(req.body) instead of the raw bytes; one that catches a failed verification and carries on; or one that disables the timestamp tolerance.
Why it is dangerous
A webhook URL is public: anyone who finds it (it is in your code, your logs, or simply guessable, like /api/webhooks/stripe) can POST to it. Without a signature check, a forged checkout.session.completed unlocks a paid plan for free. Providers sign the exact bytes they send, so verifying re-serialized JSON fails at random and the usual "fix" is to turn the check off. Stripe signs a timestamp with the body; a tolerance of 0 / None disables replay protection in the SDK.
How to fix it
Verify the signature over the raw request body before reading the event, and return 400 when it fails:
// Next.js App Router
const rawBody = await req.text();
const event = stripe.webhooks.constructEvent(
rawBody, req.headers.get("stripe-signature"), process.env.STRIPE_WEBHOOK_SECRET);
# Python
event = stripe.Webhook.construct_event(payload, sig_header, secret)With Express, register express.raw({ type: "application/json" }) on the route before app.use(express.json()). Remember processed event ids, because providers deliver at least once.
What this checker looks for
This page runs webhook-check, which reads
route handlers in Next.js, Express, Fastify, Hono, FastAPI, Flask and Django. The rules most relevant to this page:
| Rule | What it finds |
|---|---|
WHK001 | Webhook handler does not verify the signature |
WHK002 | Signature checked against parsed / re-serialized JSON |
WHK004 | Hard-coded webhook signing secret |
WHK005 | Signature verification failure is ignored |
WHK007 | Webhook events are not de-duplicated |
WHK008 | Stripe signature tolerance disabled or very large |
Every finding has a rule id, a severity, file:line, the offending line (secrets masked),
why it matters and how to fix it. Run webhook-check rules for the full list.