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.
11 lines
553 B
SQL
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 '';
|