Repository navigation
fix: answer Slack's URL verification challenge on slack_v0 webhooks - #769
Conversation
Slack's first delivery to a newly registered webhook URL is a signed url_verification challenge that must be answered with the raw challenge string. The event endpoint treated it as an event: body-derived delivery ID extraction failed on the challenge (400), and even without it the EventResponse JSON was returned instead of the challenge, so URL verification always failed. A slack_v0 webhook now echoes the challenge verbatim, after signature verification and before delivery ID and admission policies only real events satisfy. Co-authored-by: openhands <openhands@all-hands.dev>
|
Warning Your comment is too long (maximum is 65536 characters), so the coverage report was not added. See the job log for how to reduce it. |
|
CI This PR adds no migration, so it neither causes nor repairs that collision - happy to renumber in a separate PR if useful. This comment was created by an AI agent (OpenHands) on behalf of the user. |
The handshake tests set event_id_expr to event.ts, which is not a Slack delivery id: a mention's message and app_mention events share it, so the second is dropped as a duplicate. Use the envelope's event_id, and send a real event_callback envelope after the handshake. Add tests for empty and non-string challenges, non-object bodies and other signature schemes, log answered handshakes, and update the F17 feature map, which still said the handshake was not answered.
…1157) The Signature Requirements section listed Slack among services that cannot be verified, pointing readers at a relay workaround, but Slack has been supported through the slack_v0 signature scheme and the Events form exposes it as 'Slack v0'. - Add the Signature scheme field to the Form Fields table. - Move Slack and Standard Webhooks out of the cannot-verify list. - Add a Connect Slack Events API section covering setup, URL verification, the 5-minute replay window, and event_id deduplication. - Note that a Slack source needs event.type as its event key expression. - Reflect the same signature_scheme parameter on the Event-Based Automations page and fix its Slack row. The slack_v0 URL-verification behavior ships with OpenHands/automation#769. Co-authored-by: openhands <openhands@all-hands.dev>
|
🚀 Released in 1.34.0. |
Description
Slack's Events API requires URL verification: the first delivery to a newly
registered webhook URL is a signed
{"type": "url_verification", "challenge": ...}payload, and Slack expects the raw challenge string back as the responsebody. The event endpoint treated that delivery as an event, so verification
always failed:
event_id_expr, e.g.event_id), thechallenge payload has no such field and the endpoint answered 400 "Invalid
body delivery ID";
EventResponseJSON instead ofechoing the challenge.
After: a
slack_v0webhook answers a verified challenge withPlainTextResponse(challenge)— after signature verification (the challenge issigned like any other delivery), and before delivery-ID extraction and
admission policies that only real events can satisfy. A missing or non-string
challenge is rejected with 400. Every other scheme and all event processing is
unchanged.
No schema change; nothing to configure beyond the existing
slack_v0scheme(see the schema field description, which now documents the handshake).
Issue Number
None — gap found while testing Slack events against a custom automation
webhook directly (HTTP) rather than through Socket Mode.
Testing
tests/test_event_router.py:text/plain,200), and nothing is recorded in
integration_events;delivery Slack signed;
event_id(a mention'smessageandapp_mentionevents shareevent.ts,so
tsis not a delivery id) and creates a run.tests/test_event_router.pyandtests/test_teams_webhooks.pypass fully;tests/test_providers.pyshows no new failures (its three local failureshere are SQLite-environment artifacts of the test harness, reproduced on
mainwithout this change — raw-SQL UUID binding requires the Postgrestestcontainer).
ruff formatandruff checkclean.Compatibility and risk
slack_v0custom webhooks are affected; built-in sources always usehmac_sha256_hexand never see this path. For aslack_v0webhook whosesender genuinely delivers
{"type": "url_verification", "challenge": ...}signed with the webhook secret, echoing the challenge is exactly the
behavior the scheme's owner defines.
unverified request can never extract a challenge probe.
event_id_expr/admission_expr; thosepolicies are documented as event policies and cannot be applied to the
handshake, which carries no event.
Jev-Fast-Audit
⚡ Jev fast audit · estimates · 0.30s · commit fb483b8
Strongest signal: No primary concern selected.
Evidence: No primary concern to locate.
Coverage: complete supplied coverage; 10/10 hunks, 4/4 files.
All estimates and evidence