ForHosting KIT · Developer Utilities

Webhook signature verification steps

Webhook signature verification fails most often at the boundaries: a framework changes the body before verification, a header is parsed too loosely, or ordinary string equality leaks timing information.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

This capability turns a provider’s HMAC algorithm and signature header name into a precise, ordered receiver checklist. It does not need your payload, secret, or signature. Use the result while implementing or reviewing an endpoint, then match provider-specific details such as timestamp layout, digest encoding, and replay tolerance against the provider’s own documentation.

Start with the bytes that the provider signed

Signature verification begins before application-level parsing. Preserve the exact request-body bytes as received, because JSON parsing and serialization can change whitespace, key order, escaping, Unicode representation, or line endings while leaving the apparent data unchanged. A correct MAC over changed bytes is still the wrong MAC. Read the named signature header without treating its name as case-sensitive, since HTTP field names are case-insensitive, but apply strict rules to its value. Some providers send a bare digest, while others include a version, timestamp, or several candidate signatures. The generated checklist deliberately tells you to follow that provider-specific grammar instead of guessing. Reject missing, empty, unexpectedly duplicated, or malformed values before doing business work. Keep the endpoint secret in a secret manager or protected runtime binding, never in source code, request logs, error messages, or this tool’s input. The capability needs only the declared HMAC algorithm and header name, so sensitive verification material remains inside your receiver.

Reconstruct, compute, and compare in the right order

After extracting the signature, reconstruct the provider’s signed message exactly. It may be only the raw request body, but many robust schemes sign a timestamp followed by a separator and the body. Use the documented byte order and encoding; do not add a homemade canonicalization step. Compute an HMAC with the endpoint secret and the normalized algorithm shown in the output, then encode the result exactly as required, commonly hexadecimal or Base64. A cryptographically correct digest in the wrong textual encoding will never match. Decode the received and expected values into equal-length byte arrays and compare them with a timing-safe primitive supplied by your platform. Ordinary equality can reveal how much of a signature matched through response timing. A malformed encoding or unequal length is a verification failure, not a reason to truncate or pad either value. Only after the constant-time comparison succeeds should the receiver proceed to freshness, replay, and event-processing checks.

Treat successful cryptography as one part of acceptance

A matching HMAC proves that someone holding the shared secret produced the signed message; by itself, it does not prove that the message is recent or has not already been processed. When the provider signs a timestamp, enforce its recommended tolerance using a reliable server clock. When it supplies a stable event identifier, store accepted identifiers for an appropriate retention window and make processing idempotent. Rotate secrets using the provider’s documented overlap procedure, which may require checking a small bounded set of active secrets or signatures. Reject failures before queuing work or changing state, and return a generic error that does not disclose which verification stage failed. Log a safe reason code, provider name, and request correlation identifier rather than secrets or complete signatures. Test the receiver with untouched payloads, single-byte body changes, stale timestamps, malformed headers, wrong secrets, and replayed events. The generated steps provide the secure order; the provider documentation remains authoritative for its header grammar, signed-payload format, digest encoding, and rotation policy.

Implement a new webhook endpoint

Convert a provider’s algorithm and header name into a reviewable receiver checklist before writing framework-specific code.

Review an existing integration

Check that raw-body capture, HMAC computation, timing-safe comparison, and replay defenses occur in the correct sequence.

Prepare a security test plan

Derive negative tests for missing headers, altered bodies, malformed digests, stale timestamps, wrong secrets, and replayed events.

Does this tool verify a real webhook?

No. It produces implementation steps and never asks for a payload, secret, or signature.

Which algorithms are recognized?

HMAC-SHA1, HMAC-SHA256, HMAC-SHA384, and HMAC-SHA512. An unrecognized algorithm returns an invalid-input error.

Why must I keep the raw request body?

Parsing and re-serializing a body can change its bytes, causing a valid signature over the original request to fail.

Is a matching HMAC enough to prevent replay attacks?

No. Enforce a signed timestamp tolerance and deduplicate event identifiers when the provider’s scheme supplies them.

Should I send my webhook secret to this capability?

No. It needs only the algorithm and header name; keep the secret inside your receiver’s protected runtime.

What does the API request cost?

Each API request costs $0.002. The deterministic browser implementation can run without sending secrets anywhere.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/security/webhook-signature-verify-steps

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/security/webhook-signature-verify-steps \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"algorithm":"HMAC-SHA256","header_name":"X-Webhook-Signature"}'
{
  "algorithm": "HMAC-SHA256",
  "header_name": "X-Webhook-Signature"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "security.webhook_signature_verify_steps",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →