Takeaway
Verify signatures on the raw body before JSON.parse
Why
Parsers can normalize whitespace or reorder keys; HMAC must see the exact bytes the platform signed.
Do this
- Buffer the raw request body.
- Compute and compare HMAC with a constant-time function.
- Only then parse JSON for the handler.