mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 20:54:22 +01:00
More rule fixes (#1586)
* feat: tweak more rules * fix(curl): update pattern & ignore more stuff * chore: update .gitleaksignore
This commit is contained in:
1 parent
5407c44e0c
commit
455ae0aab7
47 files changed
+531
-374
No files matched your search
@@ -9,9 +9,10 @@ import (
|
||||
func AdobeClientID() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a pattern that resembles an Adobe OAuth Web Client ID, posing a risk of compromised Adobe integrations and data breaches.",
|
||||
RuleID: "adobe-client-id",
|
||||
Description: "Detected a pattern that resembles an Adobe OAuth Web Client ID, posing a risk of compromised Adobe integrations and data breaches.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"adobe"}, utils.Hex("32"), true),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"adobe"},
|
||||
}
|
||||
|
||||
@@ -25,9 +26,10 @@ func AdobeClientID() *config.Rule {
|
||||
func AdobeClientSecret() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a potential Adobe Client Secret, which, if exposed, could allow unauthorized Adobe service access and data manipulation.",
|
||||
RuleID: "adobe-client-secret",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`(p8e-)(?i)[a-z0-9]{32}`, true),
|
||||
Description: "Discovered a potential Adobe Client Secret, which, if exposed, could allow unauthorized Adobe service access and data manipulation.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`p8e-(?i)[a-z0-9]{32}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"p8e-"},
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,10 @@ import (
|
||||
func AlibabaAccessKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected an Alibaba Cloud AccessKey ID, posing a risk of unauthorized cloud resource access and potential data compromise.",
|
||||
RuleID: "alibaba-access-key-id",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`(LTAI)(?i)[a-z0-9]{20}`, true),
|
||||
Description: "Detected an Alibaba Cloud AccessKey ID, posing a risk of unauthorized cloud resource access and potential data compromise.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`LTAI(?i)[a-z0-9]{20}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"LTAI"},
|
||||
}
|
||||
|
||||
@@ -26,12 +27,11 @@ func AlibabaAccessKey() *config.Rule {
|
||||
func AlibabaSecretKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a potential Alibaba Cloud Secret Key, potentially allowing unauthorized operations and data access within Alibaba Cloud.",
|
||||
RuleID: "alibaba-secret-key",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"alibaba"},
|
||||
utils.AlphaNumeric("30"), true),
|
||||
|
||||
Keywords: []string{"alibaba"},
|
||||
Description: "Discovered a potential Alibaba Cloud Secret Key, potentially allowing unauthorized operations and data access within Alibaba Cloud.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"alibaba"}, utils.AlphaNumeric("30"), true),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"alibaba"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -12,9 +12,10 @@ func Authress() *config.Rule {
|
||||
// Rule Definition
|
||||
// (Note: When changes are made to this, rerun `go generate ./...` and commit the config/gitleaks.toml file
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a possible Authress Service Client Access Key, which may compromise access control services and sensitive data.",
|
||||
RuleID: "authress-service-client-access-key",
|
||||
Regex: utils.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),
|
||||
Description: "Uncovered a possible Authress Service Client Access Key, which may compromise access control services and sensitive data.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`(?:sc|ext|scauth|authress)_(?i)[a-z0-9]{5,30}\.[a-z0-9]{4,6}\.(?-i:acc)[_-][a-z0-9-]{10,32}\.[a-z0-9+/_=-]{30,120}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"sc_", "ext_", "scauth_", "authress_"},
|
||||
}
|
||||
|
||||
|
||||
@@ -11,10 +11,11 @@ import (
|
||||
func Clojars() *config.Rule {
|
||||
// define 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",
|
||||
Description: "Uncovered a possible Clojars API token, risking unauthorized access to Clojure libraries and potential code manipulation.",
|
||||
Regex: regexp.MustCompile(`(?i)CLOJARS_[a-z0-9]{60}`),
|
||||
Keywords: []string{"clojars"},
|
||||
Entropy: 2,
|
||||
Keywords: []string{"clojars_"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -27,11 +27,11 @@ var identifiers = []string{"cloudflare"}
|
||||
func CloudflareGlobalAPIKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Cloudflare Global API Key, potentially compromising cloud application deployments and operational security.",
|
||||
RuleID: "cloudflare-global-api-key",
|
||||
Description: "Detected a Cloudflare Global API Key, potentially compromising cloud application deployments and operational security.",
|
||||
Regex: utils.GenerateSemiGenericRegex(identifiers, utils.Hex("37"), true),
|
||||
|
||||
Keywords: identifiers,
|
||||
Entropy: 2,
|
||||
Keywords: identifiers,
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -44,11 +44,11 @@ func CloudflareGlobalAPIKey() *config.Rule {
|
||||
func CloudflareAPIKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Cloudflare API Key, potentially compromising cloud application deployments and operational security.",
|
||||
RuleID: "cloudflare-api-key",
|
||||
Description: "Detected a Cloudflare API Key, potentially compromising cloud application deployments and operational security.",
|
||||
Regex: utils.GenerateSemiGenericRegex(identifiers, utils.AlphaNumericExtendedShort("40"), true),
|
||||
|
||||
Keywords: identifiers,
|
||||
Entropy: 2,
|
||||
Keywords: identifiers,
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -65,8 +65,8 @@ func CloudflareOriginCAKey() *config.Rule {
|
||||
Description: "Detected a Cloudflare Origin CA Key, potentially compromising cloud application deployments and operational security.",
|
||||
RuleID: "cloudflare-origin-ca-key",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`v1\.0-`+utils.Hex("24")+"-"+utils.Hex("146"), false),
|
||||
|
||||
Keywords: ca_identifiers,
|
||||
Entropy: 2,
|
||||
Keywords: ca_identifiers,
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -13,15 +13,18 @@ func CurlBasicAuth() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "curl-auth-user",
|
||||
// TODO: Description: "",
|
||||
Regex: regexp.MustCompile(`\bcurl\b(?:.*|.*(?:[\r\n]{1,2}.*){1,5})[ \t\n\r](?:-u|--user)[ =](?:("[^:"]{3,}:[^"]{3,}")|('[^:']{3,}:[^']{3,}')|((?:"[^"]{3,}"|'[^']{3,}'|[\w$@.-]+):(?:"[^"]{3,}"|'[^']{3,}'|[\w$@.-]+))|)(?:\s|\z)`),
|
||||
Regex: regexp.MustCompile(`\bcurl\b(?:.*|.*(?:[\r\n]{1,2}.*){1,5})[ \t\n\r](?:-u|--user)(?:=|[ \t]{0,5})(?:"([^:"]{3,}:[^"]{3,})"|'([^:']{3,}:[^']{3,})'|((?:"[^"]{3,}"|'[^']{3,}'|[\w$@.-]+):(?:"[^"]{3,}"|'[^']{3,}'|[\w${}@.-]+)))(?:\s|\z)`),
|
||||
Keywords: []string{"curl"},
|
||||
Entropy: 2,
|
||||
Allowlists: []config.Allowlist{
|
||||
{
|
||||
Regexes: []*regexp.Regexp{
|
||||
regexp.MustCompile(`[^:]+:(changeme|pass(word)?|pwd|\*+|x+)`), // common placeholder passwords
|
||||
regexp.MustCompile(`<[^>]+>:<[^>]+>|<[^:]+:[^>]+>`), // <placeholder>
|
||||
regexp.MustCompile(`[^:]+:\[[^]]+]`), // [placeholder]
|
||||
regexp.MustCompile(`(?i)[^:]+:\$(\d|[a-z]\w+|(\{\d|[a-z]\w+}))`), // $1 or $VARIABLE
|
||||
regexp.MustCompile(`[^:]+:(change(it|me)|pass(word)?|pwd|test|token|\*+|x+)`), // common placeholder passwords
|
||||
regexp.MustCompile(`<[^>]+>:<[^>]+>|<[^:]+:[^>]+>`), // <placeholder>
|
||||
regexp.MustCompile(`[^:]+:\[[^]]+]`), // [placeholder]
|
||||
regexp.MustCompile(`[^:]+:\$(\d|\w+|\{(\d|\w+)})`), // $1 or $VARIABLE
|
||||
regexp.MustCompile(`\$\([^)]+\):\$\([^)]+\)`), // $(cat login.txt)
|
||||
regexp.MustCompile(`\$?{{[^}]+}}:\$?{{[^}]+}}`), // ${{ secrets.FOO }} or {{ .Values.foo }}
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -37,6 +40,7 @@ func CurlBasicAuth() *config.Rule {
|
||||
-u developer:yqDVtkqPECriaLRi`, // different line
|
||||
|
||||
// long
|
||||
`curl -sw '%{http_code}' -X POST --user 'johns:h0pk1ns~21s' $GItHUB_API_URL/$GIT_COMMIT --data`,
|
||||
`curl --user roger23@gmail.com:pQ9wTxu4Fg https://www.dropbox.com/cli_link?host_id=abcdefg -v`, // same line, no quotes
|
||||
`curl -s --user 'api:d2LkV78zLx!t' \
|
||||
https://api.mailgun.net/v2/sandbox91d3515882ecfaa1c65be642.mailgun.org/messages`, // same line, single quotes
|
||||
@@ -52,13 +56,25 @@ func CurlBasicAuth() *config.Rule {
|
||||
}
|
||||
fps := []string{
|
||||
// short
|
||||
`curl -i -u 'test:test'`,
|
||||
` curl -sL --user "$1:$2" "$3" > "$4"`, // environment variable
|
||||
`curl -u <user:password> https://test.com/endpoint`, // placeholder
|
||||
`curl --user neo4j:[PASSWORD] http://[IP]:7474/db/data/`, // placeholder
|
||||
`curl -u "myusername" http://localhost:15130/api/check_user/`, // no password
|
||||
`curl -u username:token`,
|
||||
`curl -u "${_username}:${_password}"`,
|
||||
`curl -k -X POST -I -u "SRVC_JENKINS:${APPID}"`,
|
||||
|
||||
// long
|
||||
` curl -sL --user "$GITHUB_USERNAME:$GITHUB_PASSWORD" "$GITHUB_URL" > "$TESTS_PATH"`, // environment variable
|
||||
`curl -sw '%{http_code}' -X POST --user '$USERNAME:$PASSWORD' $GItHUB_API_URL/$GIT_COMMIT --data`,
|
||||
`curl --user "xxx:yyy"`,
|
||||
` curl -sL --user "$GITHUB_USERNAME:$GITHUB_PASSWORD" "$GITHUB_URL" > "$TESTS_PATH"`, // environment variable
|
||||
// variable interpolation
|
||||
`curl --silent --fail {{- if and $.Values.username $.Values.password }} --user "{{ $.Values.username }}:{{ $.Values.password }}"`,
|
||||
`curl -XGET -i -u "${{ env.ELK_ID }}:${{ build.env.ELK_PASS }}"`,
|
||||
`curl -XGET -i -u "${{needs.vault.outputs.account_id}}:${{needs.vault.outputs.account_password}}"`,
|
||||
`curl -XGET -i -u "${{ steps.vault.outputs.account_id }}:${{ steps.vault.outputs.account_password }}"`,
|
||||
`curl -X POST --user "$(cat ./login.txt):$(cat ./password.txt)"`, // command
|
||||
`curl http://127.0.0.1:5000/file --user user:pass --digest # digest auth`, // placeholder
|
||||
` curl -X GET --insecure --user "username:password" \`, // placeholder
|
||||
`curl --silent --insecure --user ${f5user}:${f5pass} \`, // placeholder
|
||||
@@ -80,12 +96,13 @@ nc -u -l 41234`,
|
||||
// https://curl.se/docs/manpage.html#-H
|
||||
func CurlHeaderAuth() *config.Rule {
|
||||
// language=regexp
|
||||
authPat := `(?i)(?:Authorization:[ \t]?(?:Basic[ \t]([a-z0-9+/]{8,}={0,3})|(?:Bearer|Token)[ \t]([\w=@.+/-]{8,})|([\w=.+/-]{8,}))|(?:ApiKey|Token|X-API-KEY):[ \t]?([\w=@.+/-]{8,}))`
|
||||
authPat := `(?i)(?:Authorization:[ \t]{0,5}(?:Basic[ \t]([a-z0-9+/]{8,}={0,3})|(?:Bearer|(?:Api-)?Token)[ \t]([\w=~@.+/-]{8,})|([\w=~@.+/-]{8,}))|(?:(?:X-)?Api-?(?:Key|Token)|Token):[ \t]{0,5}([\w=~@.+/-]{8,}))`
|
||||
r := config.Rule{
|
||||
RuleID: "curl-auth-header",
|
||||
// TODO: Description: "",
|
||||
Regex: regexp.MustCompile(
|
||||
fmt.Sprintf(`\bcurl\b(?:.*?|.*?(?:[\r\n]{1,2}.*?){1,5})[ \t\n\r](?:-H|--header)[ =](?:"%s"|'%s')(?:\B|\s|\z)`, authPat, authPat)),
|
||||
// language=regexp
|
||||
fmt.Sprintf(`\bcurl\b(?:.*?|.*?(?:[\r\n]{1,2}.*?){1,5})[ \t\n\r](?:-H|--header)(?:=|[ \t]{0,5})(?:"%s"|'%s')(?:\B|\s|\z)`, authPat, authPat)),
|
||||
Entropy: 2.75,
|
||||
Keywords: []string{"curl"},
|
||||
//Allowlists: []config.Allowlist{
|
||||
@@ -96,6 +113,7 @@ func CurlHeaderAuth() *config.Rule {
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
`curl --header 'Authorization: 5eb4223e-5008-46e5-be67-c7b8f2732305'`,
|
||||
// Short flag.
|
||||
`curl -H 'Authorization: Basic YnJvd3Nlcjo=' \`, // same line, single quotes
|
||||
// TODO: Handle short flags combined.
|
||||
@@ -105,7 +123,7 @@ func CurlHeaderAuth() *config.Rule {
|
||||
`curl -k -X POST --header "Authorization: Basic djJlNEpYa0NJUHZ5a2FWT0VRXzRqZmZUdDkwYTp2emNBZGFzZWpmlWZiUDc2VUJjNDNNVDExclVh" "https://api-qa.example.com:8243/token" -d "grant_type=client_credentials"`, // same line, double quotes
|
||||
|
||||
// Basic auth.
|
||||
` curl -X POST -H "Content-Type: application/json" \
|
||||
`curl -X POST -H "Content-Type: application/json" \
|
||||
-H "Authorization: Basic MzUzYjMwMmM0NDU3NGY1NjUwNDU2ODdlNTM0ZTdkNmE6Mjg2OTI0Njk3ZTYxNWE2NzJhNjQ2YTQ5MzU0NTY0NmM=" \
|
||||
-d '{"user":{"emailAddress":"test@example.com"}, "password":"password"}' \
|
||||
'http://localhost:8080/oauth2-provider/v1.0/users'`, // different line, double quotes
|
||||
@@ -126,18 +144,22 @@ func CurlHeaderAuth() *config.Rule {
|
||||
`curl -X GET "https://api.cloudflare.com/client/v4/user/tokens/verify" \
|
||||
-H "Authorization: Bearer _FXNljbSRYMWx3TWrd7lgKhLtVZX6iskC8Wcbb4b" \
|
||||
-H "Content-Type:application/json"`,
|
||||
`curl -H "Authorization: Bearer sha256~bRLFnzd59Z3XpZH5_seJPHALOuvbWiKwbFKSsoALkgp"`,
|
||||
|
||||
// Token auth
|
||||
`curl -H "Authorization: Token 22cb987851bc5659229114c62e60c79abd0d2c08" --request PUT https://appsecclass.report/api/use/635`, // token
|
||||
`curl -H "Authorization: Api-Token 22cb987851bc5659l29114c62e60c79abd0d2c08" --request PUT https://appsecclass.report/api/use/635`, // token
|
||||
`curl -H "Authorization: Token 22cb987851bc5659229114c62e60c79abd0d2c08" --request PUT https://appsecclass.report/api/use/635`, // token
|
||||
|
||||
// Nothing
|
||||
`curl -L -H "Authorization:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb25maWRlbmNlIjowLjh9.kvRPfjAhLhtRTczoRgctVGp7KY1QVH3UBZM-gM0x8ec" service1.local -> correct jwt `, // no prefix
|
||||
`curl -L -H "Authorization: sha256~bRLFnzd5@=-.a+/hgdS"`, // no prefix
|
||||
|
||||
// Non-authorization headers.
|
||||
`curl -XPOST http://localhost:8080/api/tasks -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "Token: 3fea6af1349166ea" -d "content=hello-curl"`, // token
|
||||
`curl -X GET \
|
||||
-H "apikey: c4ed6c21-9dd5-4a05-8e3f-c56d1151cce8" \
|
||||
-H "Accept: application/json" \`, // API Key placeholder
|
||||
-H "Accept: application/json" \`, // apikey
|
||||
`curl -X POST --header "Api-Token: Sk94HG7f6KB"`, // api-token
|
||||
`curl -XPOST http://localhost:8080/api/tasks -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "Token: 3fea6af1349166ea" -d "content=hello-curl"`, // token
|
||||
}
|
||||
fps := []string{
|
||||
// Placeholders
|
||||
|
||||
@@ -9,15 +9,20 @@ import (
|
||||
func Databricks() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a Databricks API token, which may compromise big data analytics platforms and sensitive data processing.",
|
||||
RuleID: "databricks-api-token",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`dapi[a-h0-9]{32}`, true),
|
||||
Description: "Uncovered a Databricks API token, which may compromise big data analytics platforms and sensitive data processing.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`dapi[a-f0-9]{32}(?:-\d)?`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"dapi"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("databricks", "dapi"+secrets.NewSecret(utils.Hex("32"))),
|
||||
`token = dapif13ac4b49d1cb31f69f678e39602e381-2`, // gitleaks:ignore
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
`DATABRICKS_TOKEN=dapi123456789012345678a9bc01234defg5`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -8,9 +8,10 @@ import (
|
||||
|
||||
func DigitalOceanPAT() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discovered a DigitalOcean Personal Access Token, posing a threat to cloud infrastructure security and data privacy.",
|
||||
RuleID: "digitalocean-pat",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`dop_v1_[a-f0-9]{64}`, true),
|
||||
Description: "Discovered a DigitalOcean Personal Access Token, posing a threat to cloud infrastructure security and data privacy.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`dop_v1_[a-f0-9]{64}`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"dop_v1_"},
|
||||
}
|
||||
|
||||
@@ -22,11 +23,11 @@ func DigitalOceanPAT() *config.Rule {
|
||||
|
||||
func DigitalOceanOAuthToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Found a DigitalOcean OAuth Access Token, risking unauthorized cloud resource access and data compromise.",
|
||||
RuleID: "digitalocean-access-token",
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`doo_v1_[a-f0-9]{64}`, true),
|
||||
Keywords: []string{"doo_v1_"},
|
||||
Description: "Found a DigitalOcean OAuth Access Token, risking unauthorized cloud resource access and data compromise.",
|
||||
Entropy: 3,
|
||||
Regex: utils.GenerateUniqueTokenRegex(`doo_v1_[a-f0-9]{64}`, false),
|
||||
Keywords: []string{"doo_v1_"},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
|
||||
@@ -11,10 +11,11 @@ import (
|
||||
func Doppler() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a Doppler API token, posing a risk to environment and secrets management security.",
|
||||
RuleID: "doppler-api-token",
|
||||
Description: "Discovered a Doppler API token, posing a risk to environment and secrets management security.",
|
||||
Regex: regexp.MustCompile(`dp\.pt\.(?i)[a-z0-9]{43}`),
|
||||
Keywords: []string{"doppler"},
|
||||
Entropy: 2,
|
||||
Keywords: []string{`dp.pt.`},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -14,7 +14,8 @@ func Duffel() *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}`),
|
||||
Keywords: []string{"duffel"},
|
||||
Entropy: 2,
|
||||
Keywords: []string{"duffel_"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -11,10 +11,11 @@ import (
|
||||
func Dynatrace() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Dynatrace API token, potentially risking application performance monitoring and data exposure.",
|
||||
RuleID: "dynatrace-api-token",
|
||||
Description: "Detected a Dynatrace API token, potentially risking application performance monitoring and data exposure.",
|
||||
Regex: regexp.MustCompile(`dt0c01\.(?i)[a-z0-9]{24}\.[a-z0-9]{64}`),
|
||||
Keywords: []string{"dynatrace"},
|
||||
Entropy: 4,
|
||||
Keywords: []string{"dt0c01"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -11,9 +11,10 @@ import (
|
||||
func EasyPost() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified an EasyPost API token, which could lead to unauthorized postal and shipment service access and data exposure.",
|
||||
RuleID: "easypost-api-token",
|
||||
Description: "Identified an EasyPost API token, which could lead to unauthorized postal and shipment service access and data exposure.",
|
||||
Regex: regexp.MustCompile(`\bEZAK(?i)[a-z0-9]{54}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"EZAK"},
|
||||
}
|
||||
|
||||
@@ -27,9 +28,10 @@ func EasyPost() *config.Rule {
|
||||
func EasyPostTestAPI() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected an EasyPost test API token, risking exposure of test environments and potentially sensitive shipment data.",
|
||||
RuleID: "easypost-test-api-token",
|
||||
Description: "Detected an EasyPost test API token, risking exposure of test environments and potentially sensitive shipment data.",
|
||||
Regex: regexp.MustCompile(`\bEZTK(?i)[a-z0-9]{54}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"EZTK"},
|
||||
}
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
func FacebookSecret() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a Facebook Application secret, posing a risk of unauthorized access to Facebook accounts and personal data exposure.",
|
||||
RuleID: "facebook-secret",
|
||||
Description: "Discovered a Facebook Application secret, posing a risk of unauthorized access to Facebook accounts and personal data exposure.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"facebook"}, utils.Hex("32"), true),
|
||||
|
||||
Keywords: []string{"facebook"},
|
||||
Entropy: 3,
|
||||
Keywords: []string{"facebook"},
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -31,9 +31,10 @@ func FacebookSecret() *config.Rule {
|
||||
func FacebookAccessToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a Facebook Access Token, posing a risk of unauthorized access to Facebook accounts and personal data exposure.",
|
||||
RuleID: "facebook-access-token",
|
||||
Description: "Discovered a Facebook Access Token, posing a risk of unauthorized access to Facebook accounts and personal data exposure.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`\d{15,16}(\||%)[0-9a-z\-_]{27,40}`, true),
|
||||
Entropy: 3,
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -49,9 +50,10 @@ func FacebookAccessToken() *config.Rule {
|
||||
func FacebookPageAccessToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a Facebook Page Access Token, posing a risk of unauthorized access to Facebook accounts and personal data exposure.",
|
||||
RuleID: "facebook-page-access-token",
|
||||
Regex: utils.GenerateUniqueTokenRegex("EAA[MC]"+utils.AlphaNumeric("20,"), true),
|
||||
Description: "Discovered a Facebook Page Access Token, posing a risk of unauthorized access to Facebook accounts and personal data exposure.",
|
||||
Regex: utils.GenerateUniqueTokenRegex("EAA[MC](?i)"+utils.AlphaNumeric("20,"), false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"EAAM", "EAAC"},
|
||||
}
|
||||
|
||||
@@ -62,5 +64,8 @@ func FacebookPageAccessToken() *config.Rule {
|
||||
`- name: FACEBOOK_TOKEN
|
||||
value: "EAACEdEose0cBA1bad3afsf2aew"`, // gitleaks:allow
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
`eaaaC0b75a9329fded2ffa9a02b47e0117831b82`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -11,9 +11,10 @@ import (
|
||||
func FlutterwavePublicKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Finicity Public Key, potentially exposing public cryptographic operations and integrations.",
|
||||
RuleID: "flutterwave-public-key",
|
||||
Description: "Detected a Finicity Public Key, potentially exposing public cryptographic operations and integrations.",
|
||||
Regex: regexp.MustCompile(`FLWPUBK_TEST-(?i)[a-h0-9]{32}-X`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"FLWPUBK_TEST"},
|
||||
}
|
||||
|
||||
@@ -27,9 +28,10 @@ func FlutterwavePublicKey() *config.Rule {
|
||||
func FlutterwaveSecretKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a Flutterwave Secret Key, risking unauthorized financial transactions and data breaches.",
|
||||
RuleID: "flutterwave-secret-key",
|
||||
Description: "Identified a Flutterwave Secret Key, risking unauthorized financial transactions and data breaches.",
|
||||
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{32}-X`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"FLWSECK_TEST"},
|
||||
}
|
||||
|
||||
@@ -43,9 +45,10 @@ func FlutterwaveSecretKey() *config.Rule {
|
||||
func FlutterwaveEncKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a Flutterwave Encryption Key, which may compromise payment processing and sensitive financial information.",
|
||||
RuleID: "flutterwave-encryption-key",
|
||||
Description: "Uncovered a Flutterwave Encryption Key, which may compromise payment processing and sensitive financial information.",
|
||||
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{12}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"FLWSECK_TEST"},
|
||||
}
|
||||
|
||||
|
||||
@@ -8,14 +8,24 @@ import (
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
var githubAllowlist = []config.Allowlist{
|
||||
{
|
||||
Paths: []*regexp.Regexp{
|
||||
// https://github.com/octokit/auth-token.js/?tab=readme-ov-file#createtokenauthtoken-options
|
||||
regexp.MustCompile(`(^|/)@octokit/auth-token/README\.md$`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func GitHubPat() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a GitHub Personal Access Token, potentially leading to unauthorized repository access and sensitive content exposure.",
|
||||
RuleID: "github-pat",
|
||||
Description: "Uncovered a GitHub Personal Access Token, potentially leading to unauthorized repository access and sensitive content exposure.",
|
||||
Regex: regexp.MustCompile(`ghp_[0-9a-zA-Z]{36}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"ghp_"},
|
||||
Allowlists: githubAllowlist,
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -31,8 +41,8 @@ func GitHubPat() *config.Rule {
|
||||
func GitHubFineGrainedPat() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Found a GitHub Fine-Grained Personal Access Token, risking unauthorized repository access and code manipulation.",
|
||||
RuleID: "github-fine-grained-pat",
|
||||
Description: "Found a GitHub Fine-Grained Personal Access Token, risking unauthorized repository access and code manipulation.",
|
||||
Regex: regexp.MustCompile(`github_pat_\w{82}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"github_pat_"},
|
||||
@@ -51,8 +61,8 @@ func GitHubFineGrainedPat() *config.Rule {
|
||||
func GitHubOauth() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a GitHub OAuth Access Token, posing a risk of compromised GitHub account integrations and data leaks.",
|
||||
RuleID: "github-oauth",
|
||||
Description: "Discovered a GitHub OAuth Access Token, posing a risk of compromised GitHub account integrations and data leaks.",
|
||||
Regex: regexp.MustCompile(`gho_[0-9a-zA-Z]{36}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"gho_"},
|
||||
@@ -71,11 +81,12 @@ func GitHubOauth() *config.Rule {
|
||||
func GitHubApp() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitHub App Token, which may compromise GitHub application integrations and source code security.",
|
||||
RuleID: "github-app-token",
|
||||
Description: "Identified a GitHub App Token, which may compromise GitHub application integrations and source code security.",
|
||||
Regex: regexp.MustCompile(`(?:ghu|ghs)_[0-9a-zA-Z]{36}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"ghu_", "ghs_"},
|
||||
Allowlists: githubAllowlist,
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -93,8 +104,8 @@ func GitHubApp() *config.Rule {
|
||||
func GitHubRefresh() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a GitHub Refresh Token, which could allow prolonged unauthorized access to GitHub services.",
|
||||
RuleID: "github-refresh-token",
|
||||
Description: "Detected a GitHub Refresh Token, which could allow prolonged unauthorized access to GitHub services.",
|
||||
Regex: regexp.MustCompile(`ghr_[0-9a-zA-Z]{36}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"ghr_"},
|
||||
|
||||
@@ -12,14 +12,13 @@ func GrafanaApiKey() *config.Rule {
|
||||
RuleID: "grafana-api-key",
|
||||
Description: "Identified a Grafana API key, which could compromise monitoring dashboards and sensitive data analytics.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`eyJrIjoi[A-Za-z0-9]{70,400}={0,3}`, true),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"eyJrIjoi"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("grafana-api-key",
|
||||
"eyJrIjoi"+
|
||||
secrets.NewSecret(utils.AlphaNumeric("70"))),
|
||||
utils.GenerateSampleSecret("grafana-api-key", "eyJrIjoi"+secrets.NewSecret(utils.AlphaNumeric("70"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
func HashiCorpTerraform() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a HashiCorp Terraform user/org API token, which may lead to unauthorized infrastructure management and security breaches.",
|
||||
RuleID: "hashicorp-tf-api-token",
|
||||
Description: "Uncovered a HashiCorp Terraform user/org API token, which may lead to unauthorized infrastructure management and security breaches.",
|
||||
Regex: regexp.MustCompile(`(?i)[a-z0-9]{14}\.(?-i:atlasv1)\.[a-z0-9\-_=]{60,70}`),
|
||||
Entropy: 3.5,
|
||||
Keywords: []string{"atlasv1"},
|
||||
@@ -34,11 +34,12 @@ func HashicorpField() *config.Rule {
|
||||
keywords := []string{"administrator_login_password", "password"}
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a HashiCorp Terraform password field, risking unauthorized infrastructure configuration and security breaches.",
|
||||
RuleID: "hashicorp-tf-password",
|
||||
Description: "Identified a HashiCorp Terraform password field, risking unauthorized infrastructure configuration and security breaches.",
|
||||
Regex: utils.GenerateSemiGenericRegex(keywords, fmt.Sprintf(`"%s"`, utils.AlphaNumericExtended("8,20")), true),
|
||||
Keywords: keywords,
|
||||
Entropy: 2,
|
||||
Path: regexp.MustCompile(`(?i)\.(?:tf|hcl)$`),
|
||||
Keywords: keywords,
|
||||
}
|
||||
|
||||
tps := map[string]string{
|
||||
|
||||
@@ -14,7 +14,7 @@ func VaultServiceToken() *config.Rule {
|
||||
Description: "Identified a Vault Service Token, potentially compromising infrastructure security and access to sensitive credentials.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`(?:hvs\.[\w-]{90,120}|s\.(?i:[a-z0-9]{24}))`, false),
|
||||
Entropy: 3.5,
|
||||
Keywords: []string{"hvs", "s."},
|
||||
Keywords: []string{"hvs.", "s."},
|
||||
Allowlists: []config.Allowlist{
|
||||
{
|
||||
Regexes: []*regexp.Regexp{
|
||||
@@ -52,15 +52,17 @@ func VaultServiceToken() *config.Rule {
|
||||
func VaultBatchToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Vault Batch Token, risking unauthorized access to secret management services and sensitive data.",
|
||||
RuleID: "vault-batch-token",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`hvb\.[a-z0-9_-]{138,212}`, true),
|
||||
Keywords: []string{"hvb"},
|
||||
Description: "Detected a Vault Batch Token, risking unauthorized access to secret management services and sensitive data.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`hvb\.[\w-]{138,300}`, false),
|
||||
Entropy: 4,
|
||||
Keywords: []string{"hvb."},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("vault", "hvb."+secrets.NewSecret(utils.AlphaNumericExtendedShort("138"))),
|
||||
`hvb.AAAAAQJgxDgqsGNorpoOR7hPZ5SU-ynBvCl764jyRP_fnX7WvkdkDzGjbLNGdPdtlY33Als2P36yDZueqzfdGw9RsaTeaYXSH7E4RYSWuRoQ9YRKIw8o7mDDY2ZcT3KOB7RwtW1w1FN2eDqcy_sbCjXPaM1iBVH-mqMSYRmRd2nb5D1SJPeBzIYRqSglLc31wUGN7xEzyrKUczqOKsIcybQA`, // gitleaks:allow
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -19,8 +19,7 @@ func HuggingFaceAccessToken() *config.Rule {
|
||||
RuleID: "huggingface-access-token",
|
||||
Description: "Discovered a Hugging Face Access token, which could lead to unauthorized access to AI models and sensitive data.",
|
||||
Regex: regexp.MustCompile(`(?:^|[\\'"` + "`" + ` >=:])(hf_[a-zA-Z]{34})(?:$|[\\'"` + "`" + ` <])`),
|
||||
|
||||
Entropy: 1,
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"hf_",
|
||||
},
|
||||
|
||||
@@ -11,7 +11,8 @@ func Intra42ClientSecret() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Found a Intra42 client secret, which could lead to unauthorized access to the 42School API and sensitive data.",
|
||||
RuleID: "intra42-client-secret",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`s-s4t2(?:ud|af)-[abcdef0123456789]{64}`, true),
|
||||
Regex: utils.GenerateUniqueTokenRegex(`s-s4t2(?:ud|af)-(?i)[abcdef0123456789]{64}`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"intra",
|
||||
"s-s4t2ud-",
|
||||
|
||||
@@ -15,6 +15,7 @@ func JWT() *config.Rule {
|
||||
Description: "Uncovered a JSON Web Token, which may lead to unauthorized access to web applications and sensitive user data.",
|
||||
RuleID: "jwt",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`ey[a-zA-Z0-9]{17,}\.ey[a-zA-Z0-9\/\\_-]{17,}\.(?:[a-zA-Z0-9\/\\_-]{10,}={0,2})?`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"ey"},
|
||||
}
|
||||
|
||||
@@ -72,6 +73,7 @@ func JWTBase64() *config.Rule {
|
||||
Description: "Detected a Base64-encoded JSON Web Token, posing a risk of exposing encoded authentication and data exchange information.",
|
||||
Regex: regexp.MustCompile(
|
||||
`\bZXlK(?:(?P<alg>aGJHY2lPaU)|(?P<apu>aGNIVWlPaU)|(?P<apv>aGNIWWlPaU)|(?P<aud>aGRXUWlPaU)|(?P<b64>aU5qUWlP)|(?P<crit>amNtbDBJanBi)|(?P<cty>amRIa2lPaU)|(?P<epk>bGNHc2lPbn)|(?P<enc>bGJtTWlPaU)|(?P<jku>cWEzVWlPaU)|(?P<jwk>cWQyc2lPb)|(?P<iss>cGMzTWlPaU)|(?P<iv>cGRpSTZJ)|(?P<kid>cmFXUWlP)|(?P<key_ops>clpYbGZiM0J6SWpwY)|(?P<kty>cmRIa2lPaUp)|(?P<nonce>dWIyNWpaU0k2)|(?P<p2c>d01tTWlP)|(?P<p2s>d01uTWlPaU)|(?P<ppt>d2NIUWlPaU)|(?P<sub>emRXSWlPaU)|(?P<svt>emRuUWlP)|(?P<tag>MFlXY2lPaU)|(?P<typ>MGVYQWlPaUp)|(?P<url>MWNtd2l)|(?P<use>MWMyVWlPaUp)|(?P<ver>MlpYSWlPaU)|(?P<version>MlpYSnphVzl1SWpv)|(?P<x>NElqb2)|(?P<x5c>NE5XTWlP)|(?P<x5t>NE5YUWlPaU)|(?P<x5ts256>NE5YUWpVekkxTmlJNkl)|(?P<x5u>NE5YVWlPaU)|(?P<zip>NmFYQWlPaU))[a-zA-Z0-9\/\\_+\-\r\n]{40,}={0,2}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"zxlk"},
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ func KubernetesSecret() *config.Rule {
|
||||
// - valid base64 characters
|
||||
// - longer than 10 characters (no "YmFyCg==")
|
||||
//language=regexp
|
||||
dataPat := `\bdata:(?:.|\s){0,100}?\s+([\w.-]+:(?:[ \t]*(?:\||>[-+]?)\s+)?[ \t]*(?:["']?[a-z0-9]{10,}={0,3}["']?|\{\{[ \t\w"|$:=,.-]+}}|""|''))`
|
||||
dataPat := `\bdata:(?:.|\s){0,100}?\s+([\w.-]+:(?:[ \t]*(?:\||>[-+]?)\s+)?[ \t]*(?:["']?[a-z0-9+/]{10,}={0,3}["']?|\{\{[ \t\w"|$:=,.-]+}}|""|''))`
|
||||
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
@@ -46,6 +46,11 @@ func KubernetesSecret() *config.Rule {
|
||||
|
||||
// validate
|
||||
tps := map[string]string{
|
||||
"base64-characters.yaml": `
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
data:
|
||||
password: AAAAAAAAAAC7hjsA+H3owFygUv4w5B67lcSx14zff9FCPADiNbSwYWgE+O7Dhiy5tkRecs21ljjofvebe6xsYlA4cVmght0=`,
|
||||
"comment.yaml": `
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
|
||||
@@ -11,9 +11,10 @@ import (
|
||||
func LinearAPIToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Linear API Token, posing a risk to project management tools and sensitive task data.",
|
||||
RuleID: "linear-api-key",
|
||||
Description: "Detected a Linear API Token, posing a risk to project management tools and sensitive task data.",
|
||||
Regex: regexp.MustCompile(`lin_api_(?i)[a-z0-9]{40}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"lin_api_"},
|
||||
}
|
||||
|
||||
@@ -27,9 +28,10 @@ func LinearAPIToken() *config.Rule {
|
||||
func LinearClientSecret() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a Linear Client Secret, which may compromise secure integrations and sensitive project management data.",
|
||||
RuleID: "linear-client-secret",
|
||||
Description: "Identified a Linear Client Secret, which may compromise secure integrations and sensitive project management data.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"linear"}, utils.Hex("32"), true),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"linear"},
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ func NPM() *config.Rule {
|
||||
RuleID: "npm-access-token",
|
||||
Description: "Uncovered an npm access token, potentially compromising package management and code repository access.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`npm_[a-z0-9]{36}`, true),
|
||||
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"npm_",
|
||||
},
|
||||
|
||||
@@ -11,9 +11,8 @@ func OktaAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "okta-access-token",
|
||||
Description: "Identified an Okta Access Token, which may compromise identity management services and user authentication data.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"okta"},
|
||||
utils.AlphaNumericExtended("42"), true),
|
||||
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"okta"}, utils.AlphaNumericExtended("42"), true),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"okta",
|
||||
},
|
||||
@@ -23,5 +22,8 @@ func OktaAccessToken() *config.Rule {
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("okta", secrets.NewSecret(utils.AlphaNumeric("42"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
"00000000000000000000000000000000000TUVWXYZ",
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -11,8 +11,8 @@ func OpenAI() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "openai-api-key",
|
||||
Description: "Found an OpenAI API Key, posing a risk of unauthorized access to AI services and data manipulation.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20}`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"T3BlbkFJ",
|
||||
},
|
||||
|
||||
@@ -15,9 +15,8 @@ func OpenshiftUserToken() *config.Rule {
|
||||
RuleID: "openshift-user-token",
|
||||
Description: "Found an OpenShift user token, potentially compromising an OpenShift/Kubernetes cluster.",
|
||||
// TODO: Do tokens vary in length or are they always 43?
|
||||
Regex: regexp.MustCompile(`\b(sha256~[\w-]{43})(?:[^\w-]|\z)`),
|
||||
Entropy: 3.5,
|
||||
SecretGroup: 0,
|
||||
Regex: regexp.MustCompile(`\b(sha256~[\w-]{43})(?:[^\w-]|\z)`),
|
||||
Entropy: 3.5,
|
||||
Keywords: []string{
|
||||
"sha256~",
|
||||
},
|
||||
|
||||
@@ -11,8 +11,8 @@ func PlanetScalePassword() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "planetscale-password",
|
||||
Description: "Discovered a PlanetScale password, which could lead to unauthorized database operations and data breaches.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pscale_pw_(?i)[a-z0-9=\-_\.]{32,64}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pscale_pw_(?i)[\w=\.-]{32,64}`, true),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"pscale_pw_",
|
||||
},
|
||||
@@ -32,8 +32,8 @@ func PlanetScaleAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "planetscale-api-token",
|
||||
Description: "Identified a PlanetScale API token, potentially compromising database management and operations.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pscale_tkn_(?i)[a-z0-9=\-_\.]{32,64}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pscale_tkn_(?i)[\w=\.-]{32,64}`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"pscale_tkn_",
|
||||
},
|
||||
@@ -53,8 +53,8 @@ func PlanetScaleOAuthToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "planetscale-oauth-token",
|
||||
Description: "Found a PlanetScale OAuth token, posing a risk to database access control and sensitive data integrity.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pscale_oauth_(?i)[a-z0-9=\-_\.]{32,64}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pscale_oauth_[\w=\.-]{32,64}`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"pscale_oauth_",
|
||||
},
|
||||
|
||||
@@ -11,8 +11,8 @@ func PostManAPI() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "postman-api-token",
|
||||
Description: "Uncovered a Postman API token, potentially compromising API testing and development workflows.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34}`, false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"PMAK-",
|
||||
},
|
||||
|
||||
@@ -11,8 +11,8 @@ func Prefect() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "prefect-api-token",
|
||||
Description: "Detected a Prefect API token, risking unauthorized access to workflow management and automation services.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pnu_[a-z0-9]{36}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pnu_[a-zA-Z0-9]{36}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"pnu_",
|
||||
},
|
||||
@@ -22,5 +22,8 @@ func Prefect() *config.Rule {
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("api-token", "pnu_"+secrets.NewSecret(utils.AlphaNumeric("36"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
`PREFECT_API_KEY = "pnu_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -11,8 +11,8 @@ func PulumiAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "pulumi-api-token",
|
||||
Description: "Found a Pulumi API token, posing a risk to infrastructure as code services and cloud resource management.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pul-[a-f0-9]{40}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`pul-[a-f0-9]{40}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"pul-",
|
||||
},
|
||||
@@ -22,5 +22,8 @@ func PulumiAPIToken() *config.Rule {
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("pulumi-api-token", "pul-"+secrets.NewSecret(utils.Hex("40"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
` <img src="./assets/vipul-f0eb1acf0da84c06a50c5b2c59932001997786b176dec02bd16128ee9ea83628.png" alt="" class="w-16 h-16 rounded-full">`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -13,8 +13,8 @@ func PyPiUploadToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discovered a PyPI upload token, potentially compromising Python package distribution and repository integrity.",
|
||||
RuleID: "pypi-upload-token",
|
||||
Regex: regexp.MustCompile(
|
||||
`pypi-AgEIcHlwaS5vcmc[A-Za-z0-9\-_]{50,1000}`),
|
||||
Regex: regexp.MustCompile(`pypi-AgEIcHlwaS5vcmc[\w-]{50,1000}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"pypi-AgEIcHlwaS5vcmc",
|
||||
},
|
||||
|
||||
@@ -11,8 +11,8 @@ func ReadMe() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "readme-api-token",
|
||||
Description: "Detected a Readme API token, risking unauthorized documentation management and content exposure.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`rdme_[a-z0-9]{70}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`rdme_[a-z0-9]{70}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"rdme_",
|
||||
},
|
||||
@@ -22,5 +22,8 @@ func ReadMe() *config.Rule {
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("api-token", "rdme_"+secrets.NewSecret(utils.AlphaNumeric("70"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
fps := []string{
|
||||
`const API_KEY = 'rdme_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -11,8 +11,8 @@ func RubyGemsAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "rubygems-api-token",
|
||||
Description: "Identified a Rubygem API token, potentially compromising Ruby library distribution and package management.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`rubygems_[a-f0-9]{48}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`rubygems_[a-f0-9]{48}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"rubygems_",
|
||||
},
|
||||
|
||||
@@ -11,7 +11,8 @@ func ScalingoAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Found a Scalingo API token, posing a risk to cloud platform services and application deployment security.",
|
||||
RuleID: "scalingo-api-token",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`tk-us-[a-zA-Z0-9-_]{48}`, false),
|
||||
Regex: utils.GenerateUniqueTokenRegex(`tk-us-[\w-]{48}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"tk-us-"},
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ func SendGridAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "sendgrid-api-token",
|
||||
Description: "Detected a SendGrid API token, posing a risk of unauthorized email service operations and data exposure.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`SG\.(?i)[a-z0-9=_\-\.]{66}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`SG\.(?i)[a-z0-9=_\-\.]{66}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"SG.",
|
||||
},
|
||||
|
||||
@@ -11,8 +11,8 @@ func SendInBlueAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "sendinblue-api-token",
|
||||
Description: "Identified a Sendinblue API token, which may compromise email marketing services and subscriber data privacy.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`xkeysib-[a-f0-9]{64}\-(?i)[a-z0-9]{16}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`xkeysib-[a-f0-9]{64}\-(?i)[a-z0-9]{16}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"xkeysib-",
|
||||
},
|
||||
|
||||
@@ -11,8 +11,8 @@ func ShippoAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "shippo-api-token",
|
||||
Description: "Discovered a Shippo API token, potentially compromising shipping services and customer order data.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`shippo_(live|test)_[a-f0-9]{40}`, true),
|
||||
|
||||
Regex: utils.GenerateUniqueTokenRegex(`shippo_(?:live|test)_[a-fA-F0-9]{40}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"shippo_",
|
||||
},
|
||||
|
||||
@@ -11,9 +11,10 @@ import (
|
||||
func ShopifySharedSecret() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Found a Shopify shared secret, posing a risk to application authentication and e-commerce platform security.",
|
||||
RuleID: "shopify-shared-secret",
|
||||
Description: "Found a Shopify shared secret, posing a risk to application authentication and e-commerce platform security.",
|
||||
Regex: regexp.MustCompile(`shpss_[a-fA-F0-9]{32}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"shpss_"},
|
||||
}
|
||||
|
||||
@@ -25,9 +26,10 @@ func ShopifySharedSecret() *config.Rule {
|
||||
func ShopifyAccessToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a Shopify access token, which could lead to unauthorized e-commerce platform access and data breaches.",
|
||||
RuleID: "shopify-access-token",
|
||||
Description: "Uncovered a Shopify access token, which could lead to unauthorized e-commerce platform access and data breaches.",
|
||||
Regex: regexp.MustCompile(`shpat_[a-fA-F0-9]{32}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"shpat_"},
|
||||
}
|
||||
|
||||
@@ -39,9 +41,10 @@ func ShopifyAccessToken() *config.Rule {
|
||||
func ShopifyCustomAccessToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Shopify custom access token, potentially compromising custom app integrations and e-commerce data security.",
|
||||
RuleID: "shopify-custom-access-token",
|
||||
Description: "Detected a Shopify custom access token, potentially compromising custom app integrations and e-commerce data security.",
|
||||
Regex: regexp.MustCompile(`shpca_[a-fA-F0-9]{32}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"shpca_"},
|
||||
}
|
||||
|
||||
@@ -53,9 +56,10 @@ func ShopifyCustomAccessToken() *config.Rule {
|
||||
func ShopifyPrivateAppAccessToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a Shopify private app access token, risking unauthorized access to private app data and store operations.",
|
||||
RuleID: "shopify-private-app-access-token",
|
||||
Description: "Identified a Shopify private app access token, risking unauthorized access to private app data and store operations.",
|
||||
Regex: regexp.MustCompile(`shppa_[a-fA-F0-9]{32}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"shppa_"},
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ import (
|
||||
func SlackBotToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a Slack Bot token, which may compromise bot integrations and communication channel security.",
|
||||
RuleID: "slack-bot-token",
|
||||
Regex: regexp.MustCompile(
|
||||
`(xoxb-[0-9]{10,13}\-[0-9]{10,13}[a-zA-Z0-9-]*)`),
|
||||
Description: "Identified a Slack Bot token, which may compromise bot integrations and communication channel security.",
|
||||
Regex: regexp.MustCompile(`xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"xoxb",
|
||||
},
|
||||
@@ -44,10 +44,11 @@ func SlackBotToken() *config.Rule {
|
||||
func SlackUserToken() *config.Rule {
|
||||
// define rule
|
||||
r := 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",
|
||||
Description: "Found a Slack User token, posing a risk of unauthorized user impersonation and data access within Slack workspaces.",
|
||||
// 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}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"xoxp-", "xoxe-"},
|
||||
}
|
||||
|
||||
@@ -82,10 +83,11 @@ func SlackUserToken() *config.Rule {
|
||||
func SlackAppLevelToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Slack App-level token, risking unauthorized access to Slack applications and workspace data.",
|
||||
RuleID: "slack-app-token",
|
||||
Description: "Detected a Slack App-level token, risking unauthorized access to Slack applications and workspace data.",
|
||||
// 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]+`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"xapp"},
|
||||
}
|
||||
|
||||
@@ -103,9 +105,10 @@ func SlackAppLevelToken() *config.Rule {
|
||||
func SlackConfigurationToken() *config.Rule {
|
||||
// define 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",
|
||||
Description: "Found a Slack Configuration access token, posing a risk to workspace configuration and sensitive data access.",
|
||||
Regex: regexp.MustCompile(`(?i)xoxe.xox[bp]-\d-[A-Z0-9]{163,166}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"xoxe.xoxb-", "xoxe.xoxp-"},
|
||||
}
|
||||
|
||||
@@ -128,9 +131,10 @@ func SlackConfigurationToken() *config.Rule {
|
||||
func SlackConfigurationRefreshToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a Slack Configuration refresh token, potentially allowing prolonged unauthorized access to configuration settings.",
|
||||
RuleID: "slack-config-refresh-token",
|
||||
Description: "Discovered a Slack Configuration refresh token, potentially allowing prolonged unauthorized access to configuration settings.",
|
||||
Regex: regexp.MustCompile(`(?i)xoxe-\d-[A-Z0-9]{146}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"xoxe-"},
|
||||
}
|
||||
|
||||
@@ -146,11 +150,11 @@ func SlackConfigurationRefreshToken() *config.Rule {
|
||||
// Reference: https://api.slack.com/authentication/token-types#legacy_bot
|
||||
func SlackLegacyBotToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a Slack Legacy bot token, which could lead to compromised legacy bot operations and data exposure.",
|
||||
RuleID: "slack-legacy-bot-token",
|
||||
Description: "Uncovered a Slack Legacy bot token, which could lead to compromised legacy bot operations and data exposure.",
|
||||
// This rule is based off the limited information I could find and may not be 100% accurate.
|
||||
Regex: regexp.MustCompile(
|
||||
`(xoxb-[0-9]{8,14}\-[a-zA-Z0-9]{18,26})`),
|
||||
Regex: regexp.MustCompile(`xoxb-[0-9]{8,14}-[a-zA-Z0-9]{18,26}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"xoxb",
|
||||
},
|
||||
@@ -189,11 +193,11 @@ func SlackLegacyBotToken() *config.Rule {
|
||||
// Reference: https://api.slack.com/authentication/token-types#workspace
|
||||
func SlackLegacyWorkspaceToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a Slack Legacy Workspace token, potentially compromising access to workspace data and legacy features.",
|
||||
RuleID: "slack-legacy-workspace-token",
|
||||
Description: "Identified a Slack Legacy Workspace token, potentially compromising access to workspace data and legacy features.",
|
||||
// This is by far the least confident pattern.
|
||||
Regex: regexp.MustCompile(
|
||||
`(xox[ar]-(?:\d-)?[0-9a-zA-Z]{8,48})`),
|
||||
Regex: regexp.MustCompile(`xox[ar]-(?:\d-)?[0-9a-zA-Z]{8,48}`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"xoxa",
|
||||
"xoxr",
|
||||
@@ -224,9 +228,10 @@ func SlackLegacyWorkspaceToken() *config.Rule {
|
||||
func SlackLegacyToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Detected a Slack Legacy token, risking unauthorized access to older Slack integrations and user data.",
|
||||
RuleID: "slack-legacy-token",
|
||||
Description: "Detected a Slack Legacy token, risking unauthorized access to older Slack integrations and user data.",
|
||||
Regex: regexp.MustCompile(`xox[os]-\d+-\d+-\d+-[a-fA-F\d]+`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"xoxo", "xoxs"},
|
||||
}
|
||||
|
||||
@@ -255,11 +260,11 @@ func SlackLegacyToken() *config.Rule {
|
||||
func SlackWebHookUrl() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Discovered a Slack Webhook, which could lead to unauthorized message posting and data leakage in Slack channels.",
|
||||
RuleID: "slack-webhook-url",
|
||||
Description: "Discovered a Slack Webhook, which could lead to unauthorized message posting and data leakage in Slack channels.",
|
||||
// If this generates too many false-positives we should define an allowlist (e.g., "xxxx", "00000").
|
||||
Regex: regexp.MustCompile(
|
||||
`(https?:\/\/)?hooks.slack.com\/(services|workflows)\/[A-Za-z0-9+\/]{43,46}`),
|
||||
`(?:https?://)?hooks.slack.com/(?:services|workflows)/[A-Za-z0-9+/]{43,46}`),
|
||||
Keywords: []string{
|
||||
"hooks.slack.com",
|
||||
},
|
||||
|
||||
@@ -12,6 +12,7 @@ func SquareAccessToken() *config.Rule {
|
||||
RuleID: "square-access-token",
|
||||
Description: "Detected a Square Access Token, risking unauthorized payment processing and financial transaction exposure.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`(?:EAAA|sq0atp-)[\w-]{22,60}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"sq0atp-", "EAAA"},
|
||||
}
|
||||
|
||||
@@ -33,6 +34,7 @@ func SquareSecret() *config.Rule {
|
||||
RuleID: "square-secret",
|
||||
Description: "Square Secret",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`sq0csp-[\w-]{43}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"sq0csp-"},
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,10 @@ import (
|
||||
func StripeAccessToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Found a Stripe Access Token, posing a risk to payment processing services and sensitive financial data.",
|
||||
RuleID: "stripe-access-token",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`(sk|rk)_(test|live|prod)_[0-9a-z]{10,99}`, true),
|
||||
Description: "Found a Stripe Access Token, posing a risk to payment processing services and sensitive financial data.",
|
||||
Regex: utils.GenerateUniqueTokenRegex(`(?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99}`, false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"sk_test",
|
||||
"sk_live",
|
||||
|
||||
@@ -2,8 +2,6 @@ package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
@@ -14,19 +12,11 @@ func SumoLogicAccessID() *config.Rule {
|
||||
RuleID: "sumologic-access-id",
|
||||
Description: "Discovered a SumoLogic Access ID, potentially compromising log management services and data analytics integrity.",
|
||||
// TODO: Make 'su' case-sensitive.
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"sumo"},
|
||||
"su[a-zA-Z0-9]{12}", false),
|
||||
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"(?-i:[Ss]umo|SUMO)"}, "su[a-zA-Z0-9]{12}", false),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"sumo",
|
||||
},
|
||||
Allowlists: []config.Allowlist{
|
||||
{
|
||||
RegexTarget: "line",
|
||||
Regexes: []*regexp.Regexp{regexp.MustCompile(`sumOf`)},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -47,6 +37,7 @@ func SumoLogicAccessID() *config.Rule {
|
||||
`sumologic_access_id = ""`,
|
||||
`SUMOLOGIC_ACCESSID: ${SUMOLOGIC_ACCESSID}`,
|
||||
`export SUMOLOGIC_ACCESSID=XXXXXXXXXXXXXX`, // gitleaks:allow
|
||||
`sumObj = suGyI5imvADdvU`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -56,10 +47,8 @@ func SumoLogicAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "sumologic-access-token",
|
||||
Description: "Uncovered a SumoLogic Access Token, which could lead to unauthorized access to log data and analytics insights.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"sumo"},
|
||||
utils.AlphaNumeric("64"), true),
|
||||
|
||||
Entropy: 3,
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"(?-i:[Ss]umo|SUMO)"}, utils.AlphaNumeric("64"), true),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"sumo",
|
||||
},
|
||||
@@ -80,6 +69,7 @@ func SumoLogicAccessToken() *config.Rule {
|
||||
`SUMO_ACCESS_KEY=${SUMO_ACCESS_KEY:=$2}`,
|
||||
`sumo_access_key = "<SUMOLOGIC ACCESS KEY>"`,
|
||||
`SUMO_ACCESS_KEY: AbCeFG123`,
|
||||
`sumOfExposures = 3Kof2VffNQ0QgYIhXUPJosVlCaQKm2hfpWE6F1fT9YGY74blQBIPsrkCcf1TwKE5;`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -11,10 +11,10 @@ import (
|
||||
func TeamsWebhook() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a Microsoft Teams Webhook, which could lead to unauthorized access to team collaboration tools and data leaks.",
|
||||
RuleID: "microsoft-teams-webhook",
|
||||
Description: "Uncovered a Microsoft Teams Webhook, which could lead to unauthorized access to team collaboration tools and data leaks.",
|
||||
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}`),
|
||||
`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",
|
||||
|
||||
@@ -11,10 +11,11 @@ import (
|
||||
func Twilio() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Found a Twilio API Key, posing a risk to communication services and sensitive customer interaction data.",
|
||||
RuleID: "twilio-api-key",
|
||||
Description: "Found a Twilio API Key, posing a risk to communication services and sensitive customer interaction data.",
|
||||
Regex: regexp.MustCompile(`SK[0-9a-fA-F]{32}`),
|
||||
Keywords: []string{"twilio"},
|
||||
Entropy: 3,
|
||||
Keywords: []string{"SK"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
Reference in new issue
Block a user