Alerts
Alerts by webhook
Each alert as signed JSON to an address of yours: your own tools, another chat, or an on-call system.
Add the webhook
Section titled “Add the webhook”You need Manage on settings: the Owner or Admin role, or a role you made with it. In the dashboard, open Settings, Alerts, choose Add a webhook, give it a name, paste the address, and choose Add.
The address must start with https:// and be on the public internet: Kiyesi never sends to a private address, such as 10.0.0.5 or localhost.
Keep the secret
Section titled “Keep the secret”Kiyesi shows the webhook’s signing secret once, starting with whsec_. Copy it into the tool that receives the webhook. If you lose it, remove the webhook and add it again.
Send a test
Section titled “Send a test”Choose Send a test. Your address gets a message with "type": "alert.test".
What Kiyesi sends
Section titled “What Kiyesi sends”A POST with Content-Type: application/json:
{ "type": "alert.open", "id": "finding:65f0…:exposed-databases", "severity": "critical", "label": "Critical", "subject": "checkout-api-prod", "sentence": "Redis is open to the internet on port 6379", "why": "Anyone can connect and read or wipe the data.", "fix": "bind the port to 127.0.0.1 in docker-compose.yml, then docker compose up -d redis", "url": "https://app.kiyesi.dev/alert/?id=…", "acknowledge_url": "https://app.kiyesi.dev/alert/?id=…&ack=1", "practice": false, "sent_at": "2026-10-18T09:00:00.000Z"}typeisalert.open,alert.reminder(still open),alert.recovered(the problem cleared) oralert.test.idis the same for an alert’s open, reminders and recovery, so you can match them.severityiscritical,warning,infoorok. A reminder is alwayswarning.practiceistruefor a test and for a fire drill.
Answer with any 2xx status within 10 seconds. Kiyesi tries again a few times, with growing waits, if it gets no answer or another status. A 404 or 410 means the address is gone: Kiyesi stops trying it.
Check the signature
Section titled “Check the signature”Each message has a Kiyesi-Signature header: t=<unix seconds>,v1=<signature>. The signature is the HMAC-SHA256, in hex, of the time, a full stop, and the body exactly as received, with your secret as the key. Read the body as raw bytes before any JSON parsing: a body parsed and written out again no longer matches.
import { createHmac, timingSafeEqual } from "node:crypto";
// header: the Kiyesi-Signature header; body: the raw body, as received.export function fromKiyesi(header, body, secret) { const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2))); const t = Number(parts.t); if (!parts.v1 || !Number.isInteger(t)) return false; if (Math.abs(Date.now() / 1000 - t) > 300) return false; // older than 5 minutes const want = createHmac("sha256", secret).update(`${t}.${body}`).digest("hex"); return ( parts.v1.length === want.length && timingSafeEqual(Buffer.from(parts.v1), Buffer.from(want)) );}import hashlibimport hmacimport time
def from_kiyesi(header: str, body: bytes, secret: str) -> bool: """header: the Kiyesi-Signature header; body: the raw body, as received.""" parts = dict(p.split("=", 1) for p in header.split(",") if "=" in p) try: t = int(parts["t"]) v1 = parts["v1"] except (KeyError, ValueError): return False if abs(time.time() - t) > 300: # older than 5 minutes return False want = hmac.new(secret.encode(), f"{t}.".encode() + body, hashlib.sha256).hexdigest() return hmac.compare_digest(v1, want)package kiyesi
import ( "crypto/hmac" "crypto/sha256" "encoding/hex" "math" "strconv" "strings" "time")
// FromKiyesi says whether a webhook came from Kiyesi. header is the// Kiyesi-Signature header; body is the raw body, as received.func FromKiyesi(header string, body []byte, secret string) bool { var t int64 = -1 var v1 string for _, p := range strings.Split(header, ",") { k, v, _ := strings.Cut(p, "=") switch k { case "t": t, _ = strconv.ParseInt(v, 10, 64) case "v1": v1 = v } } if t < 0 || v1 == "" || math.Abs(float64(time.Now().Unix()-t)) > 300 { // older than 5 minutes return false } mac := hmac.New(sha256.New, []byte(secret)) mac.Write([]byte(strconv.FormatInt(t, 10) + ".")) mac.Write(body) want := hex.EncodeToString(mac.Sum(nil)) return hmac.Equal([]byte(v1), []byte(want))}<?php// $header: the Kiyesi-Signature header; $body: the raw body, as received// (file_get_contents('php://input')).function from_kiyesi(string $header, string $body, string $secret): bool { $parts = []; foreach (explode(',', $header) as $p) { [$k, $v] = array_pad(explode('=', $p, 2), 2, ''); $parts[$k] = $v; } if (!isset($parts['t'], $parts['v1']) || !ctype_digit($parts['t'])) return false; $t = (int) $parts['t']; if (abs(time() - $t) > 300) return false; // older than 5 minutes $want = hash_hmac('sha256', $t . '.' . $body, $secret); return hash_equals($want, $parts['v1']);}require "openssl"
# header: the Kiyesi-Signature header; body: the raw body, as received# (request.raw_post in Rails).def from_kiyesi?(header, body, secret) parts = header.split(",").to_h { |p| p.split("=", 2) } t = Integer(parts["t"], exception: false) return false if t.nil? || parts["v1"].nil? return false if (Time.now.to_i - t).abs > 300 # older than 5 minutes want = OpenSSL::HMAC.hexdigest("SHA256", secret, "#{t}.#{body}") OpenSSL.secure_compare(want, parts["v1"])endimport java.nio.charset.StandardCharsets;import java.security.MessageDigest;import java.util.HashMap;import java.util.HexFormat;import java.util.Map;import javax.crypto.Mac;import javax.crypto.spec.SecretKeySpec;
public final class Kiyesi { /** header: the Kiyesi-Signature header; body: the raw body, as received. */ public static boolean fromKiyesi(String header, byte[] body, String secret) throws Exception { Map<String, String> parts = new HashMap<>(); for (String p : header.split(",")) { String[] kv = p.split("=", 2); if (kv.length == 2) parts.put(kv[0], kv[1]); } long t; try { t = Long.parseLong(parts.getOrDefault("t", "")); } catch (NumberFormatException e) { return false; } String v1 = parts.get("v1"); if (v1 == null || Math.abs(System.currentTimeMillis() / 1000 - t) > 300) return false; // older than 5 minutes Mac mac = Mac.getInstance("HmacSHA256"); mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256")); mac.update((t + ".").getBytes(StandardCharsets.UTF_8)); String want = HexFormat.of().formatHex(mac.doFinal(body)); return MessageDigest.isEqual(want.getBytes(StandardCharsets.UTF_8), v1.getBytes(StandardCharsets.UTF_8)); }}using System;using System.Linq;using System.Security.Cryptography;using System.Text;
public static class Kiyesi{ // header: the Kiyesi-Signature header; body: the raw body, as received. public static bool FromKiyesi(string header, byte[] body, string secret) { var parts = header.Split(',') .Select(p => p.Split('=', 2)) .Where(kv => kv.Length == 2) .GroupBy(kv => kv[0]) .ToDictionary(g => g.Key, g => g.First()[1]); if (!parts.TryGetValue("t", out var ts) || !long.TryParse(ts, out var t)) return false; if (!parts.TryGetValue("v1", out var v1)) return false; if (Math.Abs(DateTimeOffset.UtcNow.ToUnixTimeSeconds() - t) > 300) return false; // older than 5 minutes using var mac = new HMACSHA256(Encoding.UTF8.GetBytes(secret)); var signed = Encoding.UTF8.GetBytes($"{t}.").Concat(body).ToArray(); var want = Convert.ToHexString(mac.ComputeHash(signed)).ToLowerInvariant(); return CryptographicOperations.FixedTimeEquals(Encoding.UTF8.GetBytes(want), Encoding.UTF8.GetBytes(v1)); }}Each of these is run, in its language’s own official image, against real webhooks from Kiyesi’s sender for every change: it must accept the real one and refuse a changed body, another secret, one older than 5 minutes and a broken header.
Refuse a message whose signature does not match, or whose time is more than a few minutes old.