Alert webhooks
Send shld alerts to your own HTTPS endpoint and verify the HMAC signature, retries, and delivery behavior.
shld can post each alert it emails to your own HTTPS endpoint, signed, so a bot, chat bridge or on-call tool can act on it. Add up to three URLs under Notifications → Webhooks.
What shld sends
shld posts one request per alert and per URL, for the same alerts your email level sends. A retried email does not send the webhook again. A dashboard-only finding sends nothing.
POST /your/path HTTP/1.1
content-type: application/json
shld-event-id: evt_3f9c2a1b8e7d4c6f0a1b2c3d4e5f6a7b
shld-signature: t=1793180000,v1=<64 hex characters>
user-agent: shld-webhooks/1
{"id":"evt_3f9c2a1b8e7d4c6f0a1b2c3d4e5f6a7b","type":"incident.alert","created_at":"2026-11-24T10:13:20.000Z","company":"acme-3k2m","incident":{"id":"…","title":"[KEV] web-1 · Known vulnerable package","severity":"critical","server":"web-1","package":"openssl","versions":{"installed":"3.0.13-0ubuntu3.4","fixed":"3.0.13-0ubuntu3.5"},"advisory":{"id":"CVE-2026-12345","urgency":"known_exploited","known_exploited":true},"url":"https://app.shld.app/v1/incidents/…"}}
typeisincident.alert, ortestfor Send test.package,versionsandadvisoryarenullfor alerts without a package, such as a missed heartbeat.urlopens the incident in the dashboard after sign-in.- The body carries no tokens, update commands, file paths or email addresses.
Answer with any 2xx status within 10 seconds. shld does not follow redirects. After a failure shld retries after 1, 5 and 30 minutes, then gives up on that alert. After three failed attempts in a row, Settings marks the URL Failing. The next successful delivery or a passing test clears it. A failing URL never delays or stops email.
Verify the signature
shld shows the signing secret (whsec_…) once, when you add the URL.
Store it with your endpoint's other secrets.
To replace it, choose Rotate secret: shld shows the new secret once, and the old one stops working at once.
Deliveries still queued for retry go out signed with the new secret.
shld-signature has two parts: t, the Unix time in seconds, and v1, the hex HMAC-SHA256 of <t>.<raw body>.
The HMAC key is the whole secret string, whsec_ included.
- Read the raw request body before any JSON parsing.
- Compute the HMAC and compare it to
v1in constant time. - Reject the request when
tis more than 5 minutes from your clock. - Use
shld-event-idto drop a delivery you have already handled.
Node
import { createHmac, timingSafeEqual } from "node:crypto";
export function verifyShld(rawBody, header, secret, toleranceSeconds = 300) {
const parts = Object.fromEntries(header.split(",").map(part => part.split("=", 2)));
const t = Number(parts.t);
if (!Number.isInteger(t) || !/^[0-9a-f]{64}$/.test(parts.v1 ?? "")) return false;
if (Math.abs(Math.floor(Date.now() / 1000) - t) > toleranceSeconds) return false;
const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest();
return timingSafeEqual(expected, Buffer.from(parts.v1, "hex"));
}
// Express: app.post("/shld", express.raw({ type: "application/json" }), (req, res) => {
// if (!verifyShld(req.body.toString("utf8"), req.get("shld-signature") ?? "", process.env.SHLD_WEBHOOK_SECRET)) return res.sendStatus(401);
// const event = JSON.parse(req.body); res.sendStatus(204);
// });
Python
import hashlib
import hmac
import time
def verify_shld(raw_body: bytes, header: str, secret: str, tolerance_seconds: int = 300) -> bool:
parts = dict(part.split("=", 1) for part in header.split(",") if "=" in part)
try:
t = int(parts["t"])
except (KeyError, ValueError):
return False
if abs(int(time.time()) - t) > tolerance_seconds:
return False
expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts.get("v1", ""))
A known vector for your own test: secret whsec_c2hsZC13ZWJob29rLXRlc3QtdmVjdG9yLW9ubHk, t 1700000000 and body {"id":"evt_0123456789abcdef","type":"test"} give v1=2ca9492bf965ffd66cb5443005b4da8dacded70c6e7e543e1b7548c8bd295208.
Which URLs shld accepts
shld accepts https:// URLs on a public host name or a public IP address.
It refuses localhost, internal names such as *.local, *.internal and *.home.arpa, private, loopback, link-local and other reserved IPv4 and IPv6 ranges, and URLs with a user name or password.
It checks the URL again before each send.
Operator notes
- Rows live in
webhook_endpointsandwebhook_deliveries(migration0023_webhooks.sql), never incompany_state. - Each URL has its own secret: 32 random bytes, generated when the URL is added or rotated and stored in plaintext in
webhook_endpoints.secret(no D1 column is encrypted at rest). No API read returns it, and no other key derives it, so rotating a Worker secret never breaks a webhook. - Before the migration is applied, every webhook query fails inside a catch: email and the cron run as before, and the Webhooks block shows its error state.
- Finished deliveries are deleted after 30 days. Erasing a company deletes its webhook rows.