Skip to content

Commit

Permalink
[HOTFIX]: Use fallback slack header if they are not present
Browse files Browse the repository at this point in the history
  • Loading branch information
branberry committed Dec 19, 2023
1 parent c190d8e commit 067f806
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/services/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ export class SlackConnector implements ISlackConnector {

validateSlackRequest(payload: any): boolean {
// params needed to verify for slack
const headerSlackSignature = payload.headers['X-Slack-Signature'].toString(); // no idea why `typeof <sig>` = object
const timestamp = payload.headers['X-Slack-Request-Timestamp'];
const headerSlackSignature =
payload.headers['X-Slack-Signature']?.toString() ?? payload.headers['x-slack-signature']?.toString(); // no idea why `typeof <sig>` = object
const timestamp = payload.headers['X-Slack-Request-Timestamp'] ?? payload.headers['x-slack-request-timestamp'];
const signingSecret = process.env.SLACK_SECRET;
if (signingSecret) {
const hmac = crypto.createHmac('sha256', signingSecret);
Expand Down

0 comments on commit 067f806

Please sign in to comment.