fix(daemon): wire webhook HMAC signing secret flag (PILOT-90) - #437
Closed
matthew-pilot wants to merge 1 commit into
Closed
fix(daemon): wire webhook HMAC signing secret flag (PILOT-90)#437matthew-pilot wants to merge 1 commit into
matthew-pilot wants to merge 1 commit into
Conversation
The pilot-protocol/webhook library (v0.2.0+) already supports HMAC-SHA256 signing of outbound event payloads via webhook.WithSecret, which sets the X-Pilot-Signature-256 header on every POST. However, the daemon's main.go never defined or passed a secret — the WithSecret option was unreachable from the command line or environment. This commit: - Adds a -webhook-secret CLI flag - Adds PILOT_WEBHOOK_SECRET env var fallback - Passes the value as webhook.WithSecret(...) to the service constructor When a secret is configured, receivers can verify authenticity and integrity of webhook payloads by recomputing the HMAC-SHA256 of the body and comparing it to the X-Pilot-Signature-256 header. When no secret is set (the default), behavior is identical to before — no signature header, fully backward-compatible. Closes PILOT-90
Collaborator
Author
|
Closing — superseded by #439 (same fix, newer branch with all checks green). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
pilot-protocol/webhooklibrary (v0.2.0+) already supports HMAC-SHA256 signing of outbound webhook event payloads viawebhook.WithSecret, but the daemon never exposed or passed a secret — the-webhookflag only sets the URL and the signing option was unreachable.What this adds
-webhook-secretCLI flagPILOT_WEBHOOK_SECRETenv var fallbackwebhook.WithSecret(...)in the service constructorHow it works
When a secret is configured, every webhook POST includes an
X-Pilot-Signature-256header containing the hex-encoded HMAC-SHA256 of the request body. Receivers can verify authenticity and integrity. When no secret is set (default), behavior is identical to before — no signature header, fully backward-compatible.Verification
go build ./cmd/daemon/— passesgo vet ./cmd/daemon/— cleangithub.com/pilot-protocol/webhooktest suite — 5.030s, all green (includes TestWebhookClientHMACSignatureHeader)Files changed
1 file, +11/-1 lines (cmd/daemon/main.go)
Closes PILOT-90