Skip to content

cmd/rekor_watch/notifications: add webhook secret deriver - #5

Merged
facutuesca merged 1 commit into
mainfrom
signed-webhooks-1-crypto
Jun 29, 2026
Merged

facutuesca merged 1 commit into
mainfrom
signed-webhooks-1-crypto

Conversation

@ret2libc

@ret2libc ret2libc commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Slice 1 of 4 — secret derivation crypto

Adds the per-subscription webhook signing-secret deriver, plus the Standard Webhooks library we sign with. No dispatch wiring yet.

  • WebhookSecretDeriver derives a secret on demand from a master key via HKDF-SHA256 over (subID, version)whsec_<base64(24B)>, the Standard Webhooks format. Nothing is stored; a regenerate is just a version bump. The master key loads from a 0600 file (≥32 bytes, base64; path via env/flag, never the key itself) and fails closed.
  • Signing uses the official standard-webhooks Go library (…/libraries/go@v0.0.1, pure stdlib, no transitive deps) rather than a hand-rolled HMAC. An interop test pins our usage against the spec's canonical v1 vector so reference verifiers stay compatible. The library is depended on here (all crypto in one PR) and first called in slice 4.

Design notes (from review)

  • HKDF salt is nil: the master key is required high-entropy, so Extract-with-salt adds nothing; info (rekor-watch/webhook-secret/v1|sub=N|ver=M) does the per-subscription separation.
  • 24-byte (192-bit) secret matches the SW whsec_<32-char> format; ample for HMAC.

Tests

go test ./cmd/rekor_watch/notifications/ — deriver determinism/uniqueness/fail-closed loading + the SW canonical-vector interop test.

Stack

Base of a 4-PR stack: 1) crypto ← here · 2) store (#6) · 3) server reveal/regenerate/UI (#7) · 4) dispatch signing + docs (#8).

🤖 Generated with Claude Code

Add the HKDF-based per-subscription webhook signing-secret deriver, plus the
Standard Webhooks library we sign with (no dispatch wiring yet):

- WebhookSecretDeriver derives a secret on demand from a master key via
  HKDF-SHA256 over (subID, version). Nothing is stored; a regenerate is just a
  version bump. The master key loads from a 0600 file (>= 32 bytes, base64) and
  fails closed.
- Secrets use the Standard Webhooks whsec_<base64(24B)> format. Signing is done
  by the official standard-webhooks Go library (pure stdlib); an interop test
  pins our usage against the spec's canonical v1 test vector so reference
  verifiers stay compatible.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ret2libc
ret2libc force-pushed the signed-webhooks-1-crypto branch from b3123a5 to d6b936a Compare June 23, 2026 15:10
@ret2libc ret2libc changed the title cmd/rekor_watch/notifications: add webhook secret deriver and signer cmd/rekor_watch/notifications: add webhook secret deriver Jun 23, 2026
@ret2libc
ret2libc requested a review from facutuesca June 24, 2026 09:33
@ret2libc
ret2libc marked this pull request as ready for review June 29, 2026 12:01

@facutuesca facutuesca left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@facutuesca
facutuesca merged commit cb22996 into main Jun 29, 2026
12 of 13 checks passed
@facutuesca
facutuesca deleted the signed-webhooks-1-crypto branch June 29, 2026 13:07
ret2libc added a commit that referenced this pull request Sep 16, 2026
Add the HKDF-based per-subscription webhook signing-secret deriver, plus the
Standard Webhooks library we sign with (no dispatch wiring yet):

- WebhookSecretDeriver derives a secret on demand from a master key via
  HKDF-SHA256 over (subID, version). Nothing is stored; a regenerate is just a
  version bump. The master key loads from a 0600 file (>= 32 bytes, base64) and
  fails closed.
- Secrets use the Standard Webhooks whsec_<base64(24B)> format. Signing is done
  by the official standard-webhooks Go library (pure stdlib); an interop test
  pins our usage against the spec's canonical v1 test vector so reference
  verifiers stay compatible.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants