Website: Update GitHub webhook exits (#39940)
Changes: - Added a new exit to the receive-from-github webhook that is used when a provided `botSignature` does not match the `githubBotWebhookSecret` config variable
This commit is contained in:
+6
-1
@@ -25,6 +25,11 @@ module.exports = {
|
||||
projects_v2_item: { type: {} }, //eslint-disable-line camelcase
|
||||
},
|
||||
|
||||
exits: {
|
||||
success: {description: 'A GitHub event was successfully received.'},
|
||||
unexpectedBotSignature: {description: 'The provided botSignature was incorrect', responseType: 'unauthorized' },
|
||||
},
|
||||
|
||||
|
||||
fn: async function ({botSignature, action, sender, repository, changes, issue, comment, pull_request: pr, label, release, projects_v2_item: projectsV2Item}) {
|
||||
|
||||
@@ -141,7 +146,7 @@ module.exports = {
|
||||
throw new Error('No GitHub bot webhook secret configured! (Please set `sails.config.custom.githubBotWebhookSecret`.)');
|
||||
}//•
|
||||
if (sails.config.custom.githubBotWebhookSecret !== botSignature) {
|
||||
throw new Error('Received unexpected GitHub webhook request with botSignature set to: '+botSignature);
|
||||
throw 'unexpectedBotSignature';
|
||||
}//•
|
||||
|
||||
if (!sails.config.custom.githubAccessToken) {
|
||||
|
||||
Reference in New Issue
Block a user