feat(slack): add subtype field and signature verification to Slack trigger#4030
feat(slack): add subtype field and signature verification to Slack trigger#4030waleedlatif1 merged 2 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Slack trigger payload is richer and docs are updated. The Slack webhook trigger and Slack block outputs add Reviewed by Cursor Bugbot for commit d921909. Configure here. |
Greptile SummaryThis PR enhances the Slack webhook trigger in two meaningful ways: it activates HMAC-SHA256 signature verification (the signing secret field existed before but was ignored), and it exposes three new output fields — Key changes:
Prior review concerns about the Confidence Score: 5/5Safe to merge — all P0/P1 concerns from prior rounds are resolved; only minor description-string inconsistencies remain. The core security implementation (HMAC verification, replay protection, NaN guard, constant-time comparison) is correct and complete. The sentinel-value inconsistency flagged in a previous round is fixed. The only remaining findings are P2 stale description strings ("Null for..." vs the actual Minor description wording in
|
| Filename | Overview |
|---|---|
| apps/sim/lib/webhooks/providers/slack.ts | Adds HMAC-SHA256 verifyAuth with correct basestring format, constant-time comparison, 5-minute replay window, and Number.isNaN guard; also adds subtype, channel_type, bot_id output fields with '' fallback matching existing conventions. |
| apps/sim/triggers/slack/webhook.ts | Adds subtype, channel_type, bot_id to the trigger output schema and expands setup instructions; descriptions for subtype and bot_id still say "Null for..." but the runtime value is ''. |
| apps/sim/blocks/blocks/slack.ts | Adds subtype, channel_type, bot_id to the block's trigger output descriptors; same "Null for..." wording inconsistency as the trigger file. |
Sequence Diagram
sequenceDiagram
participant Slack
participant WebhookRoute
participant slackHandler
participant validateSlackSignature
Slack->>WebhookRoute: POST /webhook (x-slack-signature, x-slack-request-timestamp, body)
WebhookRoute->>slackHandler: handleChallenge(body)
slackHandler-->>WebhookRoute: null (not a challenge) or 200 challenge response
WebhookRoute->>slackHandler: verifyAuth({ request, rawBody, providerConfig })
slackHandler->>slackHandler: check signingSecret present
slackHandler->>slackHandler: read x-slack-signature and x-slack-request-timestamp
slackHandler->>slackHandler: Number.isNaN(parsedTimestamp)?
alt invalid timestamp
slackHandler-->>WebhookRoute: 401 Invalid timestamp
end
slackHandler->>slackHandler: |now - parsedTimestamp| > 300s?
alt timestamp too old
slackHandler-->>WebhookRoute: 401 Request timestamp too old
end
slackHandler->>validateSlackSignature: (signingSecret, signature, timestamp, rawBody)
validateSlackSignature->>validateSlackSignature: HMAC-SHA256(v0:{ts}:{body})
validateSlackSignature->>validateSlackSignature: safeCompare(computed, provided)
validateSlackSignature-->>slackHandler: true / false
alt invalid signature
slackHandler-->>WebhookRoute: 401 Invalid Slack signature
end
slackHandler-->>WebhookRoute: null (auth passed)
WebhookRoute->>slackHandler: formatInput({ body, webhook })
slackHandler->>slackHandler: extract event_type, subtype, channel_type, bot_id, user, text, files
slackHandler-->>WebhookRoute: { input: { event: { subtype, channel_type, bot_id, ... } } }
WebhookRoute->>WebhookRoute: enqueue workflow execution
WebhookRoute-->>Slack: 200 OK
Reviews (2): Last reviewed commit: "fix(slack): guard against NaN timestamp ..." | Re-trigger Greptile
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit d921909. Configure here.
Summary
subtype,channel_type, andbot_idoutput fields to the Slack webhook trigger so users can differentiate real messages from system messages (e.g., "left #channel")verifyAuthusing HMAC-SHA256 signature verification with 5-minute replay protection — the signing secret field already existed but was never actually usedmessage.channels,message.im,message.mpim,message.groupsevent subscriptionsType of Change
Testing
Tested manually
Checklist