Webhook Signature Verifier for Stripe, GitHub, Slack and More
Operator: Abdulla Al Fahad. How tools are built and checked
The most common webhook bug is not a wrong secret. It is a body that is not the body: a framework parsed the JSON and wrote it back with different spacing, a proxy added a trailing newline, or a text field in a test tool turned CRLF into LF. The HMAC is computed over bytes, so any of these produces a valid-looking but non-matching signature, and the error message is always just the same.
This page verifies a signature from pasted headers for Stripe, GitHub, Slack, Shopify and Twilio or for a generic HMAC scheme you describe. When the signature does not match, it re-runs the check with the usual mutations of the body, the secret and the hash, and reports the one that makes it match. It can also work the other way and compute the headers a sender would attach, so you can test your own endpoint.
Key features
- Stripe, GitHub (SHA-256 and legacy SHA-1), Slack, Shopify and Twilio schemes, each with its own signed string, hash and encoding
- Generic HMAC-SHA1, SHA-256 or SHA-512 with a message template using {body}, {timestamp}, {id} and {url}, hex, base64 or base64url output, a value prefix, and the secret read as text, hex or base64
- Timestamp tolerance for Stripe and Slack, against the real time or a time you choose for replaying an old capture
- Mismatch finder: trailing newline, CRLF and LF, byte-order mark, re-serialised JSON, padded secrets, whsec_ handling, other hashes, and Twilio URL variants
- Body from a file to keep exact bytes, and a compute mode that prints the headers and a curl command
What each provider signs, and what the mismatch finder tries
Stripe signs the timestamp, a literal dot and the raw body with HMAC-SHA256 and writes hex. The Stripe-Signature header carries t=<unix seconds> and one or more v1=<hex> values; the check passes if any v1 matches, and the timestamp must be within the tolerance, 300 seconds by default. The endpoint secret begins with whsec_ and Stripe's libraries use the whole string as the key, so it is entered as text.
GitHub signs the raw payload with HMAC-SHA256 and sends sha256=<hex> in X-Hub-Signature-256; the older X-Hub-Signature carries sha1=<hex>. Slack signs the string v0:<timestamp>:<body> with the app's signing secret and sends v0=<hex>, with the time in X-Slack-Request-Timestamp. Shopify signs the raw body with HMAC-SHA256 and sends base64 without any prefix in X-Shopify-Hmac-Sha256, which is why a hex comparison against it always fails.
Twilio is different. It signs the full URL, followed by each POST parameter's name and value concatenated in alphabetical order, using HMAC-SHA1 and base64 with the account's Auth Token. The URL must be exactly the one configured in the Twilio console, including http or https, a port and a trailing slash. For JSON bodies there are no parameters: Twilio signs the URL alone, and the URL contains a bodySHA256 query parameter that the receiver must check against the body, which this page also does.
For the mismatch finder, the baseline is the body and secret as given. The page then tries the body without a trailing newline, with one added, with CRLF turned into LF and the reverse, without a byte-order mark, trimmed, and re-serialised as minified or two-space-indented JSON, each with the secret as given and, where relevant, trimmed or stripped of whsec_. If nothing matches, it tries the other two hash functions. A match is reported as the single change that explains it, which is the one thing to fix in your handler.
How it works
Every scheme reduces to the same step: build the exact bytes the sender signed, run HMAC over them with the secret, encode the result and compare it with the header in constant time. The schemes differ in what the signed bytes are (the body alone, a timestamp and the body, a version tag, or a URL and sorted parameters), in the hash, and in whether the result is hex or base64.
When the first comparison fails, the page changes one thing at a time and re-signs: first the body (edits to whitespace, line endings, byte-order mark and JSON formatting), each with the secret as given and cleaned, and then the hash. It never guesses a different secret, and it stops at the first change that matches, so what you see is one concrete cause rather than a list of possibilities.
Common use cases
- Finding out why a Stripe handler rejects events in production but works with the CLI: the body is being parsed before verification
- Replaying a captured Slack request from last week by setting the time to when it was sent
- Generating a valid GitHub or Shopify header to test a handler locally with curl
- Checking a partner's custom HMAC scheme before writing the receiver, by describing it as a template
- Confirming that a Twilio signature failure is a URL mismatch behind a proxy that changed http to https
How to use this tool
- Pick the provider and paste the raw body, or drop it as a file if line endings matter.
- Enter the signing secret and paste the request headers; the signature header is found by name.
- Press Verify signature. If it fails, read the explanation: it names the one change that makes the signature match. To produce a signature instead, switch to Compute and copy the headers or the curl command.
Example
Stripe request
Body (as logged by the handler): {
"id": "evt_1"
}
Secret: whsec_test
Stripe-Signature: t=1700000000,v1=c89214b5b5da833daed6f0b8c5bb6bd58cea9022bd80ccc78230f3942d632925Result
The signature does not match.
The signature matches when you use the JSON re-serialised without spaces (a framework parsed it and wrote it back).
The sender signed {"id":"evt_1"}; your handler is hashing the pretty-printed copy. Read the raw request body before any JSON parsing.Common pitfalls
Pasting a body into a text box can alter it: browsers normalise line breaks to LF in textareas. If a body contains CRLF, load it from a file so every byte is kept.
A signature proves the sender knew the secret and the body was not changed. It does not prove the event is new (use the timestamp or an event id) or that the event is one you wanted.
A production secret pasted into any web page is exposed to that page. Use a test secret or rotate the secret after debugging.
- In Express, mount the webhook route with express.raw({ type: 'application/json' }) before any JSON middleware, and pass the Buffer to the verifier unchanged.
- Compare signatures with a constant-time function in your own code, and reject Stripe and Slack requests whose timestamp is outside the tolerance, since a valid old signature is a replay.
Common errors and how to fix them
- "The header Stripe-Signature was not found in the pasted headers"
- Paste the headers as Name: value lines. Header names are matched without regard to case, but the name has to be present and spelled as the provider sends it.
- "Twilio signs the full request URL, so enter the exact URL Twilio called"
- Enter the webhook URL as configured in the Twilio console, not the URL your server sees after a proxy rewrote the scheme or port.
- The signature is valid but the page reports it as outside the tolerance
- The timestamp in the header is too old for the tolerance. Set Treat the time now as to the moment the request was made if you are replaying a capture, or raise the tolerance for the test.
Best practices
- Verify before you parse, using the raw bytes, and return a plain 400 without saying which check failed, so a caller learns nothing about the secret or the signed string.
Frequently asked questions
Why does the page ask for headers and not just the signature?
Some schemes keep the timestamp in a separate header (Slack) or inside the signature header (Stripe), and the page has to read it to rebuild the signed string and to check the tolerance.
Can I use it for a provider that is not listed?
Often yes, through Generic HMAC. Choose the hash, say how the signature is encoded, set the header name and prefix, and write the signed message as a template such as {timestamp}.{body}.
Why does verification fail only on serverless or behind an API gateway?
The platform may hand your function a parsed object, or a base64-encoded body flagged as such (isBase64Encoded on AWS API Gateway). Decode and verify the original bytes, not a re-built string.