feat(rules): make case insensitivity optional (#1215)

This commit is contained in:
Richard Gomez authored and GitHub committed 2023-08-24 10:41:52 -05:00
1 parent 9fb36b242d
commit 18283bb48e
85 files changed
+151 -136

No files matched your search

+5 -5
View File
@@ -39,7 +39,7 @@ If you want to add a new rule to the [default Gitleaks configuration](https://gi
// Regex used for detecting secrets. See regex section below for more details // Regex used for detecting secrets. See regex section below for more details
Regex: generateSemiGenericRegex([]string{"beamer"}, `b_[a-z0-9=_\-]{44}`), Regex: generateSemiGenericRegex([]string{"beamer"}, `b_[a-z0-9=_\-]{44}`, true)
// Keywords used for string matching on fragments (think of this as a prefilter) // Keywords used for string matching on fragments (think of this as a prefilter)
Keywords: []string{"beamer"}, Keywords: []string{"beamer"},
@@ -63,18 +63,18 @@ If you want to add a new rule to the [default Gitleaks configuration](https://gi
The function signatures look like this: The function signatures look like this:
```golang ```golang
func generateSemiGenericRegex(identifiers []string, secretRegex string) *regexp.Regexp func generateSemiGenericRegex(identifiers []string, secretRegex string, isCaseInsensitive bool) *regexp.Regexp
func generateUniqueTokenRegex(secretRegex string) *regexp.Regexp func generateUniqueTokenRegex(secretRegex string, isCaseInsensitive bool) *regexp.Regexp
``` ```
`generateSemiGenericRegex` accepts a list of identifiers and a regex. `generateSemiGenericRegex` accepts a list of identifiers, a regex, and a boolean indicating whether the pattern should be case-insensitive.
The list of identifiers _should_ match the list of `Keywords` in the rule The list of identifiers _should_ match the list of `Keywords` in the rule
definition above. Both `identifiers` in the `generateSemiGenericRegex` definition above. Both `identifiers` in the `generateSemiGenericRegex`
function _and_ `Keywords` act as filters for Gitleaks telling the program function _and_ `Keywords` act as filters for Gitleaks telling the program
"_at least one of these strings must be present to be considered a leak_" "_at least one of these strings must be present to be considered a leak_"
`generateUniqueToken` just accepts a regex. If you are writing a rule for a `generateUniqueToken` just accepts a regex and a boolean indicating whether the pattern should be case-insensitive. If you are writing a rule for a
token that is unique enough not to require an identifier then you can use token that is unique enough not to require an identifier then you can use
this function. For example, Pulumi's API Token has the prefix `pul-` which is this function. For example, Pulumi's API Token has the prefix `pul-` which is
unique enough to use `generateUniqueToken`. But something like Beamer's API unique enough to use `generateUniqueToken`. But something like Beamer's API
+1 -1
View File
@@ -10,7 +10,7 @@ func AdafruitAPIKey() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Adafruit API Key", Description: "Adafruit API Key",
RuleID: "adafruit-api-key", RuleID: "adafruit-api-key",
Regex: generateSemiGenericRegex([]string{"adafruit"}, alphaNumericExtendedShort("32")), Regex: generateSemiGenericRegex([]string{"adafruit"}, alphaNumericExtendedShort("32"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"adafruit"}, Keywords: []string{"adafruit"},
} }
+2 -2
View File
@@ -10,7 +10,7 @@ func AdobeClientID() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Adobe Client ID (OAuth Web)", Description: "Adobe Client ID (OAuth Web)",
RuleID: "adobe-client-id", RuleID: "adobe-client-id",
Regex: generateSemiGenericRegex([]string{"adobe"}, hex("32")), Regex: generateSemiGenericRegex([]string{"adobe"}, hex("32"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"adobe"}, Keywords: []string{"adobe"},
} }
@@ -27,7 +27,7 @@ func AdobeClientSecret() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Adobe Client Secret", Description: "Adobe Client Secret",
RuleID: "adobe-client-secret", RuleID: "adobe-client-secret",
Regex: generateUniqueTokenRegex(`(p8e-)(?i)[a-z0-9]{32}`), Regex: generateUniqueTokenRegex(`(p8e-)(?i)[a-z0-9]{32}`, true),
Keywords: []string{"p8e-"}, Keywords: []string{"p8e-"},
} }
+1 -1
View File
@@ -10,7 +10,7 @@ func Airtable() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Airtable API Key", Description: "Airtable API Key",
RuleID: "airtable-api-key", RuleID: "airtable-api-key",
Regex: generateSemiGenericRegex([]string{"airtable"}, alphaNumeric("17")), Regex: generateSemiGenericRegex([]string{"airtable"}, alphaNumeric("17"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"airtable"}, Keywords: []string{"airtable"},
} }
+1 -1
View File
@@ -10,7 +10,7 @@ func AlgoliaApiKey() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Algolia API Key", Description: "Algolia API Key",
RuleID: "algolia-api-key", RuleID: "algolia-api-key",
Regex: generateSemiGenericRegex([]string{"algolia"}, `[a-z0-9]{32}`), Regex: generateSemiGenericRegex([]string{"algolia"}, `[a-z0-9]{32}`, true),
Keywords: []string{"algolia"}, Keywords: []string{"algolia"},
} }
+2 -2
View File
@@ -10,7 +10,7 @@ func AlibabaAccessKey() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Alibaba AccessKey ID", Description: "Alibaba AccessKey ID",
RuleID: "alibaba-access-key-id", RuleID: "alibaba-access-key-id",
Regex: generateUniqueTokenRegex(`(LTAI)(?i)[a-z0-9]{20}`), Regex: generateUniqueTokenRegex(`(LTAI)(?i)[a-z0-9]{20}`, true),
Keywords: []string{"LTAI"}, Keywords: []string{"LTAI"},
} }
@@ -28,7 +28,7 @@ func AlibabaSecretKey() *config.Rule {
Description: "Alibaba Secret Key", Description: "Alibaba Secret Key",
RuleID: "alibaba-secret-key", RuleID: "alibaba-secret-key",
Regex: generateSemiGenericRegex([]string{"alibaba"}, Regex: generateSemiGenericRegex([]string{"alibaba"},
alphaNumeric("30")), alphaNumeric("30"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"alibaba"}, Keywords: []string{"alibaba"},
} }
+2 -2
View File
@@ -10,7 +10,7 @@ func AsanaClientID() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Asana Client ID", Description: "Asana Client ID",
RuleID: "asana-client-id", RuleID: "asana-client-id",
Regex: generateSemiGenericRegex([]string{"asana"}, numeric("16")), Regex: generateSemiGenericRegex([]string{"asana"}, numeric("16"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"asana"}, Keywords: []string{"asana"},
} }
@@ -27,7 +27,7 @@ func AsanaClientSecret() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Asana Client Secret", Description: "Asana Client Secret",
RuleID: "asana-client-secret", RuleID: "asana-client-secret",
Regex: generateSemiGenericRegex([]string{"asana"}, alphaNumeric("32")), Regex: generateSemiGenericRegex([]string{"asana"}, alphaNumeric("32"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"asana"}, Keywords: []string{"asana"},
} }
+1 -1
View File
@@ -11,7 +11,7 @@ func Atlassian() *config.Rule {
Description: "Atlassian API token", Description: "Atlassian API token",
RuleID: "atlassian-api-token", RuleID: "atlassian-api-token",
Regex: generateSemiGenericRegex([]string{ Regex: generateSemiGenericRegex([]string{
"atlassian", "confluence", "jira"}, alphaNumeric("24")), "atlassian", "confluence", "jira"}, alphaNumeric("24"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"atlassian", "confluence", "jira"}, Keywords: []string{"atlassian", "confluence", "jira"},
} }
+1 -1
View File
@@ -14,7 +14,7 @@ func Authress() *config.Rule {
Description: "Authress Service Client Access Key", Description: "Authress Service Client Access Key",
RuleID: "authress-service-client-access-key", RuleID: "authress-service-client-access-key",
SecretGroup: 1, SecretGroup: 1,
Regex: generateUniqueTokenRegex(`(?:sc|ext|scauth|authress)_[a-z0-9]{5,30}\.[a-z0-9]{4,6}\.acc[_-][a-z0-9-]{10,32}\.[a-z0-9+/_=-]{30,120}`), Regex: generateUniqueTokenRegex(`(?:sc|ext|scauth|authress)_[a-z0-9]{5,30}\.[a-z0-9]{4,6}\.acc[_-][a-z0-9-]{10,32}\.[a-z0-9+/_=-]{30,120}`, true),
Keywords: []string{"sc_", "ext_", "scauth_", "authress_"}, Keywords: []string{"sc_", "ext_", "scauth_", "authress_"},
} }
+1 -1
View File
@@ -12,7 +12,7 @@ func Beamer() *config.Rule {
RuleID: "beamer-api-token", RuleID: "beamer-api-token",
SecretGroup: 1, SecretGroup: 1,
Regex: generateSemiGenericRegex([]string{"beamer"}, Regex: generateSemiGenericRegex([]string{"beamer"},
`b_[a-z0-9=_\-]{44}`), `b_[a-z0-9=_\-]{44}`, true),
Keywords: []string{"beamer"}, Keywords: []string{"beamer"},
} }
+2 -2
View File
@@ -10,7 +10,7 @@ func BitBucketClientID() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Bitbucket Client ID", Description: "Bitbucket Client ID",
RuleID: "bitbucket-client-id", RuleID: "bitbucket-client-id",
Regex: generateSemiGenericRegex([]string{"bitbucket"}, alphaNumeric("32")), Regex: generateSemiGenericRegex([]string{"bitbucket"}, alphaNumeric("32"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"bitbucket"}, Keywords: []string{"bitbucket"},
} }
@@ -27,7 +27,7 @@ func BitBucketClientSecret() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Bitbucket Client Secret", Description: "Bitbucket Client Secret",
RuleID: "bitbucket-client-secret", RuleID: "bitbucket-client-secret",
Regex: generateSemiGenericRegex([]string{"bitbucket"}, alphaNumericExtended("64")), Regex: generateSemiGenericRegex([]string{"bitbucket"}, alphaNumericExtended("64"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"bitbucket"}, Keywords: []string{"bitbucket"},
} }
+2 -2
View File
@@ -10,7 +10,7 @@ func BittrexAccessKey() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Bittrex Access Key", Description: "Bittrex Access Key",
RuleID: "bittrex-access-key", RuleID: "bittrex-access-key",
Regex: generateSemiGenericRegex([]string{"bittrex"}, alphaNumeric("32")), Regex: generateSemiGenericRegex([]string{"bittrex"}, alphaNumeric("32"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"bittrex"}, Keywords: []string{"bittrex"},
} }
@@ -27,7 +27,7 @@ func BittrexSecretKey() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Bittrex Secret Key", Description: "Bittrex Secret Key",
RuleID: "bittrex-secret-key", RuleID: "bittrex-secret-key",
Regex: generateSemiGenericRegex([]string{"bittrex"}, alphaNumeric("32")), Regex: generateSemiGenericRegex([]string{"bittrex"}, alphaNumeric("32"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"bittrex"}, Keywords: []string{"bittrex"},
} }
+1 -1
View File
@@ -10,7 +10,7 @@ func CodecovAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "codecov-access-token", RuleID: "codecov-access-token",
Description: "Codecov Access Token", Description: "Codecov Access Token",
Regex: generateSemiGenericRegex([]string{"codecov"}, alphaNumeric("32")), Regex: generateSemiGenericRegex([]string{"codecov"}, alphaNumeric("32"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"codecov", "codecov",
+1 -1
View File
@@ -11,7 +11,7 @@ func CoinbaseAccessToken() *config.Rule {
RuleID: "coinbase-access-token", RuleID: "coinbase-access-token",
Description: "Coinbase Access Token", Description: "Coinbase Access Token",
Regex: generateSemiGenericRegex([]string{"coinbase"}, Regex: generateSemiGenericRegex([]string{"coinbase"},
alphaNumericExtendedShort("64")), alphaNumericExtendedShort("64"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"coinbase", "coinbase",
+2 -2
View File
@@ -10,7 +10,7 @@ func ConfluentSecretKey() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "confluent-secret-key", RuleID: "confluent-secret-key",
Description: "Confluent Secret Key", Description: "Confluent Secret Key",
Regex: generateSemiGenericRegex([]string{"confluent"}, alphaNumeric("64")), Regex: generateSemiGenericRegex([]string{"confluent"}, alphaNumeric("64"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"confluent", "confluent",
@@ -29,7 +29,7 @@ func ConfluentAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "confluent-access-token", RuleID: "confluent-access-token",
Description: "Confluent Access Token", Description: "Confluent Access Token",
Regex: generateSemiGenericRegex([]string{"confluent"}, alphaNumeric("16")), Regex: generateSemiGenericRegex([]string{"confluent"}, alphaNumeric("16"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"confluent", "confluent",
+1 -1
View File
@@ -11,7 +11,7 @@ func Contentful() *config.Rule {
Description: "Contentful delivery API token", Description: "Contentful delivery API token",
RuleID: "contentful-delivery-api-token", RuleID: "contentful-delivery-api-token",
Regex: generateSemiGenericRegex([]string{"contentful"}, Regex: generateSemiGenericRegex([]string{"contentful"},
alphaNumericExtended("43")), alphaNumericExtended("43"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"contentful"}, Keywords: []string{"contentful"},
} }
+1 -1
View File
@@ -10,7 +10,7 @@ func Databricks() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Databricks API token", Description: "Databricks API token",
RuleID: "databricks-api-token", RuleID: "databricks-api-token",
Regex: generateUniqueTokenRegex(`dapi[a-h0-9]{32}`), Regex: generateUniqueTokenRegex(`dapi[a-h0-9]{32}`, true),
Keywords: []string{"dapi"}, Keywords: []string{"dapi"},
} }
+1 -1
View File
@@ -11,7 +11,7 @@ func DatadogtokenAccessToken() *config.Rule {
RuleID: "datadog-access-token", RuleID: "datadog-access-token",
Description: "Datadog Access Token", Description: "Datadog Access Token",
Regex: generateSemiGenericRegex([]string{"datadog"}, Regex: generateSemiGenericRegex([]string{"datadog"},
alphaNumeric("40")), alphaNumeric("40"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"datadog", "datadog",
@@ -18,7 +18,7 @@ func DefinedNetworkingAPIToken() *config.Rule {
SecretGroup: 1, SecretGroup: 1,
// Regex used for detecting secrets. See regex section below for more details // Regex used for detecting secrets. See regex section below for more details
Regex: generateSemiGenericRegex([]string{"dnkey"}, `dnkey-[a-z0-9=_\-]{26}-[a-z0-9=_\-]{52}`), Regex: generateSemiGenericRegex([]string{"dnkey"}, `dnkey-[a-z0-9=_\-]{26}-[a-z0-9=_\-]{52}`, true),
// Keywords used for string matching on fragments (think of this as a prefilter) // Keywords used for string matching on fragments (think of this as a prefilter)
Keywords: []string{"dnkey"}, Keywords: []string{"dnkey"},
+3 -3
View File
@@ -10,7 +10,7 @@ func DigitalOceanPAT() *config.Rule {
Description: "DigitalOcean Personal Access Token", Description: "DigitalOcean Personal Access Token",
RuleID: "digitalocean-pat", RuleID: "digitalocean-pat",
SecretGroup: 1, SecretGroup: 1,
Regex: generateUniqueTokenRegex(`dop_v1_[a-f0-9]{64}`), Regex: generateUniqueTokenRegex(`dop_v1_[a-f0-9]{64}`, true),
Keywords: []string{"dop_v1_"}, Keywords: []string{"dop_v1_"},
} }
@@ -25,7 +25,7 @@ func DigitalOceanOAuthToken() *config.Rule {
Description: "DigitalOcean OAuth Access Token", Description: "DigitalOcean OAuth Access Token",
RuleID: "digitalocean-access-token", RuleID: "digitalocean-access-token",
SecretGroup: 1, SecretGroup: 1,
Regex: generateUniqueTokenRegex(`doo_v1_[a-f0-9]{64}`), Regex: generateUniqueTokenRegex(`doo_v1_[a-f0-9]{64}`, true),
Keywords: []string{"doo_v1_"}, Keywords: []string{"doo_v1_"},
} }
@@ -40,7 +40,7 @@ func DigitalOceanRefreshToken() *config.Rule {
Description: "DigitalOcean OAuth Refresh Token", Description: "DigitalOcean OAuth Refresh Token",
RuleID: "digitalocean-refresh-token", RuleID: "digitalocean-refresh-token",
SecretGroup: 1, SecretGroup: 1,
Regex: generateUniqueTokenRegex(`dor_v1_[a-f0-9]{64}`), Regex: generateUniqueTokenRegex(`dor_v1_[a-f0-9]{64}`, true),
Keywords: []string{"dor_v1_"}, Keywords: []string{"dor_v1_"},
} }
+3 -3
View File
@@ -10,7 +10,7 @@ func DiscordAPIToken() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Discord API key", Description: "Discord API key",
RuleID: "discord-api-token", RuleID: "discord-api-token",
Regex: generateSemiGenericRegex([]string{"discord"}, hex("64")), Regex: generateSemiGenericRegex([]string{"discord"}, hex("64"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"discord"}, Keywords: []string{"discord"},
} }
@@ -27,7 +27,7 @@ func DiscordClientID() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Discord client ID", Description: "Discord client ID",
RuleID: "discord-client-id", RuleID: "discord-client-id",
Regex: generateSemiGenericRegex([]string{"discord"}, numeric("18")), Regex: generateSemiGenericRegex([]string{"discord"}, numeric("18"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"discord"}, Keywords: []string{"discord"},
} }
@@ -44,7 +44,7 @@ func DiscordClientSecret() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Discord client secret", Description: "Discord client secret",
RuleID: "discord-client-secret", RuleID: "discord-client-secret",
Regex: generateSemiGenericRegex([]string{"discord"}, alphaNumericExtended("32")), Regex: generateSemiGenericRegex([]string{"discord"}, alphaNumericExtended("32"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"discord"}, Keywords: []string{"discord"},
} }
+1 -1
View File
@@ -10,7 +10,7 @@ func DroneciAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "droneci-access-token", RuleID: "droneci-access-token",
Description: "Droneci Access Token", Description: "Droneci Access Token",
Regex: generateSemiGenericRegex([]string{"droneci"}, alphaNumeric("32")), Regex: generateSemiGenericRegex([]string{"droneci"}, alphaNumeric("32"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"droneci", "droneci",
+3 -3
View File
@@ -10,7 +10,7 @@ func DropBoxAPISecret() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Dropbox API secret", Description: "Dropbox API secret",
RuleID: "dropbox-api-token", RuleID: "dropbox-api-token",
Regex: generateSemiGenericRegex([]string{"dropbox"}, alphaNumeric("15")), Regex: generateSemiGenericRegex([]string{"dropbox"}, alphaNumeric("15"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"dropbox"}, Keywords: []string{"dropbox"},
} }
@@ -27,7 +27,7 @@ func DropBoxShortLivedAPIToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "dropbox-short-lived-api-token", RuleID: "dropbox-short-lived-api-token",
Description: "Dropbox short lived API token", Description: "Dropbox short lived API token",
Regex: generateSemiGenericRegex([]string{"dropbox"}, `sl\.[a-z0-9\-=_]{135}`), Regex: generateSemiGenericRegex([]string{"dropbox"}, `sl\.[a-z0-9\-=_]{135}`, true),
Keywords: []string{"dropbox"}, Keywords: []string{"dropbox"},
} }
@@ -40,7 +40,7 @@ func DropBoxLongLivedAPIToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "dropbox-long-lived-api-token", RuleID: "dropbox-long-lived-api-token",
Description: "Dropbox long lived API token", Description: "Dropbox long lived API token",
Regex: generateSemiGenericRegex([]string{"dropbox"}, `[a-z0-9]{11}(AAAAAAAAAA)[a-z0-9\-_=]{43}`), Regex: generateSemiGenericRegex([]string{"dropbox"}, `[a-z0-9]{11}(AAAAAAAAAA)[a-z0-9\-_=]{43}`, true),
Keywords: []string{"dropbox"}, Keywords: []string{"dropbox"},
} }
+1 -1
View File
@@ -10,7 +10,7 @@ func EtsyAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "etsy-access-token", RuleID: "etsy-access-token",
Description: "Etsy Access Token", Description: "Etsy Access Token",
Regex: generateSemiGenericRegex([]string{"etsy"}, alphaNumeric("24")), Regex: generateSemiGenericRegex([]string{"etsy"}, alphaNumeric("24"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"etsy", "etsy",
+1 -1
View File
@@ -10,7 +10,7 @@ func Facebook() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Facebook Access Token", Description: "Facebook Access Token",
RuleID: "facebook", RuleID: "facebook",
Regex: generateSemiGenericRegex([]string{"facebook"}, hex("32")), Regex: generateSemiGenericRegex([]string{"facebook"}, hex("32"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"facebook"}, Keywords: []string{"facebook"},
} }
+1 -1
View File
@@ -10,7 +10,7 @@ func FastlyAPIToken() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Fastly API key", Description: "Fastly API key",
RuleID: "fastly-api-token", RuleID: "fastly-api-token",
Regex: generateSemiGenericRegex([]string{"fastly"}, alphaNumericExtended("32")), Regex: generateSemiGenericRegex([]string{"fastly"}, alphaNumericExtended("32"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"fastly"}, Keywords: []string{"fastly"},
} }
+2 -2
View File
@@ -10,7 +10,7 @@ func FinicityClientSecret() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Finicity Client Secret", Description: "Finicity Client Secret",
RuleID: "finicity-client-secret", RuleID: "finicity-client-secret",
Regex: generateSemiGenericRegex([]string{"finicity"}, alphaNumeric("20")), Regex: generateSemiGenericRegex([]string{"finicity"}, alphaNumeric("20"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"finicity"}, Keywords: []string{"finicity"},
} }
@@ -27,7 +27,7 @@ func FinicityAPIToken() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Finicity API token", Description: "Finicity API token",
RuleID: "finicity-api-token", RuleID: "finicity-api-token",
Regex: generateSemiGenericRegex([]string{"finicity"}, hex("32")), Regex: generateSemiGenericRegex([]string{"finicity"}, hex("32"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"finicity"}, Keywords: []string{"finicity"},
} }
+1 -1
View File
@@ -10,7 +10,7 @@ func FinnhubAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "finnhub-access-token", RuleID: "finnhub-access-token",
Description: "Finnhub Access Token", Description: "Finnhub Access Token",
Regex: generateSemiGenericRegex([]string{"finnhub"}, alphaNumeric("20")), Regex: generateSemiGenericRegex([]string{"finnhub"}, alphaNumeric("20"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"finnhub", "finnhub",
+1 -1
View File
@@ -10,7 +10,7 @@ func FlickrAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "flickr-access-token", RuleID: "flickr-access-token",
Description: "Flickr Access Token", Description: "Flickr Access Token",
Regex: generateSemiGenericRegex([]string{"flickr"}, alphaNumeric("32")), Regex: generateSemiGenericRegex([]string{"flickr"}, alphaNumeric("32"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"flickr", "flickr",
+1 -1
View File
@@ -10,7 +10,7 @@ func FreshbooksAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "freshbooks-access-token", RuleID: "freshbooks-access-token",
Description: "Freshbooks Access Token", Description: "Freshbooks Access Token",
Regex: generateSemiGenericRegex([]string{"freshbooks"}, alphaNumeric("64")), Regex: generateSemiGenericRegex([]string{"freshbooks"}, alphaNumeric("64"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"freshbooks", "freshbooks",
+1 -1
View File
@@ -29,7 +29,7 @@ func GCPAPIKey() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "gcp-api-key", RuleID: "gcp-api-key",
Description: "GCP API key", Description: "GCP API key",
Regex: generateUniqueTokenRegex(`AIza[0-9A-Za-z\\-_]{35}`), Regex: generateUniqueTokenRegex(`AIza[0-9A-Za-z\\-_]{35}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"AIza", "AIza",
+1 -1
View File
@@ -19,7 +19,7 @@ func GenericCredential() *config.Rule {
"password", "password",
"auth", "auth",
"access", "access",
}, `[0-9a-z\-_.=]{10,150}`), }, `[0-9a-z\-_.=]{10,150}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"key", "key",
+1 -1
View File
@@ -11,7 +11,7 @@ func GitterAccessToken() *config.Rule {
RuleID: "gitter-access-token", RuleID: "gitter-access-token",
Description: "Gitter Access Token", Description: "Gitter Access Token",
Regex: generateSemiGenericRegex([]string{"gitter"}, Regex: generateSemiGenericRegex([]string{"gitter"},
alphaNumericExtendedShort("40")), alphaNumericExtendedShort("40"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"gitter", "gitter",
+1 -1
View File
@@ -10,7 +10,7 @@ func GoCardless() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "gocardless-api-token", RuleID: "gocardless-api-token",
Description: "GoCardless API token", Description: "GoCardless API token",
Regex: generateSemiGenericRegex([]string{"gocardless"}, `live_(?i)[a-z0-9\-_=]{40}`), Regex: generateSemiGenericRegex([]string{"gocardless"}, `live_(?i)[a-z0-9\-_=]{40}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"live_", "live_",
+3 -3
View File
@@ -11,7 +11,7 @@ func GrafanaApiKey() *config.Rule {
Description: "Grafana api key (or Grafana cloud api key)", Description: "Grafana api key (or Grafana cloud api key)",
RuleID: "grafana-api-key", RuleID: "grafana-api-key",
SecretGroup: 1, SecretGroup: 1,
Regex: generateUniqueTokenRegex(`eyJrIjoi[A-Za-z0-9]{70,400}={0,2}`), Regex: generateUniqueTokenRegex(`eyJrIjoi[A-Za-z0-9]{70,400}={0,2}`, true),
Keywords: []string{"eyJrIjoi"}, Keywords: []string{"eyJrIjoi"},
} }
@@ -30,7 +30,7 @@ func GrafanaCloudApiToken() *config.Rule {
Description: "Grafana cloud api token", Description: "Grafana cloud api token",
RuleID: "grafana-cloud-api-token", RuleID: "grafana-cloud-api-token",
SecretGroup: 1, SecretGroup: 1,
Regex: generateUniqueTokenRegex(`glc_[A-Za-z0-9+/]{32,400}={0,2}`), Regex: generateUniqueTokenRegex(`glc_[A-Za-z0-9+/]{32,400}={0,2}`, true),
Keywords: []string{"glc_"}, Keywords: []string{"glc_"},
} }
@@ -49,7 +49,7 @@ func GrafanaServiceAccountToken() *config.Rule {
Description: "Grafana service account token", Description: "Grafana service account token",
RuleID: "grafana-service-account-token", RuleID: "grafana-service-account-token",
SecretGroup: 1, SecretGroup: 1,
Regex: generateUniqueTokenRegex(`glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8}`), Regex: generateUniqueTokenRegex(`glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8}`, true),
Keywords: []string{"glsa_"}, Keywords: []string{"glsa_"},
} }
+1 -1
View File
@@ -9,7 +9,7 @@ func Heroku() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Heroku API Key", Description: "Heroku API Key",
RuleID: "heroku-api-key", RuleID: "heroku-api-key",
Regex: generateSemiGenericRegex([]string{"heroku"}, hex8_4_4_4_12()), Regex: generateSemiGenericRegex([]string{"heroku"}, hex8_4_4_4_12(), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"heroku"}, Keywords: []string{"heroku"},
} }
+1 -1
View File
@@ -10,7 +10,7 @@ func HubSpot() *config.Rule {
Description: "HubSpot API Token", Description: "HubSpot API Token",
RuleID: "hubspot-api-key", RuleID: "hubspot-api-key",
Regex: generateSemiGenericRegex([]string{"hubspot"}, Regex: generateSemiGenericRegex([]string{"hubspot"},
`[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}`), `[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"hubspot"}, Keywords: []string{"hubspot"},
} }
+1 -1
View File
@@ -10,7 +10,7 @@ func Intercom() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Intercom API Token", Description: "Intercom API Token",
RuleID: "intercom-api-key", RuleID: "intercom-api-key",
Regex: generateSemiGenericRegex([]string{"intercom"}, alphaNumericExtended("60")), Regex: generateSemiGenericRegex([]string{"intercom"}, alphaNumericExtended("60"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"intercom"}, Keywords: []string{"intercom"},
} }
+2 -3
View File
@@ -22,12 +22,11 @@ func JFrogAPIKey() *config.Rule {
SecretGroup: 1, SecretGroup: 1,
// Regex used for detecting secrets. See regex section below for more details // Regex used for detecting secrets. See regex section below for more details
Regex: generateSemiGenericRegex(keywords, alphaNumeric("73")), Regex: generateSemiGenericRegex(keywords, alphaNumeric("73"), true),
// Keywords used for string matching on fragments (think of this as a prefilter) // Keywords used for string matching on fragments (think of this as a prefilter)
Keywords: keywords, Keywords: keywords,
} }
// validate // validate
tps := []string{ tps := []string{
fmt.Sprintf("--set imagePullSecretJfrog.password=%s", secrets.NewSecret(alphaNumeric("73"))), fmt.Sprintf("--set imagePullSecretJfrog.password=%s", secrets.NewSecret(alphaNumeric("73"))),
@@ -50,7 +49,7 @@ func JFrogIdentityToken() *config.Rule {
SecretGroup: 1, SecretGroup: 1,
// Regex used for detecting secrets. See regex section below for more details // Regex used for detecting secrets. See regex section below for more details
Regex: generateSemiGenericRegex(keywords, alphaNumeric("64")), Regex: generateSemiGenericRegex(keywords, alphaNumeric("64"), true),
// Keywords used for string matching on fragments (think of this as a prefilter) // Keywords used for string matching on fragments (think of this as a prefilter)
Keywords: keywords, Keywords: keywords,
+1 -1
View File
@@ -9,7 +9,7 @@ func JWT() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "JSON Web Token", Description: "JSON Web Token",
RuleID: "jwt", RuleID: "jwt",
Regex: generateUniqueTokenRegex(`ey[0-9a-z]{30,34}\.ey[0-9a-z-\/_]{30,500}\.[0-9a-zA-Z-\/_]{10,200}={0,2}`), Regex: generateUniqueTokenRegex(`ey[0-9a-z]{30,34}\.ey[0-9a-z-\/_]{30,500}\.[0-9a-zA-Z-\/_]{10,200}={0,2}`, true),
Keywords: []string{"ey"}, Keywords: []string{"ey"},
} }
+1 -1
View File
@@ -11,7 +11,7 @@ func KrakenAccessToken() *config.Rule {
RuleID: "kraken-access-token", RuleID: "kraken-access-token",
Description: "Kraken Access Token", Description: "Kraken Access Token",
Regex: generateSemiGenericRegex([]string{"kraken"}, Regex: generateSemiGenericRegex([]string{"kraken"},
alphaNumericExtendedLong("80,90")), alphaNumericExtendedLong("80,90"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"kraken", "kraken",
+2 -2
View File
@@ -10,7 +10,7 @@ func KucoinAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "kucoin-access-token", RuleID: "kucoin-access-token",
Description: "Kucoin Access Token", Description: "Kucoin Access Token",
Regex: generateSemiGenericRegex([]string{"kucoin"}, hex("24")), Regex: generateSemiGenericRegex([]string{"kucoin"}, hex("24"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"kucoin", "kucoin",
@@ -29,7 +29,7 @@ func KucoinSecretKey() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "kucoin-secret-key", RuleID: "kucoin-secret-key",
Description: "Kucoin Secret Key", Description: "Kucoin Secret Key",
Regex: generateSemiGenericRegex([]string{"kucoin"}, hex8_4_4_4_12()), Regex: generateSemiGenericRegex([]string{"kucoin"}, hex8_4_4_4_12(), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"kucoin", "kucoin",
+1 -1
View File
@@ -10,7 +10,7 @@ func LaunchDarklyAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "launchdarkly-access-token", RuleID: "launchdarkly-access-token",
Description: "Launchdarkly Access Token", Description: "Launchdarkly Access Token",
Regex: generateSemiGenericRegex([]string{"launchdarkly"}, alphaNumericExtended("40")), Regex: generateSemiGenericRegex([]string{"launchdarkly"}, alphaNumericExtended("40"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"launchdarkly", "launchdarkly",
+1 -1
View File
@@ -28,7 +28,7 @@ func LinearClientSecret() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Linear Client Secret", Description: "Linear Client Secret",
RuleID: "linear-client-secret", RuleID: "linear-client-secret",
Regex: generateSemiGenericRegex([]string{"linear"}, hex("32")), Regex: generateSemiGenericRegex([]string{"linear"}, hex("32"), true),
Keywords: []string{"linear"}, Keywords: []string{"linear"},
SecretGroup: 1, SecretGroup: 1,
} }
+2 -2
View File
@@ -13,7 +13,7 @@ func LinkedinClientSecret() *config.Rule {
Regex: generateSemiGenericRegex([]string{ Regex: generateSemiGenericRegex([]string{
"linkedin", "linkedin",
"linked-in", "linked-in",
}, alphaNumeric("16")), }, alphaNumeric("16"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"linkedin", "linkedin",
@@ -36,7 +36,7 @@ func LinkedinClientID() *config.Rule {
Regex: generateSemiGenericRegex([]string{ Regex: generateSemiGenericRegex([]string{
"linkedin", "linkedin",
"linked-in", "linked-in",
}, alphaNumeric("14")), }, alphaNumeric("14"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"linkedin", "linkedin",
+2 -2
View File
@@ -10,7 +10,7 @@ func LobPubAPIToken() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Lob Publishable API Key", Description: "Lob Publishable API Key",
RuleID: "lob-pub-api-key", RuleID: "lob-pub-api-key",
Regex: generateSemiGenericRegex([]string{"lob"}, `(test|live)_pub_[a-f0-9]{31}`), Regex: generateSemiGenericRegex([]string{"lob"}, `(test|live)_pub_[a-f0-9]{31}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"test_pub", "test_pub",
@@ -31,7 +31,7 @@ func LobAPIToken() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Lob API Key", Description: "Lob API Key",
RuleID: "lob-api-key", RuleID: "lob-api-key",
Regex: generateSemiGenericRegex([]string{"lob"}, `(live|test)_[a-f0-9]{35}`), Regex: generateSemiGenericRegex([]string{"lob"}, `(live|test)_[a-f0-9]{35}`, true),
Keywords: []string{ Keywords: []string{
"test_", "test_",
"live_", "live_",
+1 -1
View File
@@ -10,7 +10,7 @@ func MailChimp() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "mailchimp-api-key", RuleID: "mailchimp-api-key",
Description: "Mailchimp API key", Description: "Mailchimp API key",
Regex: generateSemiGenericRegex([]string{"mailchimp"}, `[a-f0-9]{32}-us20`), Regex: generateSemiGenericRegex([]string{"mailchimp"}, `[a-f0-9]{32}-us20`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"mailchimp", "mailchimp",
+3 -3
View File
@@ -10,7 +10,7 @@ func MailGunPrivateAPIToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "mailgun-private-api-token", RuleID: "mailgun-private-api-token",
Description: "Mailgun private API token", Description: "Mailgun private API token",
Regex: generateSemiGenericRegex([]string{"mailgun"}, `key-[a-f0-9]{32}`), Regex: generateSemiGenericRegex([]string{"mailgun"}, `key-[a-f0-9]{32}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"mailgun", "mailgun",
@@ -29,7 +29,7 @@ func MailGunPubAPIToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "mailgun-pub-key", RuleID: "mailgun-pub-key",
Description: "Mailgun public validation key", Description: "Mailgun public validation key",
Regex: generateSemiGenericRegex([]string{"mailgun"}, `pubkey-[a-f0-9]{32}`), Regex: generateSemiGenericRegex([]string{"mailgun"}, `pubkey-[a-f0-9]{32}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"mailgun", "mailgun",
@@ -48,7 +48,7 @@ func MailGunSigningKey() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "mailgun-signing-key", RuleID: "mailgun-signing-key",
Description: "Mailgun webhook signing key", Description: "Mailgun webhook signing key",
Regex: generateSemiGenericRegex([]string{"mailgun"}, `[a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8}`), Regex: generateSemiGenericRegex([]string{"mailgun"}, `[a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"mailgun", "mailgun",
+1 -1
View File
@@ -10,7 +10,7 @@ func MapBox() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "MapBox API token", Description: "MapBox API token",
RuleID: "mapbox-api-token", RuleID: "mapbox-api-token",
Regex: generateSemiGenericRegex([]string{"mapbox"}, `pk\.[a-z0-9]{60}\.[a-z0-9]{22}`), Regex: generateSemiGenericRegex([]string{"mapbox"}, `pk\.[a-z0-9]{60}\.[a-z0-9]{22}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"mapbox"}, Keywords: []string{"mapbox"},
} }
+1 -1
View File
@@ -10,7 +10,7 @@ func MattermostAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "mattermost-access-token", RuleID: "mattermost-access-token",
Description: "Mattermost Access Token", Description: "Mattermost Access Token",
Regex: generateSemiGenericRegex([]string{"mattermost"}, alphaNumeric("26")), Regex: generateSemiGenericRegex([]string{"mattermost"}, alphaNumeric("26"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"mattermost", "mattermost",
+2 -2
View File
@@ -14,7 +14,7 @@ func MessageBirdAPIToken() *config.Rule {
"messagebird", "messagebird",
"message-bird", "message-bird",
"message_bird", "message_bird",
}, alphaNumeric("25")), }, alphaNumeric("25"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"messagebird", "messagebird",
@@ -41,7 +41,7 @@ func MessageBirdClientID() *config.Rule {
"messagebird", "messagebird",
"message-bird", "message-bird",
"message_bird", "message_bird",
}, hex8_4_4_4_12()), }, hex8_4_4_4_12(), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"messagebird", "messagebird",
+1 -1
View File
@@ -11,7 +11,7 @@ func NetlifyAccessToken() *config.Rule {
RuleID: "netlify-access-token", RuleID: "netlify-access-token",
Description: "Netlify Access Token", Description: "Netlify Access Token",
Regex: generateSemiGenericRegex([]string{"netlify"}, Regex: generateSemiGenericRegex([]string{"netlify"},
alphaNumericExtended("40,46")), alphaNumericExtended("40,46"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"netlify", "netlify",
+3 -3
View File
@@ -14,7 +14,7 @@ func NewRelicUserID() *config.Rule {
"new-relic", "new-relic",
"newrelic", "newrelic",
"new_relic", "new_relic",
}, `NRAK-[a-z0-9]{27}`), }, `NRAK-[a-z0-9]{27}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"NRAK", "NRAK",
@@ -37,7 +37,7 @@ func NewRelicUserKey() *config.Rule {
"new-relic", "new-relic",
"newrelic", "newrelic",
"new_relic", "new_relic",
}, alphaNumeric("64")), }, alphaNumeric("64"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"new-relic", "new-relic",
@@ -62,7 +62,7 @@ func NewRelicBrowserAPIKey() *config.Rule {
"new-relic", "new-relic",
"newrelic", "newrelic",
"new_relic", "new_relic",
}, `NRJS-[a-f0-9]{19}`), }, `NRJS-[a-f0-9]{19}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"NRJS-", "NRJS-",
+1 -1
View File
@@ -10,7 +10,7 @@ func NPM() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "npm-access-token", RuleID: "npm-access-token",
Description: "npm access token", Description: "npm access token",
Regex: generateUniqueTokenRegex(`npm_[a-z0-9]{36}`), Regex: generateUniqueTokenRegex(`npm_[a-z0-9]{36}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"npm_", "npm_",
+1 -1
View File
@@ -12,7 +12,7 @@ func NytimesAccessToken() *config.Rule {
Description: "Nytimes Access Token", Description: "Nytimes Access Token",
Regex: generateSemiGenericRegex([]string{ Regex: generateSemiGenericRegex([]string{
"nytimes", "new-york-times,", "newyorktimes"}, "nytimes", "new-york-times,", "newyorktimes"},
alphaNumericExtended("32")), alphaNumericExtended("32"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"nytimes", "nytimes",
+1 -1
View File
@@ -11,7 +11,7 @@ func OktaAccessToken() *config.Rule {
RuleID: "okta-access-token", RuleID: "okta-access-token",
Description: "Okta Access Token", Description: "Okta Access Token",
Regex: generateSemiGenericRegex([]string{"okta"}, Regex: generateSemiGenericRegex([]string{"okta"},
alphaNumericExtended("42")), alphaNumericExtended("42"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"okta", "okta",
+1 -1
View File
@@ -10,7 +10,7 @@ func OpenAI() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "openai-api-key", RuleID: "openai-api-key",
Description: "OpenAI API Key", Description: "OpenAI API Key",
Regex: generateUniqueTokenRegex(`sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20}`), Regex: generateUniqueTokenRegex(`sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"T3BlbkFJ", "T3BlbkFJ",
+3 -3
View File
@@ -12,7 +12,7 @@ func PlaidAccessID() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "plaid-client-id", RuleID: "plaid-client-id",
Description: "Plaid Client ID", Description: "Plaid Client ID",
Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("24")), Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("24"), true),
SecretGroup: 1, SecretGroup: 1,
Entropy: 3.5, Entropy: 3.5,
Keywords: []string{ Keywords: []string{
@@ -32,7 +32,7 @@ func PlaidSecretKey() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "plaid-secret-key", RuleID: "plaid-secret-key",
Description: "Plaid Secret key", Description: "Plaid Secret key",
Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("30")), Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("30"), true),
SecretGroup: 1, SecretGroup: 1,
Entropy: 3.5, Entropy: 3.5,
Keywords: []string{ Keywords: []string{
@@ -53,7 +53,7 @@ func PlaidAccessToken() *config.Rule {
RuleID: "plaid-api-token", RuleID: "plaid-api-token",
Description: "Plaid API Token", Description: "Plaid API Token",
Regex: generateSemiGenericRegex([]string{"plaid"}, Regex: generateSemiGenericRegex([]string{"plaid"},
fmt.Sprintf("access-(?:sandbox|development|production)-%s", hex8_4_4_4_12())), fmt.Sprintf("access-(?:sandbox|development|production)-%s", hex8_4_4_4_12()), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"plaid", "plaid",
+3 -3
View File
@@ -10,7 +10,7 @@ func PlanetScalePassword() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "planetscale-password", RuleID: "planetscale-password",
Description: "PlanetScale password", Description: "PlanetScale password",
Regex: generateUniqueTokenRegex(`pscale_pw_(?i)[a-z0-9=\-_\.]{32,64}`), Regex: generateUniqueTokenRegex(`pscale_pw_(?i)[a-z0-9=\-_\.]{32,64}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"pscale_pw_", "pscale_pw_",
@@ -31,7 +31,7 @@ func PlanetScaleAPIToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "planetscale-api-token", RuleID: "planetscale-api-token",
Description: "PlanetScale API token", Description: "PlanetScale API token",
Regex: generateUniqueTokenRegex(`pscale_tkn_(?i)[a-z0-9=\-_\.]{32,64}`), Regex: generateUniqueTokenRegex(`pscale_tkn_(?i)[a-z0-9=\-_\.]{32,64}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"pscale_tkn_", "pscale_tkn_",
@@ -52,7 +52,7 @@ func PlanetScaleOAuthToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "planetscale-oauth-token", RuleID: "planetscale-oauth-token",
Description: "PlanetScale OAuth token", Description: "PlanetScale OAuth token",
Regex: generateUniqueTokenRegex(`pscale_oauth_(?i)[a-z0-9=\-_\.]{32,64}`), Regex: generateUniqueTokenRegex(`pscale_oauth_(?i)[a-z0-9=\-_\.]{32,64}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"pscale_oauth_", "pscale_oauth_",
+1 -1
View File
@@ -10,7 +10,7 @@ func PostManAPI() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "postman-api-token", RuleID: "postman-api-token",
Description: "Postman API token", Description: "Postman API token",
Regex: generateUniqueTokenRegex(`PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34}`), Regex: generateUniqueTokenRegex(`PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"PMAK-", "PMAK-",
+1 -1
View File
@@ -10,7 +10,7 @@ func Prefect() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "prefect-api-token", RuleID: "prefect-api-token",
Description: "Prefect API token", Description: "Prefect API token",
Regex: generateUniqueTokenRegex(`pnu_[a-z0-9]{36}`), Regex: generateUniqueTokenRegex(`pnu_[a-z0-9]{36}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"pnu_", "pnu_",
+1 -1
View File
@@ -10,7 +10,7 @@ func PulumiAPIToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "pulumi-api-token", RuleID: "pulumi-api-token",
Description: "Pulumi API token", Description: "Pulumi API token",
Regex: generateUniqueTokenRegex(`pul-[a-f0-9]{40}`), Regex: generateUniqueTokenRegex(`pul-[a-f0-9]{40}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"pul-", "pul-",
+1 -1
View File
@@ -11,7 +11,7 @@ func RapidAPIAccessToken() *config.Rule {
RuleID: "rapidapi-access-token", RuleID: "rapidapi-access-token",
Description: "RapidAPI Access Token", Description: "RapidAPI Access Token",
Regex: generateSemiGenericRegex([]string{"rapidapi"}, Regex: generateSemiGenericRegex([]string{"rapidapi"},
alphaNumericExtendedShort("50")), alphaNumericExtendedShort("50"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"rapidapi", "rapidapi",
+1 -1
View File
@@ -10,7 +10,7 @@ func ReadMe() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "readme-api-token", RuleID: "readme-api-token",
Description: "Readme API token", Description: "Readme API token",
Regex: generateUniqueTokenRegex(`rdme_[a-z0-9]{70}`), Regex: generateUniqueTokenRegex(`rdme_[a-z0-9]{70}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"rdme_", "rdme_",
+1 -1
View File
@@ -10,7 +10,7 @@ func RubyGemsAPIToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "rubygems-api-token", RuleID: "rubygems-api-token",
Description: "Rubygem API token", Description: "Rubygem API token",
Regex: generateUniqueTokenRegex(`rubygems_[a-f0-9]{48}`), Regex: generateUniqueTokenRegex(`rubygems_[a-f0-9]{48}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"rubygems_", "rubygems_",
+25 -9
View File
@@ -15,8 +15,10 @@ const (
caseInsensitive = `(?i)` caseInsensitive = `(?i)`
// identifier prefix (just an ignore group) // identifier prefix (just an ignore group)
identifierPrefix = `(?:` identifierCaseInsensitivePrefix = `(?i:`
identifierSuffix = `)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` identifierCaseInsensitiveSuffix = `)`
identifierPrefix = `(?:`
identifierSuffix = `)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}`
// commonly used assignment operators or function call // commonly used assignment operators or function call
operator = `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)` operator = `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)`
@@ -28,12 +30,18 @@ const (
secretSuffix = `)(?:['|\"|\n|\r|\s|\x60|;]|$)` secretSuffix = `)(?:['|\"|\n|\r|\s|\x60|;]|$)`
) )
func generateSemiGenericRegex(identifiers []string, secretRegex string) *regexp.Regexp { func generateSemiGenericRegex(identifiers []string, secretRegex string, isCaseInsensitive bool) *regexp.Regexp {
var sb strings.Builder var sb strings.Builder
sb.WriteString(caseInsensitive) // The identifiers should always be case-insensitive.
sb.WriteString(identifierPrefix) // This is inelegant but prevents an extraneous `(?i:)` from being added to the pattern; it could be removed.
sb.WriteString(strings.Join(identifiers, "|")) if isCaseInsensitive {
sb.WriteString(identifierSuffix) sb.WriteString(caseInsensitive)
writeIdentifiers(&sb, identifiers)
} else {
sb.WriteString(identifierCaseInsensitivePrefix)
writeIdentifiers(&sb, identifiers)
sb.WriteString(identifierCaseInsensitiveSuffix)
}
sb.WriteString(operator) sb.WriteString(operator)
sb.WriteString(secretPrefix) sb.WriteString(secretPrefix)
sb.WriteString(secretRegex) sb.WriteString(secretRegex)
@@ -41,9 +49,17 @@ func generateSemiGenericRegex(identifiers []string, secretRegex string) *regexp.
return regexp.MustCompile(sb.String()) return regexp.MustCompile(sb.String())
} }
func generateUniqueTokenRegex(secretRegex string) *regexp.Regexp { func writeIdentifiers(sb *strings.Builder, identifiers []string) {
sb.WriteString(identifierPrefix)
sb.WriteString(strings.Join(identifiers, "|"))
sb.WriteString(identifierSuffix)
}
func generateUniqueTokenRegex(secretRegex string, isCaseInsensitive bool) *regexp.Regexp {
var sb strings.Builder var sb strings.Builder
sb.WriteString(caseInsensitive) if isCaseInsensitive {
sb.WriteString(caseInsensitive)
}
sb.WriteString(secretPrefixUnique) sb.WriteString(secretPrefixUnique)
sb.WriteString(secretRegex) sb.WriteString(secretRegex)
sb.WriteString(secretSuffix) sb.WriteString(secretSuffix)
+2 -2
View File
@@ -10,7 +10,7 @@ func SendbirdAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "sendbird-access-token", RuleID: "sendbird-access-token",
Description: "Sendbird Access Token", Description: "Sendbird Access Token",
Regex: generateSemiGenericRegex([]string{"sendbird"}, hex("40")), Regex: generateSemiGenericRegex([]string{"sendbird"}, hex("40"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"sendbird", "sendbird",
@@ -29,7 +29,7 @@ func SendbirdAccessID() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "sendbird-access-id", RuleID: "sendbird-access-id",
Description: "Sendbird Access ID", Description: "Sendbird Access ID",
Regex: generateSemiGenericRegex([]string{"sendbird"}, hex8_4_4_4_12()), Regex: generateSemiGenericRegex([]string{"sendbird"}, hex8_4_4_4_12(), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"sendbird", "sendbird",
+1 -1
View File
@@ -10,7 +10,7 @@ func SendGridAPIToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "sendgrid-api-token", RuleID: "sendgrid-api-token",
Description: "SendGrid API token", Description: "SendGrid API token",
Regex: generateUniqueTokenRegex(`SG\.(?i)[a-z0-9=_\-\.]{66}`), Regex: generateUniqueTokenRegex(`SG\.(?i)[a-z0-9=_\-\.]{66}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"SG.", "SG.",
+1 -1
View File
@@ -10,7 +10,7 @@ func SendInBlueAPIToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "sendinblue-api-token", RuleID: "sendinblue-api-token",
Description: "Sendinblue API token", Description: "Sendinblue API token",
Regex: generateUniqueTokenRegex(`xkeysib-[a-f0-9]{64}\-(?i)[a-z0-9]{16}`), Regex: generateUniqueTokenRegex(`xkeysib-[a-f0-9]{64}\-(?i)[a-z0-9]{16}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"xkeysib-", "xkeysib-",
+1 -1
View File
@@ -10,7 +10,7 @@ func SentryAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "sentry-access-token", RuleID: "sentry-access-token",
Description: "Sentry Access Token", Description: "Sentry Access Token",
Regex: generateSemiGenericRegex([]string{"sentry"}, hex("64")), Regex: generateSemiGenericRegex([]string{"sentry"}, hex("64"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"sentry", "sentry",
+1 -1
View File
@@ -10,7 +10,7 @@ func ShippoAPIToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "shippo-api-token", RuleID: "shippo-api-token",
Description: "Shippo API token", Description: "Shippo API token",
Regex: generateUniqueTokenRegex(`shippo_(live|test)_[a-f0-9]{40}`), Regex: generateUniqueTokenRegex(`shippo_(live|test)_[a-f0-9]{40}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"shippo_", "shippo_",
+1 -1
View File
@@ -13,7 +13,7 @@ func SidekiqSecret() *config.Rule {
RuleID: "sidekiq-secret", RuleID: "sidekiq-secret",
SecretGroup: 1, SecretGroup: 1,
Regex: generateSemiGenericRegex([]string{"BUNDLE_ENTERPRISE__CONTRIBSYS__COM", "BUNDLE_GEMS__CONTRIBSYS__COM"}, Regex: generateSemiGenericRegex([]string{"BUNDLE_ENTERPRISE__CONTRIBSYS__COM", "BUNDLE_GEMS__CONTRIBSYS__COM"},
`[a-f0-9]{8}:[a-f0-9]{8}`), `[a-f0-9]{8}:[a-f0-9]{8}`, true),
Keywords: []string{"BUNDLE_ENTERPRISE__CONTRIBSYS__COM", "BUNDLE_GEMS__CONTRIBSYS__COM"}, Keywords: []string{"BUNDLE_ENTERPRISE__CONTRIBSYS__COM", "BUNDLE_GEMS__CONTRIBSYS__COM"},
} }
+1 -1
View File
@@ -10,7 +10,7 @@ func Snyk() *config.Rule {
Description: "Snyk API token", Description: "Snyk API token",
RuleID: "snyk-api-token", RuleID: "snyk-api-token",
SecretGroup: 1, SecretGroup: 1,
Regex: generateSemiGenericRegex([]string{"snyk"}, hex8_4_4_4_12()), Regex: generateSemiGenericRegex([]string{"snyk"}, hex8_4_4_4_12(), true),
Keywords: []string{"snyk"}, Keywords: []string{"snyk"},
} }
+2 -2
View File
@@ -10,7 +10,7 @@ func SquareAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "square-access-token", RuleID: "square-access-token",
Description: "Square Access Token", Description: "Square Access Token",
Regex: generateUniqueTokenRegex(`sq0atp-[0-9A-Za-z\-_]{22}`), Regex: generateUniqueTokenRegex(`sq0atp-[0-9A-Za-z\-_]{22}`, true),
Keywords: []string{"sq0atp-"}, Keywords: []string{"sq0atp-"},
} }
@@ -26,7 +26,7 @@ func SquareSecret() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "square-secret", RuleID: "square-secret",
Description: "Square Secret", Description: "Square Secret",
Regex: generateUniqueTokenRegex(`sq0csp-[0-9A-Za-z\\-_]{43}`), Regex: generateUniqueTokenRegex(`sq0csp-[0-9A-Za-z\\-_]{43}`, true),
Keywords: []string{"sq0csp-"}, Keywords: []string{"sq0csp-"},
} }
+1 -1
View File
@@ -10,7 +10,7 @@ func SquareSpaceAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "squarespace-access-token", RuleID: "squarespace-access-token",
Description: "Squarespace Access Token", Description: "Squarespace Access Token",
Regex: generateSemiGenericRegex([]string{"squarespace"}, hex8_4_4_4_12()), Regex: generateSemiGenericRegex([]string{"squarespace"}, hex8_4_4_4_12(), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"squarespace", "squarespace",
+2 -2
View File
@@ -14,7 +14,7 @@ func SumoLogicAccessID() *config.Rule {
Description: "SumoLogic Access ID", Description: "SumoLogic Access ID",
// TODO: Make 'su' case-sensitive. // TODO: Make 'su' case-sensitive.
Regex: generateSemiGenericRegex([]string{"sumo"}, Regex: generateSemiGenericRegex([]string{"sumo"},
"su[a-zA-Z0-9]{12}"), "su[a-zA-Z0-9]{12}", false),
SecretGroup: 1, SecretGroup: 1,
Entropy: 3, Entropy: 3,
Keywords: []string{ Keywords: []string{
@@ -56,7 +56,7 @@ func SumoLogicAccessToken() *config.Rule {
RuleID: "sumologic-access-token", RuleID: "sumologic-access-token",
Description: "SumoLogic Access Token", Description: "SumoLogic Access Token",
Regex: generateSemiGenericRegex([]string{"sumo"}, Regex: generateSemiGenericRegex([]string{"sumo"},
alphaNumeric("64")), alphaNumeric("64"), true),
SecretGroup: 1, SecretGroup: 1,
Entropy: 3, Entropy: 3,
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -10,7 +10,7 @@ func TravisCIAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "travisci-access-token", RuleID: "travisci-access-token",
Description: "Travis CI Access Token", Description: "Travis CI Access Token",
Regex: generateSemiGenericRegex([]string{"travis"}, alphaNumeric("22")), Regex: generateSemiGenericRegex([]string{"travis"}, alphaNumeric("22"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"travis", "travis",
+1 -1
View File
@@ -10,7 +10,7 @@ func TrelloAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "trello-access-token", RuleID: "trello-access-token",
Description: "Trello Access Token", Description: "Trello Access Token",
Regex: generateSemiGenericRegex([]string{"trello"}, `[a-zA-Z-0-9]{32}`), Regex: generateSemiGenericRegex([]string{"trello"}, `[a-zA-Z-0-9]{32}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"trello", "trello",
+1 -1
View File
@@ -10,7 +10,7 @@ func TwitchAPIToken() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "twitch-api-token", RuleID: "twitch-api-token",
Description: "Twitch API token", Description: "Twitch API token",
Regex: generateSemiGenericRegex([]string{"twitch"}, alphaNumeric("30")), Regex: generateSemiGenericRegex([]string{"twitch"}, alphaNumeric("30"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"twitch", "twitch",
+5 -5
View File
@@ -10,7 +10,7 @@ func TwitterAPIKey() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Twitter API Key", Description: "Twitter API Key",
RuleID: "twitter-api-key", RuleID: "twitter-api-key",
Regex: generateSemiGenericRegex([]string{"twitter"}, alphaNumeric("25")), Regex: generateSemiGenericRegex([]string{"twitter"}, alphaNumeric("25"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"twitter"}, Keywords: []string{"twitter"},
} }
@@ -27,7 +27,7 @@ func TwitterAPISecret() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Twitter API Secret", Description: "Twitter API Secret",
RuleID: "twitter-api-secret", RuleID: "twitter-api-secret",
Regex: generateSemiGenericRegex([]string{"twitter"}, alphaNumeric("50")), Regex: generateSemiGenericRegex([]string{"twitter"}, alphaNumeric("50"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"twitter"}, Keywords: []string{"twitter"},
} }
@@ -44,7 +44,7 @@ func TwitterBearerToken() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Twitter Bearer Token", Description: "Twitter Bearer Token",
RuleID: "twitter-bearer-token", RuleID: "twitter-bearer-token",
Regex: generateSemiGenericRegex([]string{"twitter"}, "A{22}[a-zA-Z0-9%]{80,100}"), Regex: generateSemiGenericRegex([]string{"twitter"}, "A{22}[a-zA-Z0-9%]{80,100}", true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"twitter"}, Keywords: []string{"twitter"},
} }
@@ -61,7 +61,7 @@ func TwitterAccessToken() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Twitter Access Token", Description: "Twitter Access Token",
RuleID: "twitter-access-token", RuleID: "twitter-access-token",
Regex: generateSemiGenericRegex([]string{"twitter"}, "[0-9]{15,25}-[a-zA-Z0-9]{20,40}"), Regex: generateSemiGenericRegex([]string{"twitter"}, "[0-9]{15,25}-[a-zA-Z0-9]{20,40}", true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"twitter"}, Keywords: []string{"twitter"},
} }
@@ -78,7 +78,7 @@ func TwitterAccessSecret() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Twitter Access Secret", Description: "Twitter Access Secret",
RuleID: "twitter-access-secret", RuleID: "twitter-access-secret",
Regex: generateSemiGenericRegex([]string{"twitter"}, alphaNumeric("45")), Regex: generateSemiGenericRegex([]string{"twitter"}, alphaNumeric("45"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{"twitter"}, Keywords: []string{"twitter"},
} }
+1 -1
View File
@@ -11,7 +11,7 @@ func Typeform() *config.Rule {
RuleID: "typeform-api-token", RuleID: "typeform-api-token",
Description: "Typeform API token", Description: "Typeform API token",
Regex: generateSemiGenericRegex([]string{"typeform"}, Regex: generateSemiGenericRegex([]string{"typeform"},
`tfp_[a-z0-9\-_\.=]{59}`), `tfp_[a-z0-9\-_\.=]{59}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"tfp_", "tfp_",
+2 -2
View File
@@ -10,7 +10,7 @@ func VaultServiceToken() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Vault Service Token", Description: "Vault Service Token",
RuleID: "vault-service-token", RuleID: "vault-service-token",
Regex: generateUniqueTokenRegex(`hvs\.[a-z0-9_-]{90,100}`), Regex: generateUniqueTokenRegex(`hvs\.[a-z0-9_-]{90,100}`, true),
Keywords: []string{"hvs"}, Keywords: []string{"hvs"},
} }
@@ -26,7 +26,7 @@ func VaultBatchToken() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Vault Batch Token", Description: "Vault Batch Token",
RuleID: "vault-batch-token", RuleID: "vault-batch-token",
Regex: generateUniqueTokenRegex(`hvb\.[a-z0-9_-]{138,212}`), Regex: generateUniqueTokenRegex(`hvb\.[a-z0-9_-]{138,212}`, true),
Keywords: []string{"hvb"}, Keywords: []string{"hvb"},
} }
+3 -3
View File
@@ -11,7 +11,7 @@ func YandexAWSAccessToken() *config.Rule {
RuleID: "yandex-aws-access-token", RuleID: "yandex-aws-access-token",
Description: "Yandex AWS Access Token", Description: "Yandex AWS Access Token",
Regex: generateSemiGenericRegex([]string{"yandex"}, Regex: generateSemiGenericRegex([]string{"yandex"},
`YC[a-zA-Z0-9_\-]{38}`), `YC[a-zA-Z0-9_\-]{38}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"yandex", "yandex",
@@ -32,7 +32,7 @@ func YandexAPIKey() *config.Rule {
RuleID: "yandex-api-key", RuleID: "yandex-api-key",
Description: "Yandex API Key", Description: "Yandex API Key",
Regex: generateSemiGenericRegex([]string{"yandex"}, Regex: generateSemiGenericRegex([]string{"yandex"},
`AQVN[A-Za-z0-9_\-]{35,38}`), `AQVN[A-Za-z0-9_\-]{35,38}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"yandex", "yandex",
@@ -53,7 +53,7 @@ func YandexAccessToken() *config.Rule {
RuleID: "yandex-access-token", RuleID: "yandex-access-token",
Description: "Yandex Access Token", Description: "Yandex Access Token",
Regex: generateSemiGenericRegex([]string{"yandex"}, Regex: generateSemiGenericRegex([]string{"yandex"},
`t1\.[A-Z0-9a-z_-]+[=]{0,2}\.[A-Z0-9a-z_-]{86}[=]{0,2}`), `t1\.[A-Z0-9a-z_-]+[=]{0,2}\.[A-Z0-9a-z_-]{86}[=]{0,2}`, true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"yandex", "yandex",
+1 -1
View File
@@ -10,7 +10,7 @@ func ZendeskSecretKey() *config.Rule {
r := config.Rule{ r := config.Rule{
RuleID: "zendesk-secret-key", RuleID: "zendesk-secret-key",
Description: "Zendesk Secret Key", Description: "Zendesk Secret Key",
Regex: generateSemiGenericRegex([]string{"zendesk"}, alphaNumeric("40")), Regex: generateSemiGenericRegex([]string{"zendesk"}, alphaNumeric("40"), true),
SecretGroup: 1, SecretGroup: 1,
Keywords: []string{ Keywords: []string{
"zendesk", "zendesk",
+1 -1
View File
@@ -2759,7 +2759,7 @@ keywords = [
[[rules]] [[rules]]
id = "sumologic-access-id" id = "sumologic-access-id"
description = "SumoLogic Access ID" description = "SumoLogic Access ID"
regex = '''(?i)(?:sumo)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}(su[a-zA-Z0-9]{12})(?:['|\"|\n|\r|\s|\x60|;]|$)''' regex = '''(?i:(?:sumo)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3})(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}(su[a-zA-Z0-9]{12})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
secretGroup = 1 secretGroup = 1
entropy = 3 entropy = 3
keywords = [ keywords = [