Skip to content

fix(daemon): wire webhook HMAC signing secret flag (PILOT-90) - #437

Closed
matthew-pilot wants to merge 1 commit into
mainfrom
openclaw/pilot-90-20260728-151114
Closed

fix(daemon): wire webhook HMAC signing secret flag (PILOT-90)#437
matthew-pilot wants to merge 1 commit into
mainfrom
openclaw/pilot-90-20260728-151114

Conversation

@matthew-pilot

Copy link
Copy Markdown
Collaborator

What

The pilot-protocol/webhook library (v0.2.0+) already supports HMAC-SHA256 signing of outbound webhook event payloads via webhook.WithSecret, but the daemon never exposed or passed a secret — the -webhook flag only sets the URL and the signing option was unreachable.

What this adds

  • New -webhook-secret CLI flag
  • PILOT_WEBHOOK_SECRET env var fallback
  • Both are wired to webhook.WithSecret(...) in the service constructor

How it works

When a secret is configured, every webhook POST includes an X-Pilot-Signature-256 header 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/ — passes
  • go vet ./cmd/daemon/ — clean
  • github.com/pilot-protocol/webhook test suite — 5.030s, all green (includes TestWebhookClientHMACSignatureHeader)

Files changed

1 file, +11/-1 lines (cmd/daemon/main.go)

Closes PILOT-90

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
@matthew-pilot

Copy link
Copy Markdown
Collaborator Author

Closing — superseded by #439 (same fix, newer branch with all checks green).

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.

1 participant