Key points
- Stripe signs
t.body, Slack signsv0:t:body, and GitHub and Shopify sign the raw body alone, all with HMAC-SHA256. - Six small edits to an 88-byte body (whitespace, key order, a newline, a Unicode form) failed all four schemes in our test: 24 of 24 checks.
- Two of the four schemes put a time inside the signature (Stripe and Slack). GitHub and Shopify leave repeated deliveries to delivery IDs and idempotent handling.
- One Shopify signature has four base64 spellings that decode to the same 32 bytes, so compare decoded bytes and check the length first.
- Stripe’s
v0entry is a test fake to ignore, while Slack’sv0is its live scheme.
A webhook is an HTTP request that a service such as Stripe or GitHub sends to your server when something happens, and its signature header lets your code check who sent it and that nothing changed in transit. Stripe, GitHub, Shopify and Slack all sign with HMAC-SHA256, a keyed-hash message authentication code (MAC), but they sign three different strings and write the result four different ways. On 24 November 2026 we signed one 88-byte test body with a throwaway key under all four schemes and changed the body six ways; all 24 checks failed. A seventh copy, made by a Node.js parse-and-stringify round trip, passed only because it happened to return identical bytes.
What goes into each signature
Stripe’s webhooks documentation describes a signature over the timestamp, a full stop and "the unmodified HTTP request body", sent as v1 entries beside t= in the Stripe-Signature header. Its examples are hex, and Stripe’s Node library, stripe-node v23.2.0, computes hex. According to GitHub’s page on validating webhook deliveries, a hex digest of the payload arrives in X-Hub-Signature-256 and "always starts with sha256=".
Shopify’s verify-deliveries page documents base64 with no prefix, computed over the raw body. On Slack’s request-verification page, the signed string is v0, the timestamp and the body joined with colons, and the hex digest carries a v0= prefix; the timestamp also travels in X-Slack-Request-Timestamp. GitHub’s and Slack’s published example values reproduced exactly in our check.
GitHub and Shopify sign identical bytes, so their headers differ only in encoding. Which hash to use in the first place is the subject of our guide to choosing a hash, where webhook signatures get one row.
Parsed JSON is rarely the body that was signed
We checked each changed copy of the 88-byte body against the four original headers.
| Body as received | Bytes | Checks passed |
|---|---|---|
| Original | 88 | 4 of 4 |
Node JSON.stringify(JSON.parse(body)) | 88 | 4 of 4 |
| Pretty-printed, two-space indent | 109 | 0 of 4 |
| Same keys, different order | 88 | 0 of 4 |
Python json.dumps default style | 101 | 0 of 4 |
| Trailing line feed | 89 | 0 of 4 |
| Trailing CRLF (carriage return plus line feed) | 90 | 0 of 4 |
é as e plus a combining accent | 89 | 0 of 4 |
Reordered keys keep the length and still fail, because the MAC covers bytes and knows nothing of JSON. The Node round trip is the trap. A test with a compact body passes, and the same code fails on the first body the parser cannot reproduce. On a second, 111-byte body holding 12.50 and a 20-digit integer, Node 26, Python 3.9 and PHP 8.5 all changed the bytes, even Python’s compact setting.
printf '%s' '{"id":"evt_test_0001","type":"order.paid","amount":1250,"currency":"SGD","note":"café"}' > body.json
node -e 'const b=require("fs").readFileSync("body.json","utf8");console.log(JSON.stringify(JSON.parse(b))===b)'
true
python3 -c 'import json;b=open("body.json",encoding="utf-8").read();print(json.dumps(json.loads(b))==b)'
FalseOWASP’s Webhook Security Cheat Sheet already lists re-serialising, reordering, whitespace, line endings and re-encoding as ways to break a signature, and Stripe, Shopify and GitHub each warn against a modified body. All of them point to the same defence, which is to capture the request body as bytes before any parser touches it.
Stripe and Slack put the time inside the MAC
Stripe says its libraries "have a default tolerance of 5 minutes" and that a tolerance of 0 "disables the recency check entirely"; a retried event gets a new timestamp and signature. Slack’s sample rejects a gap of more than 60 × 5 seconds either way. In our verifier, editing t by one second broke the signature, and a genuine header was accepted when checked 300 seconds after t and rejected at 301 seconds.
Read in its source at v23.2.0 and not run, stripe-node rejects a timestamp more than 300 seconds old and sets no lower bound, where the documentation speaks of anything "outside your tolerance". That matters only for clock skew, since t cannot be moved without the secret.
GitHub and Shopify sign the body alone, so a delivery resent byte for byte verifies, and GitHub’s delivery ID, like Shopify’s delivery-ID and timestamp headers, sits outside the MAC. OWASP notes that verification "alone does not stop repeated processing". GitHub’s best practices page suggests X-GitHub-Delivery to keep deliveries unique, adding that a redelivery you request keeps the same ID; Shopify points to X-Shopify-Webhook-Id, and Stripe to logging the event IDs you have processed.
Reproducing the headers in a browser
Every header above can be rebuilt by hand in our HMAC generator. Enter w222-test-key-not-a-real-secret as the secret, choose SHA-256 and paste the body without a trailing newline. The hex output then starts 964fd014, which is GitHub’s value once sha256= goes in front, and the base64 output is Shopify’s header. Typing 1795000000. before the body gives Stripe’s v1 value, and v0:1795000000: gives Slack’s. One press of Enter after the body changes the output to e14b6aa6…, the trailing line feed in the table.
Browser text boxes rewrite line endings
A browser text box turns CRLF into LF, so a body sent with CRLF line endings cannot be reproduced by pasting it. Our test body with a trailing CRLF should give 8163a5f9…; pasted into a text box it signs as the LF version, e14b6aa6….
The page says this beside its Message field. For a body with CRLF endings, sign the saved bytes in a terminal instead.
The page has no compare field, no clock and no binary-secret input. Node’s built-in crypto gives the same four headers from the saved bytes.
node -e 'const c=require("crypto"),b=require("fs").readFileSync("body.json"),k="w222-test-key-not-a-real-secret",t="1795000000",mac=(m,e)=>c.createHmac("sha256",k).update(m).digest(e);console.log("X-Hub-Signature-256: sha256="+mac(b,"hex"));console.log("Stripe-Signature: t="+t+",v1="+mac(Buffer.concat([Buffer.from(t+"."),b]),"hex"));console.log("X-Shopify-Hmac-Sha256: "+mac(b,"base64"));console.log("X-Slack-Signature: v0="+mac(Buffer.concat([Buffer.from("v0:"+t+":"),b]),"hex"))'
X-Hub-Signature-256: sha256=964fd01413858486cbeeeca05afdceb367cfc83973a82367ea27a38e6e9fc7a8
Stripe-Signature: t=1795000000,v1=fc40ca83825cc0d59df45b8d018f52dd8cfd02f238b406b86d62f818021f5204
X-Shopify-Hmac-Sha256: lk/QFBOFhIbL7uygWv3Os2fPyDlzqCNn6iejjm6fx6g=
X-Slack-Signature: v0=53b3b52a0070134fd68ffccd5442f67c07daa56ebc460045163f2f251d617886Secret rotation adds a second signature
Stripe lets you delay an old secret’s expiry by up to 7 days, and meanwhile it "generates one signature per secret". Code that reads only the first v1 rejects a genuine delivery during that window. Stripe asks for a comparison against every v1, in whatever order the entries arrive. Shopify differs, since after a rotation "it can take up to an hour" before deliveries use the new secret.
The header we built for a rotation
t=1795000000,v1=3c845b47…,v1=fc40ca83…,v0=00000000…
The first v1 is signed with a second throwaway key standing in for the old secret, and the other v1 with the current key. The v0 entry of zeros stands in for the fake Stripe adds to sandbox events. Accepting any matching v1 passed this header; reading only the first rejected it.
Compare decoded bytes in constant time
GitHub’s advice reads "Never use a plain == operator" and points to a constant-time function such as crypto.timingSafeEqual; OWASP gives the same rule. We tried to time the difference in Node and the ranges overlapped too much to mean anything, so we publish no timing figure.
Shopify’s published sample decodes both values from base64 and compares bytes. A 32-byte MAC becomes 44 base64 characters with one =, and the last data character carries two spare bits, so our header could end 6g=, 6h=, 6i= or 6j= and decode to the same bytes. A decoded comparison accepted all four and a string comparison accepted one. That does not weaken Shopify’s scheme, since all four carry the correct MAC; it bites where the header is stored or deduplicated as text. Our guide to sixteen spellings of one byte shows the same effect on a single byte.
Node 26.13.0 decodes base64 leniently, and a valid header with !!! appended still compared equal. Given a decoded value of the wrong length (a hex digest, a header cut short by four characters, an empty header), Shopify’s sample as published threw a RangeError in all three cases. Checking for 32 bytes before comparing, and treating any exception as a rejection, turns each of those three into a plain rejection.
python3 -c 'import hmac,hashlib,base64;b=open("body.json","rb").read();k=b"w222-test-key-not-a-real-secret";mac=hmac.new(k,b,hashlib.sha256).digest();gh="sha256=964fd01413858486cbeeeca05afdceb367cfc83973a82367ea27a38e6e9fc7a8";sh=base64.b64decode("lk/QFBOFhIbL7uygWv3Os2fPyDlzqCNn6iejjm6fx6g=");print("github ", hmac.compare_digest("sha256="+mac.hex(),gh));print("shopify", len(sh)==32 and hmac.compare_digest(mac,sh))'
github True
shopify True
python3 -c 'import hmac,hashlib;b=open("body.json","rb").read();k=b"w222-test-key-not-a-real-secret";h="t=1795000000,v1=fc40ca83825cc0d59df45b8d018f52dd8cfd02f238b406b86d62f818021f5204";e=[x.split("=",1) for x in h.split(",")];t=[v for n,v in e if n=="t"][0];exp=hmac.new(k,t.encode()+b"."+b,hashlib.sha256).hexdigest();ok=any(hmac.compare_digest(exp,v) for n,v in e if n=="v1");[print("age",now-int(t),"accept" if ok and abs(now-int(t))<=300 else "reject") for now in (1795000000,1795000300,1795000301)]'
age 0 accept
age 300 accept
age 301 rejectA v0 label with opposite meanings
Stripe says "the only valid live signature scheme is v1", adds a fake v0 signature to sandbox events for testing, and says to ignore every other scheme to prevent downgrade attacks. At Slack, v0 is the live scheme, so a helper reused across the two reads the label backwards. GitHub keeps a leftover too. The older X-Hub-Signature header uses HMAC-SHA1 and "is only included for legacy purposes".
Pages read, versions run and what will date them
The pages linked above were read on 24 November 2026. So was RFC 9110, whose section 5.1 makes header names case-insensitive, which means Shopify’s two spellings, -SHA256 and -Sha256, name one header. Stripe’s Node library was read at its v23.2.0 tag, published 19 November 2026, and not run. We measured with Node 26.13.0 (OpenSSL 4.1.0), Python 3.9.6 and PHP 8.5.12 at a fixed time of 1795000000 (18 November 2026, 11:06:40 UTC); the counts are ours. Header names, Stripe’s default tolerance and Shopify’s rotation delay will date first.
Go further
Relevant tools
More from Cybersecurity