feat(webhook): accept Standard Webhooks signatures - #47849
Conversation
|
Thanks for the focused Standard Webhooks implementation. Current main still only extracts The proposed aliases correctly reuse GitHub marks this PR dirty after merged #58508 changed nearby webhook tests and documentation, but #58508 implements generic V2 replay hardening rather than these Standard Webhooks aliases. This should be a mechanical salvage with conflict resolution against the current documentation/test context. Automated hermes-sweeper review. |
cdba4e6 to
734d76f
Compare
…odes, signature_mode across CLI/REST/desktop, mode-bound test signing Adapts HwangJohn's NousResearch#47849 (GitLab Standard Webhooks wire format: webhook-id/ webhook-timestamp/webhook-signature, signed {id}.{timestamp}.{raw_body}) and sg-shag's NousResearch#80329 (X-Hindsight-Signature sha256=<hex> raw-body contract) into the explicit-mode architecture as dedicated signature modes, preserving attribution. Legacy gitlab mode remains the plaintext X-Gitlab-Token path. - webhook_auth: gitlab_standard + hindsight modes; SIGNATURE_MODES extended - CLI: subscribe --signature-mode persists on the route; test signs per the route's configured mode (all seven wire formats); list shows the mode - REST: WebhookCreate.signature_mode; router persists and summarizes it - Desktop: signature-mode select in the create dialog, detail display, i18n (en/zh), API types - Tests: real wire-format acceptance + cross-mode rejection for both modes
|
Thanks @HwangJohn — this was the right fix. Your commit has been salvaged (authorship preserved) onto current main in #92024, with additional hardening tests (expired-timestamp reject, incomplete-headers fail-closed) added on top; the branch here had gone stale against the reworked test file. Leaving this open until #92024 lands, then it will be closed with credit. |
What does this PR do?
Adds Standard Webhooks header support to the generic webhook adapter so providers such as GitLab can authenticate with
webhook-id,webhook-timestamp, andwebhook-signature.This reuses the existing Svix-compatible validator because the signed content and
v1,<base64-hmac-sha256>format are the same:{id}.{timestamp}.{raw_body}. It also useswebhook-idas the delivery ID fallback so retries dedupe correctly.Existing GitHub
X-Hub-Signature-256, GitLabX-Gitlab-Token, Svix, and genericX-Webhook-Signaturepaths are preserved for requests that do not send Standard Webhooks headers. Requests that do sendwebhook-idare treated as Standard Webhooks requests and fail closed unless the required Standard Webhooks fields validate.Fixes #47451
Related Issue
Fixes #47451
Type of Change
Changes Made
webhook-idas an alias forsvix-id.webhook-timestampas an alias forsvix-timestamp.webhook-signatureas an alias forsvix-signature.webhook-idas the webhook delivery ID fallback for idempotency.webhook-iddeduplication.How to Test
webhook-id,webhook-timestamp, andwebhook-signature.{id}.{timestamp}.{raw_body}with HMAC-SHA256 and the route secret.webhook-idshould return the duplicate response on retry.Validation run:
scripts/run_tests.sh tests/gateway/test_webhook_adapter.py tests/gateway/test_webhook_signature_rate_limit.py tests/gateway/test_webhook_integration.py-> 78 passed.~/.hermes/hermes-agent/venv/bin/python -m ruff check gateway/platforms/webhook.py tests/gateway/test_webhook_adapter.py-> passed.git diff --check origin/main...fix/47451-standard-webhook-signature-> passed after rebase..\\.venv\\Scripts\\python -m pytest tests\\gateway\\test_webhook_adapter.py tests\\gateway\\test_webhook_signature_rate_limit.py tests\\gateway\\test_webhook_integration.py -q-> 78 passed..\\.venv\\Scripts\\python -m ruff check gateway\\platforms\\webhook.py tests\\gateway\\test_webhook_adapter.py-> passed.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings)cli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs
Not applicable. This is a webhook signature validation change covered by tests.