From a2b048e941ee7cf736501cb33c8f0340f3915387 Mon Sep 17 00:00:00 2001 From: matthew-pilot Date: Wed, 29 Jul 2026 03:33:58 +0000 Subject: [PATCH] fix(webhook): wire HMAC signing secret through daemon CLI flags (PILOT-90) The webhook.Client already supported WithSecret and X-Pilot-Signature-256 header output since PR #3 (merged). However, the daemon's main.go never added the --webhook-secret flag or threaded it to webhook.WithSecret(), so the signing capability was inaccessible from the running daemon. This 2-line change adds: - --webhook-secret flag (env: PILOT_WEBHOOK_SECRET) - webhook.WithSecret(*webhookSecret) wiring in NewService call Backward compatible: empty secret = no signature header (existing behavior). Closes PILOT-90 --- cmd/daemon/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/daemon/main.go b/cmd/daemon/main.go index 53c5b51e..9d5b3d23 100644 --- a/cmd/daemon/main.go +++ b/cmd/daemon/main.go @@ -94,6 +94,7 @@ func main() { noEventStream := flag.Bool("no-eventstream", false, "disable built-in event stream service (port 1002)") noSkillinject := flag.Bool("no-skillinject", false, "disable built-in skill-injection service (agent context injection). Env: PILOT_NO_SKILLINJECT=1.") webhookURL := flag.String("webhook", "", "HTTP(S) endpoint for event notifications (empty = disabled)") + webhookSecret := flag.String("webhook-secret", "", "HMAC-SHA256 pre-shared secret for webhook payload signing (empty = no signature). Env: PILOT_WEBHOOK_SECRET.") adminToken := flag.String("admin-token", "", "admin token for network operations") networks := flag.String("networks", "", "comma-separated network IDs to auto-join at startup") trustAutoApprove := flag.Bool("trust-auto-approve", false, "automatically approve all incoming trust handshakes") @@ -348,7 +349,7 @@ func main() { // bus, the plugin subscribes and POSTs to the configured URL. URL // hot-swap (IPC's `set-webhook`) routes through SetURL on the // plugin via the daemon's WebhookManager interface. - webhookSvc := webhook.NewService(*webhookURL) + webhookSvc := webhook.NewService(*webhookURL, webhook.WithSecret(*webhookSecret)) if err := rt.Register(webhookSvc); err != nil { log.Fatalf("register webhook: %v", err) }