Skip to content

Commit

Permalink
only send risk notif when risks are found
Browse files Browse the repository at this point in the history
  • Loading branch information
maidul98 committed Jul 19, 2023
1 parent 1f3f037 commit da9cb70
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions backend/src/services/GithubSecretScanningService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,18 @@ export default async (app: Probot) => {
const adminOrOwnerEmails = userEmails.map(userObject => userObject.email)

const usersToNotify = pusher?.email ? [pusher.email, ...adminOrOwnerEmails] : [...adminOrOwnerEmails]
await sendMail({
template: "secretLeakIncident.handlebars",
subjectLine: `Incident alert: leaked secrets found in Github repository ${repository.full_name}`,
recipients: usersToNotify,
substitutions: {
numberOfSecrets: Object.keys(allFindingsByFingerprint).length,
pusher_email: pusher.email,
pusher_name: pusher.name
}
});
if (Object.keys(allFindingsByFingerprint).length) {
await sendMail({
template: "secretLeakIncident.handlebars",
subjectLine: `Incident alert: leaked secrets found in Github repository ${repository.full_name}`,
recipients: usersToNotify,
substitutions: {
numberOfSecrets: Object.keys(allFindingsByFingerprint).length,
pusher_email: pusher.email,
pusher_name: pusher.name
}
});
}

const postHogClient = await TelemetryService.getPostHogClient();
if (postHogClient) {
Expand Down

0 comments on commit da9cb70

Please sign in to comment.