Files
archie/internal/platform/pg/migrations/00042_events_source_verification.sql
T
sam 01eb4aaf7c fix(events): verify webhook signatures before parsing (#2021)
A source now declares how its deliveries prove themselves: token (the
default, unchanged), hmac (HMAC-SHA256 over the raw body, per-source header
and prefix, secret sealed at rest and write-only) or none. The events module
verifies before the connector parses, answers 401 and logs the refusal.

The digest comparison is ported from internal/webhookguard/hmac.go and the
header-borne signature from internal/infrastructure/captureintake/receiver.go;
the old copies stay until their service goes. The seal package moves to
internal/platform/seal so events can seal the secret.
2026-11-21 13:46:48 +11:00

11 lines
553 B
SQL

-- +goose Up
-- How a source's deliveries are verified. A token source checks the bearer
-- token and an hmac source checks a signature over the raw body with a shared
-- secret, which is kept sealed. A source that chose none checks nothing.
ALTER TABLE events.sources
ADD COLUMN verification text NOT NULL DEFAULT 'token'
CHECK (verification IN ('token', 'hmac', 'none')),
ADD COLUMN hmac_header text NOT NULL DEFAULT '',
ADD COLUMN hmac_prefix text NOT NULL DEFAULT '',
ADD COLUMN hmac_secret_sealed bytea NOT NULL DEFAULT '';