mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 12:14:22 +01:00
add rule for microsoft teams webhooks (#970)
This commit is contained in:
1 parent
4f6ee2bcf1
commit
3f0293dab0
3 files changed
+38
No files matched your search
@@ -141,6 +141,7 @@ func main() {
|
||||
configRules = append(configRules, rules.SquareSpaceAccessToken())
|
||||
configRules = append(configRules, rules.SumoLogicAccessID())
|
||||
configRules = append(configRules, rules.SumoLogicAccessToken())
|
||||
configRules = append(configRules, rules.TeamsWebhook())
|
||||
configRules = append(configRules, rules.TravisCIAccessToken())
|
||||
configRules = append(configRules, rules.Twilio())
|
||||
configRules = append(configRules, rules.TwitchAPIToken())
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
func TeamsWebhook() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Microsoft Teams Webhook",
|
||||
RuleID: "microsoft-teams-webhook",
|
||||
Regex: regexp.MustCompile(
|
||||
`https:\/\/[a-z0-9]+\.webhook\.office\.com\/webhookb2\/[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}@[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}\/IncomingWebhook\/[a-z0-9]{32}\/[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}`),
|
||||
Keywords: []string{
|
||||
"webhook.office.com",
|
||||
"webhookb2",
|
||||
"IncomingWebhook",
|
||||
},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
"https://mycompany.webhook.office.com/webhookb2/" + secrets.NewSecret(`[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}@[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}\/IncomingWebhook\/[a-z0-9]{32}\/[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}`), // gitleaks:allow
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
@@ -2227,6 +2227,14 @@ keywords = [
|
||||
"messagebird","message-bird","message_bird",
|
||||
]
|
||||
|
||||
[[rules]]
|
||||
description = "Microsoft Teams Webhook"
|
||||
id = "microsoft-teams-webhook"
|
||||
regex = '''https:\/\/[a-z0-9]+\.webhook\.office\.com\/webhookb2\/[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}@[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}\/IncomingWebhook\/[a-z0-9]{32}\/[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}'''
|
||||
keywords = [
|
||||
"webhook.office.com","webhookb2","incomingwebhook",
|
||||
]
|
||||
|
||||
[[rules]]
|
||||
description = "Netlify Access Token"
|
||||
id = "netlify-access-token"
|
||||
|
||||
Reference in new issue
Block a user