diff --git a/node-typescript/github-issue-bot/src/github.ts b/node-typescript/github-issue-bot/src/github.ts index 72a324cd..bbe64bea 100644 --- a/node-typescript/github-issue-bot/src/github.ts +++ b/node-typescript/github-issue-bot/src/github.ts @@ -21,9 +21,14 @@ class GithubService { async verifyWebhook(req: any): Promise { const signature = req.headers['x-hub-signature-256']; - return ( - typeof signature !== 'string' || - (await verify(process.env.GITHUB_WEBHOOK_SECRET, req.bodyBinary, signature)) + if (typeof signature !== 'string') { + return false; + } + + return await verify( + process.env.GITHUB_WEBHOOK_SECRET, + req.bodyBinary, + signature ); } diff --git a/node/github-issue-bot/src/github.js b/node/github-issue-bot/src/github.js index 5d6e877e..97347221 100644 --- a/node/github-issue-bot/src/github.js +++ b/node/github-issue-bot/src/github.js @@ -15,9 +15,14 @@ class GithubService { async verifyWebhook(req) { const signature = req.headers['x-hub-signature-256']; - return ( - typeof signature !== 'string' || - (await verify(process.env.GITHUB_WEBHOOK_SECRET, req.bodyBinary, signature)) + if (typeof signature !== 'string') { + return false; + } + + return await verify( + process.env.GITHUB_WEBHOOK_SECRET, + req.bodyBinary, + signature ); }