Skip to content
GDPR compliant. Hosted in the EU.
14-day free trial →
HMAC-SHA256Alert webhooksReceiver checks
Security 17 min read 25 Nov 2026

Securing alert webhooks: verify signatures, don't trust

Alert webhooks open tickets and wake the on-call team. How receivers verify the HMAC signature and catch forged all-clears, replays and duplicate deliveries.

X

XICTRAQ® Team

XICTRAQ®

AlertingWebhooksIT securityNotifications
256 bits
HMAC key length the BSI advises for long-term protection needs (BSI TR-02102-1)
96 bits
minimum checksum (tag) length the BSI generally recommends (BSI TR-02102-1)
80 bits
lower bound for truncated HMAC outputs (RFC 2104)
Alert webhook: verify the signature, don't trust itWhat XICTRAQ sends and what the receiver checks before actingXICTRAQAlertalert.openedalert.resolvedTime: delivered_atin the signed bodyHeadersX-Xictraq-Event: alert.openedX-Xictraq-Delivery: dlv_…X-Xictraq-Signature: sha256=…POST with JSON bodyOnly the body is signedhttps://tickets.example.invalid/hookReceiver checks before acting1HMAC-SHA256 over raw bodybefore parsing, secret as the key2Compare in constant timeno ==, check length first3Check delivered_attime window against replays4Catch duplicateskey: alert_id + eventvalidinvalidaccepted2xx, open ticketrejected403, log itWhat gets through without checks!Forged all-clear closes the ticketsteps 1 + 2!Invented alerts wake the on-call personsteps 1 + 2!Old genuine message gets replayedsteps 3 + 4!X-Xictraq-Event header swappedevent from bodySource: RFC 2104 (HMAC); headers and body per XICTRAQ documentation
At an alert webhook, monitoring stops reporting and starts acting: alert.opened becomes a ticket, the on-call person gets woken up, and alert.resolved closes it all again. That is exactly why the receiving address is a worthwhile target. Anyone who knows it can send a forged all-clear that closes the open ticket in the middle of an outage, or a series of invented alerts that wakes the team at night. XICTRAQ® signs every alert webhook with HMAC-SHA256 as soon as a secret is set in the account. But the signature only protects you if the receiver verifies it correctly. This article shows what arrives, which four checks belong in front of every action and how to introduce verification during peak season without rejecting a real alert.

Why the receiver of an alert webhook is a way in

A webhook is an ordinary HTTP request to a publicly reachable address. Whether it comes from the monitoring service is revealed neither by the User-Agent header nor by the shape of the body: both can be copied, all the more so because the sample delivery is openly shown in the documentation. MITRE lists this pattern as a weakness class of its own: a product does not sufficiently verify the origin or authenticity of data and therefore accepts invalid data (MITRE CWE-345).

The address itself is rarely as secret as intended. It sits in the ticket system's configuration, in access logs, in screenshots taken during setup and sometimes in a chat with a service provider. A long random path makes guessing harder but travels with every request. The HMAC secret, on the other hand, does not leave the two parties; only the checksum computed from it goes over the wire.

Then there is automation. A person might pause at a strange alert email; a rule that closes the ticket on alert.resolved does not. That is what message authentication codes (MAC) are for: they are typically used between two parties that share a secret key in order to validate the information transmitted between them (RFC 2104). HMAC is the method RFC 2104 defines for this on top of a hash function.

Note: What the signature does and does not prove

A valid HMAC signature proves that the sender knew the secret and that the signed body is unchanged. It does not prove that the message is new, and it says nothing about headers that were not signed. The receiver needs its own rules for both.

Forged all-clears and ticket floods: what happens without verification

With alerts, the damage follows directly from what the receiver does with the two events. Five patterns can be distinguished, one of them without any attacker:

Attack or glitchEffect at the receiverWhat stops it
Invented alert.resolved without a valid signatureTicket closed, status display green, escalation endedSignature over the raw body, compared in constant time (steps 1 and 2)
Series of invented alert.openedTicket flood, on-call person woken at nightSignature over the raw body, compared in constant time (steps 1 and 2)
Captured, genuinely signed message sent again laterTicket opens or closes at the wrong timedelivered_at within the time window (step 3) and duplicate check (step 4)
Genuine message with a swapped X-Xictraq-Event headerA signed alert is read as an all-clearRead the event from the signed body
The same alert arrives twice, for example via an escalation levelSecond ticket for the same incidentDuplicate check on alert_id and event (step 4)

The forged all-clear is the more dangerous pattern because it works silently. A ticket flood is noticed immediately, a closed ticket during an ongoing outage only when customers call. Anyone who rehearses their alerting chain, as described in the article on the alerting drill, should also play through an all-clear that arrives while the dashboard still shows an outage.

Replay is easily overlooked during setup. A signature only proves that the message was genuine once. Anyone who captured a valid request, for example from the log of an intermediate system, can send it again unchanged. MITRE describes this as capture-replay: an attacker sniffs network traffic and bypasses authentication by replaying it to the server with the same effect as the original message (MITRE CWE-294).

What XICTRAQ attaches to every alert webhook

The generic webhook is part of the alerting module and is available from the Business plan. For every alert in a category enabled for the webhook, it sends a JSON request via POST to the configured address, with the event alert.opened when the alert fires and alert.resolved when it clears. By default, only the Uptime category is enabled for it; you add SSL, Security and the other categories per channel in the settings. Every request carries these headers:

  • User-Agent: XICTRAQ-Webhook/1.0 and Content-Type: application/json
  • X-Xictraq-Event with the name of the event, that is alert.opened or alert.resolved
  • X-Xictraq-Delivery with the identifier of the individual delivery, starting with dlv_
  • X-Xictraq-Signature with the prefix sha256= and the HMAC-SHA256 checksum in hexadecimal notation, but only if a secret is set in the account

There is no separate timestamp header. The time reference sits in the field delivered_at and therefore in the signed body. Wrapped here for readability; in reality it arrives without line breaks or indentation:

alert-opened.json
{
  "event": "alert.opened",
  "delivered_at": "2026-11-25T02:47:13+00:00",
  "data": {
    "alert_id": "0193a7c2-5e1b-7d40-9f2a-6c8e3b1d4a07",
    "incident_id": "0193a7c2-5e1c-7f13-8b6d-2a9e4c7f1b35",
    "type": "downtime",
    "severity": "critical",
    "lang": "en",
    "title": "HTTP 503 – shop.example.invalid",
    "message": "The website responds with status code 503.",
    "website": {
      "id": "0192f1d8-3a6b-7c29-a4e1-5b8d2f6c9e10"
    },
    "is_resolved": false,
    "created_at": "2026-11-25T02:47:12+00:00"
  },
  "source": "XICTRAQ"
}

Three properties determine how the receiver has to verify. First, only the body is signed; the headers sit outside the checksum. Anyone who bases "open or close the ticket" on the X-Xictraq-Event header can be fed an all-clear by way of a genuinely signed alert and a swapped header. What counts is the event field in the body, read only after verification. Second, XICTRAQ writes slashes and non-ASCII characters into the body unescaped. Third, the secret itself is the key, exactly as it is displayed: a string of 64 hex characters (XICTRAQ documentation). Anyone who hex-decodes it into bytes before computing gets a different checksum.

Tip: Where to find address, secret and delivery log

Address and secret are in the settings under notifications. The secret is shown in plain text once when it is generated and only in shortened form afterwards. Below that is the delivery log with HTTP status, response excerpt, runtime and signature flag; every row can be resent. Details are in the manual under alerts and notifications and in the chapter API and webhooks.

This results in four checks, and their order matters: as long as the signature has not been verified, every field in the body is untrusted input.

1. HMAC over the raw body

Capture the body as bytes before a framework parses it, and compute HMAC-SHA256 over it with the secret.

2. Compare in constant time

Compare with the value after sha256= using a function that does not stop at the first difference.

3. Check delivered_at

Hold the signed timestamp against a time window. Old but valid messages do not trigger any automation.

4. Catch duplicates

Process each combination of alert_id and event automatically only once.

Check 1: compute the HMAC over the raw body

HMAC combines a hash function with a secret key. In HMAC-SHA256 that is SHA-256, whose output is 256 bits long (FIPS 180-4); in hexadecimal, that is the 64 characters after sha256=. The receiver computes the same function with the same secret over the same bytes. In practice, this often fails at exactly that point: the bytes.

Many frameworks parse the body as JSON right away. Anyone who turns the object back into text and computes over it is no longer checking the text XICTRAQ signed. A JSON object is an unordered collection of name/value pairs (RFC 8259), so the order of the fields can change when it is written out again. In addition, any character may be escaped (RFC 8259): depending on the library, a dash in the title becomes an escape sequence with \u, a slash becomes \/, and suddenly there are spaces between the fields. The same JSON in terms of content, a different text byte for byte.

The rule is therefore: capture the body unchanged as bytes, compute the checksum over it and parse it as JSON only after the check has passed, in PHP for example via php://input. If an upstream service rewrites the body, verification has to happen in front of that service.

Whether your own implementation computes correctly can be settled beforehand with a test vector. RFC 4231 publishes fixed sets of key, message and result for HMAC-SHA256. In the second test case, the key is "Jefe" and the message is "what do ya want for nothing?"; the result starts with 5bdcc146 and ends with 64ec3843 (RFC 4231). Then comes the cross-check against a real delivery: store the raw body from the receiver's log, compute with the secret and compare with the value after sha256=.

$ printf '%s' 'what do ya want for nothing?' | openssl dgst -sha256 -hmac 'Jefe' -r
5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843 *stdin
$ openssl dgst -sha256 -hmac "$XICTRAQ_WEBHOOK_SECRET" -r < raw-body.json
4c9a209c010d8b7615b288cfb5404f646cea16b3305ed97a7800b80cb21a7b5c *stdin
$ grep -i '^x-xictraq-signature' headers.txt
x-xictraq-signature: sha256=4c9a209c010d8b7615b288cfb5404f646cea16b3305ed97a7800b80cb21a7b5c
$ python3 -c 'import json,sys; print(json.dumps(json.load(sys.stdin)), end="")' < raw-body.json | openssl dgst -sha256 -hmac "$XICTRAQ_WEBHOOK_SECRET" -r
e107d5b8da046363d97c424287d2dd7950a150ee6b0b0c8f5300ca61825d6504 *stdin

The last command shows the trap: the same body, parsed once and written out again, produces a completely different checksum. A receiver that computes this way rejects every genuine delivery, and the obvious reaction is to switch off verification "temporarily".

Check 2: compare in constant time

An ordinary string comparison stops at the first differing character. Anyone who measures often enough can in principle read from the response time how many leading characters already match. MITRE lists this as a weakness of its own: two operations take different amounts of time, and the difference reveals security-relevant information, such as whether an operation was successful (MITRE CWE-208).

Standard libraries come with dedicated functions. PHP offers hash_equals, which compares without leaking information about the contents of the secret string through the execution time; the value from the request belongs in the second position (PHP manual). Python has hmac.compare_digest, which avoids content-based short-circuiting (Python documentation). In Node.js, crypto.timingSafeEqual compares in constant time but throws an error if the two inputs differ in length (Node.js documentation). If that is not caught, a signature that is too short turns into a server error instead of a rejection.

A format check comes before the comparison: if the header or the prefix sha256= is missing, or the characters after it are not exactly 64 hex characters, the request is rejected. If a secret is set, the receiver rejects unsigned requests as a matter of principle. The PHP function combines checks 1 and 2 and accepts a list of secrets so that a rotation works without an outage:

verify-webhook.php
<?php
// Checks format and signature before any field of the body is read.
function xictraq_verify(string $rawBody, ?string $header, array $secrets): bool
{
    if ($header === null || !str_starts_with($header, 'sha256=')) {
        return false;
    }
    $given = substr($header, 7);
    if (preg_match('/^[0-9a-f]{64}$/', $given) !== 1) {
        return false;
    }
    foreach ($secrets as $secret) {
        // The key is the string as displayed, not hex-decoded.
        $expected = hash_hmac('sha256', $rawBody, $secret);
        if (hash_equals($expected, $given)) {
            return true;
        }
    }
    return false;
}

$rawBody = file_get_contents('php://input');
// Current secret, plus the previous one during a rotation.
$secrets = array_values(array_filter([
    getenv('XICTRAQ_WEBHOOK_SECRET'),
    getenv('XICTRAQ_WEBHOOK_SECRET_PREVIOUS'),
]));

if (!xictraq_verify($rawBody, $_SERVER['HTTP_X_XICTRAQ_SIGNATURE'] ?? null, $secrets)) {
    http_response_code(403);
    echo 'signature invalid';
    exit;
}

try {
    $payload = json_decode($rawBody, true, 512, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
    http_response_code(400);
    exit;
}
// Only from here on read event, alert_id and delivered_at from the verified body.

Check 3: delivered_at against replays

The signature says that a message comes from XICTRAQ and is unchanged, but not when it was sent. For that, the body carries delivered_at, a timestamp with a time zone offset. Because it sits in the signed body, it cannot be changed without breaking the signature: a captured message from yesterday carries yesterday's date.

The receiver compares delivered_at with its own clock and sets a time window of a few minutes. Two conditions go with this. The clock has to be right; a system clock set via the Network Time Protocol (NTP) is a prerequisite. And the window only works together with the duplicate check from step 4, otherwise a message could be replayed within the window.

For alerts, the window has a peculiarity. When a delivery is resent from the delivery log, XICTRAQ sends the stored body, that is with the original delivered_at. A narrow window rejects a resend hours later. Instead of opening the window wide, a distinction helps: a late but validly signed message is accepted and logged, but it does not trigger any automation. Above all, a late all-clear does not close a ticket on its own but ends up as a note for the person handling the ticket.

classify_alert.py
from datetime import datetime, timedelta, timezone

WINDOW = timedelta(minutes=10)
CLOCK_SKEW = timedelta(minutes=1)


def classify(payload: dict, is_first) -> str:
    """Classifies a message whose signature has already been verified."""
    data = payload["data"]
    event = payload["event"]                  # from the body, not from X-Xictraq-Event
    if data.get("type") == "test":
        return "test"                         # success status, no ticket
    if not is_first(data["alert_id"], event):
        return "duplicate"                    # update the existing ticket
    sent = datetime.fromisoformat(payload["delivered_at"])
    age = datetime.now(timezone.utc) - sent
    if age > WINDOW or age < -CLOCK_SKEW:
        return "late"                         # accept, log, no automation
    return "process"                          # create or close the ticket

Check 4: catch duplicates without losing escalations

The same alert can arrive more than once without anyone attacking. XICTRAQ retries a delivery up to twice, but only if it cannot have arrived, that is on status code 429 or a connection error (XICTRAQ documentation). An escalation level can have the webhook as a channel of its own and then sends the same alert again. And every delivery can be repeated by hand from the delivery log.

A second message about the same alert is therefore a normal event and no reason for a second ticket. A good key is the combination of data.alert_id and event from the signed body, not the identifier from X-Xictraq-Delivery, because that sits outside the signature. The first message creates the ticket, every further one updates it, for example with a note that an escalation level has been reached. The key is stored in a table with a uniqueness constraint, not in memory that empties on restart.

Two kinds of messages deliberately do not reach the webhook: the reminder about an open alert and the digest after quiet hours (XICTRAQ documentation). At the webhook, a machine reads the message and could not tell a digest from a new alert. The receiver therefore only needs to know alert.opened and alert.resolved.

This leads to a setting for ticket systems. Quiet hours apply per channel, and the webhook is included in their channel selection unless you deselect it. Non-critical messages from those hours then do not reach the ticket system, not even as a summary in the morning. If every alert from the enabled categories should land there, take the webhook out of quiet hours; people's night rest is handled by the other channels and well-planned on-call scheduling.

The test button in the settings sends an alert through all active channels, the webhook included, via the same signed path. In the body it carries the type test. A receiver that creates tickets answers it with a success status and creates nothing.

Warning: No exception for test environments

A switch that turns off signature verification for tests tends, in our experience, to end up in production sooner or later. A staging environment gets its own webhook with its own secret, not a disabled check.

Responses that XICTRAQ and the delivery log understand

Whatever the receiver returns ends up in the delivery log: for every delivery, XICTRAQ records HTTP status, response excerpt and runtime and notes whether it was signed (XICTRAQ documentation). A clear response rule makes the log readable:

  • Valid and accepted: a status code in the 2xx class, which according to the standard indicates that the request was successfully received, understood and accepted (RFC 9110). Ticket and wake-up call then run in the background so that the response does not wait for slow downstream systems.
  • Signature missing or wrong: 403, the response of a server that understood the request but refuses to fulfill it (RFC 9110). A 401 would be conceivable, but it requires a WWW-Authenticate header with an authentication challenge (RFC 9110) that does not fit a webhook signature.
  • Body unreadable despite a valid signature: 400 and an entry in your own error log.
  • Receiver overloaded: 429, but only if nothing was actually processed. The code stands for too many requests in a given amount of time (RFC 6585), and XICTRAQ retries on 429 (XICTRAQ documentation). That makes it the wrong choice for signature errors.

What does not belong in the response is the expected signature value or a hint as to which part of the check failed. The response excerpt ends up in the delivery log and can be read by anyone allowed to open the settings. A short "signature invalid" is enough. Who may see which settings is governed by roles and permissions, as described in the article on access control in the monitoring team.

Two peculiarities affect the choice of address. The webhook does not follow redirects: if the address answers with a 3xx status, for example when switching from http to https, the delivery counts as failed. And addresses in internal or private networks are blocked. A receiver inside a company network therefore needs a publicly reachable entry point, and that is exactly where signature verification belongs.

Rotating the secret without alerts bouncing

RFC 2104 recommends choosing keys at random and refreshing them periodically (RFC 2104). With alert webhooks there is a concrete trigger: anyone who knew the secret, such as a former service provider, can use it to produce valid alerts and all-clears. A change in the team or of service provider is therefore a good moment for a rotation.

XICTRAQ keeps one secret per account. "Rotate" creates a new one, shows it once, and from that moment every delivery is signed with it, including a resend from the log. A transition period with two valid secrets therefore belongs in the receiver:

  1. Let the receiver accept a list of valid secrets, like the PHP function above.
  2. Switch to logging mode for the duration of the rotation, which records errors but rejects nothing.
  3. Rotate in XICTRAQ and immediately add the new secret as an additional entry in the secret store.
  4. Send a test alert and check in the delivery log that it arrived signed and was accepted.
  5. Remove the old secret and switch back to rejecting.
  6. Document the change; the activity log shows it as "webhook secret regenerated".

On length: the secret consists of 64 hex characters (XICTRAQ documentation) generated from random bytes, so it carries 256 bits of randomness. The BSI classifies HMAC with one of the recommended hash functions as secure if the key is at least 128 bits long (BSI TR-02102-1), and advises 256 bits for high or long-term protection needs (BSI TR-02102-1). SHA-256 is on the list of recommended hash functions (BSI TR-02102-1). RFC 2104 also discourages keys shorter than the output of the hash function (RFC 2104).

The checksum is not truncated; XICTRAQ sends the full SHA-256 output. The BSI recommends a tag length of at least 96 bits (BSI TR-02102-1) and, for HMAC, truncation to no less than half the output length (BSI TR-02102-1); RFC 2104 names 80 bits and half the output length as the lower bound (RFC 2104). A receiver therefore has no reason to compare only part of the signature.

Where it is stored matters just as much. The BSI requires authentication keys to be protected as well as other cryptographic secrets in the same context (BSI TR-02102-1): in a secret store or a tightly scoped environment variable, not in the repository, the setup ticket or a chat.

Switching over during peak season: measure first, then reject

This article appears during Black Week, on days when nobody likes to tinker with the alerting chain. That is not necessary either, because verification can be introduced in stages. In the first, the receiver computes signature, time window and duplicate key, writes the result to its log and still processes the message as before. The cross-check comes from the delivery log in XICTRAQ, with signature flag and response status for every delivery. Only when both sides agree and no genuine delivery was marked invalid does the second stage switch to rejecting.

The short version for the receiver

Capture the raw body, compute HMAC-SHA256 with the secret, compare in constant time against the value after sha256=, read event and alert_id only from the verified body, hold delivered_at against a time window and process each combination of alert_id and event automatically only once.

If you switch on the second stage only after peak season, you lose little: the decision is then based on measured deliveries. The same care pays off for everything customers see. A forged all-clear that turns a home-built status display green has an effect on the outside. For disruptions that no check captures, the article on incidents on the status page describes the route via manually reported incidents.

An alert only counts once it has been verified

At the end of the chain, a receiver decides whether a message becomes a ticket, a wake-up call or an all-clear. With the four checks, an open address becomes an interface you can trust at night and under load, and the duplicate rule makes sure that escalations arrive without multiplying tickets.

To get started, you need the webhook channel from the Business plan, a freshly generated secret and a test alert. How to set up channels, thresholds and debouncing overall is described in the article configuring monitoring alerts properly; the whole chain including the ticket system can be rehearsed with the procedure for testing the alerting chain. The live demo shows the sample delivery and the delivery log without an account of your own.

Note: Sources and studies

This article is based on: RFC 2104, HMAC: Keyed-Hashing for Message Authentication (sections 1, 3 and 5); RFC 4231, Identifiers and Test Vectors for HMAC-SHA-224, HMAC-SHA-256, HMAC-SHA-384, and HMAC-SHA-512 (test case 2); NIST FIPS 180-4, Secure Hash Standard; BSI TR-02102-1, Cryptographic Mechanisms: Recommendations and Key Lengths, version 2026-01, section Message Authentication Code (MAC); RFC 8259, The JavaScript Object Notation (JSON) Data Interchange Format; RFC 9110, HTTP Semantics; RFC 6585, Additional HTTP Status Codes; MITRE CWE-208, CWE-294 and CWE-345; PHP manual on hash_equals, Python documentation on the hmac module, Node.js documentation on crypto.timingSafeEqual; XICTRAQ documentation, chapters on alerts and notifications as well as API and webhooks.

Isn't HTTPS enough to secure alert webhooks?
HTTPS protects the connection, typically against eavesdropping and tampering in transit. But it does not tell the receiver who sent the request, because anyone can open an HTTPS connection to the receiving address. The HMAC signature adds proof that the sender knows the shared secret. As a rule, the two belong together.
Why can't the signature be verified over the parsed JSON?
Because the checksum is computed over the bytes that were sent. When writing JSON out again, libraries often change the order of fields, add spaces or escape special characters; that is permitted under RFC 8259 but produces different bytes (RFC 8259). That is why, as a rule, the unprocessed body is verified.
How does the receiver recognize a replayed message?
By the delivered_at field in the signed body and by the combination of alert_id and event. If the timestamp falls outside the time window or the combination has already been processed, the message should not trigger any automation. There is no timestamp header.
What happens if the receiver rejects a delivery?
XICTRAQ logs it with HTTP status and response excerpt. For responses in the 4xx class there is generally no automatic retry; retries only happen if the message cannot have arrived, for example on 429 or a connection error (XICTRAQ documentation). After a fix, the delivery can be resent from the log.
How often should the webhook secret be rotated?
RFC 2104 does not name a fixed interval but does recommend periodic refreshing (RFC 2104). A rotation typically makes sense with every change in the team or of service provider, after any suspicion of exposure and at the interval set by your own security concept.
Can alert webhooks be run without a secret?
Technically yes: without a secret, XICTRAQ sends the delivery without a signature header, and the delivery log marks it as unsigned. For a receiver that creates or closes tickets, this is not advisable in our experience, because it has to treat every request as genuine. The secret can be generated in the settings at any time.

Related in XICTRAQ®

First scan usually in under a minute

Let XICTRAQ® watch your website.

Free plan with no fixed term available. No credit card, no installation, no hidden fees.