mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
chore: remove unnecessary capture groups (#1460)
This commit is contained in:
1 parent
80bd1779e3
commit
b4009bfba4
11 files changed
+28
-30
No files matched your search
@@ -12,7 +12,7 @@ func Clojars() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a possible Clojars API token, risking unauthorized access to Clojure libraries and potential code manipulation.",
|
||||
RuleID: "clojars-api-token",
|
||||
Regex: regexp.MustCompile(`(?i)(CLOJARS_)[a-z0-9]{60}`),
|
||||
Regex: regexp.MustCompile(`(?i)CLOJARS_[a-z0-9]{60}`),
|
||||
Keywords: []string{"clojars"},
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ func Doppler() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discovered a Doppler API token, posing a risk to environment and secrets management security.",
|
||||
RuleID: "doppler-api-token",
|
||||
Regex: regexp.MustCompile(`(dp\.pt\.)(?i)[a-z0-9]{43}`),
|
||||
Regex: regexp.MustCompile(`dp\.pt\.(?i)[a-z0-9]{43}`),
|
||||
Keywords: []string{"doppler"},
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ func Duffel() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "duffel-api-token",
|
||||
Description: "Uncovered a Duffel API token, which may compromise travel platform integrations and sensitive customer data.",
|
||||
Regex: regexp.MustCompile(`duffel_(test|live)_(?i)[a-z0-9_\-=]{43}`),
|
||||
Regex: regexp.MustCompile(`duffel_(?:test|live)_(?i)[a-z0-9_\-=]{43}`),
|
||||
Keywords: []string{"duffel"},
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ func GitHubApp() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitHub App Token, which may compromise GitHub application integrations and source code security.",
|
||||
RuleID: "github-app-token",
|
||||
Regex: regexp.MustCompile(`(ghu|ghs)_[0-9a-zA-Z]{36}`),
|
||||
Regex: regexp.MustCompile(`(?:ghu|ghs)_[0-9a-zA-Z]{36}`),
|
||||
Keywords: []string{"ghu_", "ghs_"},
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ func HarnessApiKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a Harness Access Token (PAT or SAT), risking unauthorized access to a Harness account.",
|
||||
RuleID: "harness-api-key",
|
||||
Regex: regexp.MustCompile(`((?:pat|sat)\.[a-zA-Z0-9]{22}\.[a-zA-Z0-9]{24}\.[a-zA-Z0-9]{20})`),
|
||||
Regex: regexp.MustCompile(`(?:pat|sat)\.[a-zA-Z0-9]{22}\.[a-zA-Z0-9]{24}\.[a-zA-Z0-9]{20}`),
|
||||
Keywords: []string{"pat.", "sat."},
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ func HashicorpField() *config.Rule {
|
||||
RuleID: "hashicorp-tf-password",
|
||||
Regex: generateSemiGenericRegex(keywords, fmt.Sprintf(`"%s"`, alphaNumericExtended("8,20")), true),
|
||||
Keywords: keywords,
|
||||
Path: regexp.MustCompile(`\.(tf|hcl)$`),
|
||||
Path: regexp.MustCompile(`(?i)\.(?:tf|hcl)$`),
|
||||
}
|
||||
|
||||
tps := map[string]string{
|
||||
|
||||
@@ -11,7 +11,7 @@ func PrivateKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a Private Key, which may compromise cryptographic security and sensitive data encryption.",
|
||||
RuleID: "private-key",
|
||||
Regex: regexp.MustCompile(`(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY( BLOCK)?-----[\s\S-]*KEY( BLOCK)?----`),
|
||||
Regex: regexp.MustCompile(`(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\s\S-]*KEY(?: BLOCK)?----`),
|
||||
Keywords: []string{"-----BEGIN"},
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,7 @@ func SidekiqSensitiveUrl() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a Sidekiq Sensitive URL, potentially exposing internal job queues and sensitive operation details.",
|
||||
RuleID: "sidekiq-sensitive-url",
|
||||
SecretGroup: 2,
|
||||
Regex: regexp.MustCompile(`(?i)\b(http(?:s??):\/\/)([a-f0-9]{8}:[a-f0-9]{8})@(?:gems.contribsys.com|enterprise.contribsys.com)(?:[\/|\#|\?|:]|$)`),
|
||||
Regex: regexp.MustCompile(`(?i)\bhttps?://([a-f0-9]{8}:[a-f0-9]{8})@(?:gems.contribsys.com|enterprise.contribsys.com)(?:[\/|\#|\?|:]|$)`),
|
||||
Keywords: []string{"gems.contribsys.com", "enterprise.contribsys.com"},
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ func SlackUserToken() *config.Rule {
|
||||
Description: "Found a Slack User token, posing a risk of unauthorized user impersonation and data access within Slack workspaces.",
|
||||
RuleID: "slack-user-token",
|
||||
// The last segment seems to be consistently 32 characters. I've made it 28-34 just in case.
|
||||
Regex: regexp.MustCompile(`(xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34})`),
|
||||
Regex: regexp.MustCompile(`xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}`),
|
||||
Keywords: []string{"xoxp-", "xoxe-"},
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ func SlackAppLevelToken() *config.Rule {
|
||||
Description: "Detected a Slack App-level token, risking unauthorized access to Slack applications and workspace data.",
|
||||
RuleID: "slack-app-token",
|
||||
// This regex is based on a limited number of examples and may not be 100% accurate.
|
||||
Regex: regexp.MustCompile(`(?i)(xapp-\d-[A-Z0-9]+-\d+-[a-z0-9]+)`),
|
||||
Regex: regexp.MustCompile(`(?i)xapp-\d-[A-Z0-9]+-\d+-[a-z0-9]+`),
|
||||
Keywords: []string{"xapp"},
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ func SlackConfigurationToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Found a Slack Configuration access token, posing a risk to workspace configuration and sensitive data access.",
|
||||
RuleID: "slack-config-access-token",
|
||||
Regex: regexp.MustCompile(`(?i)(xoxe.xox[bp]-\d-[A-Z0-9]{163,166})`),
|
||||
Regex: regexp.MustCompile(`(?i)xoxe.xox[bp]-\d-[A-Z0-9]{163,166}`),
|
||||
Keywords: []string{"xoxe.xoxb-", "xoxe.xoxp-"},
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ func SlackConfigurationRefreshToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discovered a Slack Configuration refresh token, potentially allowing prolonged unauthorized access to configuration settings.",
|
||||
RuleID: "slack-config-refresh-token",
|
||||
Regex: regexp.MustCompile(`(?i)(xoxe-\d-[A-Z0-9]{146})`),
|
||||
Regex: regexp.MustCompile(`(?i)xoxe-\d-[A-Z0-9]{146}`),
|
||||
Keywords: []string{"xoxe-"},
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ func SlackLegacyToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Detected a Slack Legacy token, risking unauthorized access to older Slack integrations and user data.",
|
||||
RuleID: "slack-legacy-token",
|
||||
Regex: regexp.MustCompile(`(xox[os]-\d+-\d+-\d+-[a-fA-F\d]+)`),
|
||||
Regex: regexp.MustCompile(`xox[os]-\d+-\d+-\d+-[a-fA-F\d]+`),
|
||||
Keywords: []string{"xoxo", "xoxs"},
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ func TelegramBotToken() *config.Rule {
|
||||
Description: "Detected a Telegram Bot API Token, risking unauthorized bot operations and message interception on Telegram.",
|
||||
RuleID: "telegram-bot-api-token",
|
||||
|
||||
Regex: regexp.MustCompile(`(?i:(?:telegr)(?:[0-9a-z\(-_\t .\\]{0,40})(?:[\s|']|[\s|"]){0,3})(?:=|\|\|:|<=|=>|:|\?=|\()(?:'|\"|\s|=|\x60){0,5}([0-9]{5,16}:A[a-z0-9_\-]{34})(?:['|\"|\n|\r|\s|\x60|;|\\]|$)`),
|
||||
Regex: regexp.MustCompile(`(?i:telegr(?:[0-9a-z\(-_\t .\\]{0,40})(?:[\s|']|[\s|"]){0,3})(?:=|\|\|:|<=|=>|:|\?=|\()(?:'|\"|\s|=|\x60){0,5}([0-9]{5,16}:A[a-z0-9_\-]{34})(?:['|\"|\n|\r|\s|\x60|;|\\]|$)`),
|
||||
Keywords: []string{
|
||||
"telegr",
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user