You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The spec.when.webhook (GenericWebhook) TaskSpawner source currently exposes an unauthenticated endpoint at `/webhook/`.
The Helm chart (`internal/manifests/charts/kelos/templates/webhook-server.yaml`) mounts `webhookServer.sources.generic.secretName` via `envFrom`, but the handler in `internal/webhook/handler.go` (`GenericSource` case, ~lines 211–231) does not:
read `_WEBHOOK_SECRET`
inspect `X-Hub-Signature-256`
call any HMAC validation helper
`signature.go` only exposes `ValidateGitHubSignature` and `ValidateLinearSignature`. Tests like `TestGenericServeHTTP_CreatesTaskForMatchingSpawner` confirm the current behavior — they POST without any signature header and expect HTTP 200.
This was caught during review of #1035 (docs PR), which originally documented HMAC validation that does not exist. The docs there have been corrected to describe the current unauthenticated state.
Proposal
Wire up per-source HMAC-SHA256 validation for the generic webhook source:
In the `GenericSource` branch of `WebhookHandler.ServeHTTP`, look up `_WEBHOOK_SECRET` from the environment (uppercased `source` name).
Read the `X-Hub-Signature-256` header (`sha256=`).
Call `validateHMACSignature(body, signature, secret)`. Return `401 Unauthorized` on failure.
If `_WEBHOOK_SECRET` is missing, fail-closed (refuse the request) so misconfiguration is loud.
Add `TestGenericServeHTTP_RejectsInvalidSignature` and `TestGenericServeHTTP_RejectsMissingSecret` to exercise the new code paths; update existing tests to send a valid signature.
Once landed, restore the HMAC docs in `docs/integration.md` and `examples/13-taskspawner-generic-webhook/README.md` (the "Webhook security" sections).
🤖 Kelos Agent @gjkim42
Background
The`.
spec.when.webhook(GenericWebhook) TaskSpawner source currently exposes an unauthenticated endpoint at `/webhook/The Helm chart (`internal/manifests/charts/kelos/templates/webhook-server.yaml`) mounts `webhookServer.sources.generic.secretName` via `envFrom`, but the handler in `internal/webhook/handler.go` (`GenericSource` case, ~lines 211–231) does not:
`signature.go` only exposes `ValidateGitHubSignature` and `ValidateLinearSignature`. Tests like `TestGenericServeHTTP_CreatesTaskForMatchingSpawner` confirm the current behavior — they POST without any signature header and expect HTTP 200.
This was caught during review of #1035 (docs PR), which originally documented HMAC validation that does not exist. The docs there have been corrected to describe the current unauthenticated state.
Proposal
Wire up per-source HMAC-SHA256 validation for the generic webhook source:
/kind feature