Razorpay webhook signature verification check

Drop your project or paste your Razorpay webhook route to check that X-Razorpay-Signature is verified correctly.

Run the check

Drop a project folder or files here

node_modules, .git, virtualenvs and build folders are skipped. Limit 25 MB / 5,000 files.

The Python engine (Pyodide, a few MB, cached by your browser) loads when you start.

The mistake

A Razorpay webhook handler that never checks X-Razorpay-Signature; computes the HMAC over JSON.stringify(req.body) after express.json() has parsed it; compares the signature with ===; or has the webhook secret written into the code.

Why it is dangerous

Anyone can POST a forged payment.captured event to a public webhook URL. Razorpay signs the exact bytes it sends; JSON.stringify produces different bytes, so valid events fail at random and the check gets switched off. == / === on strings stops at the first differing byte, so the response time leaks how much of a guessed signature is right. A hard-coded secret lets anyone with the code sign their own events.

How to fix it

Compute HMAC-SHA256 of the raw body with the webhook secret, compare it with X-Razorpay-Signature in constant time, and stop the request when it fails:

// Express: raw body on this route, registered before express.json()
app.post("/api/webhooks/razorpay", express.raw({ type: "application/json" }), handler)

# Python
client.utility.verify_webhook_signature(payload.decode(), signature, secret)

Use crypto.timingSafeEqual / hmac.compare_digest, and keep the secret in an environment variable.

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:

RuleWhat it finds
WHK001Webhook handler does not verify the signature
WHK002Signature checked against parsed / re-serialized JSON
WHK003Signature compared with == instead of a constant-time comparison
WHK004Hard-coded webhook signing secret
WHK005Signature verification failure is ignored
WHK007Webhook events are not de-duplicated

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.

FAQ

Is this the same as payment signature verification?

No. Webhooks are signed over the raw body with the webhook secret. The Checkout success handler is a different check: see the Razorpay payment signature verification page.

Does it understand Python handlers?

Yes: FastAPI, Flask and Django, including client.utility.verify_webhook_signature.

Are my files uploaded anywhere?

No. The checker is Python running inside your browser tab (Pyodide, WebAssembly). Your files are read with the browser's File API and written into an in-memory file system that exists only in this tab. Your files are never sent anywhere. The only network requests load the Python runtime and the checker code, plus Google Analytics page-view counting, which never sees your files. You can disconnect from the internet after the engine has loaded and the scan still works.

Is a clean report a guarantee?

No. It is a static check for known patterns, not a penetration test. A clean report means none of these patterns were found, nothing more.

Can I run the same check on my machine or in CI?

Yes. Every checker on this site is an open-source command-line tool (MIT licence, Python 3.10+ standard library only). The results here are the same as `scan --json` on the command line, except for checks that need git (whether a file is committed or ignored), which cannot run in a browser.