mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 04:04:25 +01:00
Compare commits
34
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dab7d0292a | ||
|
|
e63b657bcf | ||
|
|
20fcf5009f | ||
|
|
b49667786e | ||
|
|
a3ab4e8ac5 | ||
|
|
bd9a25a379 | ||
|
|
6d0d8b5068 | ||
|
|
2959fc072c | ||
|
|
d37b38f2ee | ||
|
|
14b1ca9fd9 | ||
|
|
d9f86d6123 | ||
|
|
ed34259e9c | ||
|
|
0d5e46fecb | ||
|
|
a82ac29976 | ||
|
|
0b84afa0fa | ||
|
|
8976539177 | ||
|
|
30c6117aaa | ||
|
|
e9135cf0b5 | ||
|
|
f65f9157ff | ||
|
|
abfd0f3fdc | ||
|
|
18283bb48e | ||
|
|
9fb36b242d | ||
|
|
db4bc0fe76 | ||
|
|
3cbcda20d2 | ||
|
|
46c627212c | ||
|
|
963a6976d1 | ||
|
|
163ec21120 | ||
|
|
45266551ba | ||
|
|
b1a2ce7296 | ||
|
|
34e67229e6 | ||
|
|
61513d6772 | ||
|
|
f0dcd4d9cf | ||
|
|
06db3b91d7 | ||
|
|
7804d652c0 |
No files matched your search
+1
-1
@@ -20,4 +20,4 @@ testdata/expected/report/*.got.*
|
||||
# Test binary
|
||||
*.out
|
||||
|
||||
dist/
|
||||
dist/
|
||||
+6
-6
@@ -35,11 +35,11 @@ If you want to add a new rule to the [default Gitleaks configuration](https://gi
|
||||
RuleID: "beamer-api-token",
|
||||
|
||||
// Regex capture group for the actual secret
|
||||
SecretGroup: 1,
|
||||
|
||||
|
||||
|
||||
// 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: []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:
|
||||
|
||||
```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
|
||||
definition above. Both `identifiers` in the `generateSemiGenericRegex`
|
||||
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_"
|
||||
|
||||
`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
|
||||
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
|
||||
|
||||
@@ -13,11 +13,9 @@ format:
|
||||
go fmt ./...
|
||||
|
||||
test: format
|
||||
go vet ./...
|
||||
go test -v ./... --race $(PKG)
|
||||
|
||||
build: format
|
||||
go vet ./...
|
||||
go mod tidy
|
||||
go build $(LDFLAGS)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
</p>
|
||||
</p>
|
||||
|
||||
### Join our Discord! [](https://discord.gg/sydS6AHTUP)
|
||||
### Join our Discord! [](https://discord.gg/8Hzbrnkr7E)
|
||||
|
||||
Gitleaks is a SAST tool for **detecting** and **preventing** hardcoded secrets like passwords, api keys, and tokens in git repos. Gitleaks is an **easy-to-use, all-in-one solution** for detecting secrets, past or present, in your code.
|
||||
|
||||
@@ -182,6 +182,8 @@ See the `git log` [documentation](https://git-scm.com/docs/git-log) for more inf
|
||||
|
||||
You can scan files and directories by using the `--no-git` option.
|
||||
|
||||
If you want to run only specific rules you can do so by using the `--enable-rule` option (with a rule ID as a parameter), this flag can be used multiple times. For example: `--enable-rule=atlassian-api-token` will only apply that rule. You can find a list of rules [here](config/gitleaks.toml).
|
||||
|
||||
#### Protect
|
||||
|
||||
The `protect` command is used to scan uncommitted changes in a git repo. This command should be used on developer machines in accordance with
|
||||
|
||||
+32
-3
@@ -3,8 +3,10 @@ package cmd
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
@@ -20,6 +22,7 @@ func init() {
|
||||
detectCmd.Flags().Bool("no-git", false, "treat git repo as a regular directory and scan those files, --log-opts has no effect on the scan when --no-git is set")
|
||||
detectCmd.Flags().Bool("pipe", false, "scan input from stdin, ex: `cat some_file | gitleaks detect --pipe`")
|
||||
detectCmd.Flags().Bool("follow-symlinks", false, "scan files that are symlinks to other files")
|
||||
detectCmd.Flags().StringSlice("enable-rule", []string{}, "only enable specific rules by id, ex: `gitleaks detect --enable-rule=atlassian-api-token --enable-rule=slack-access-token`")
|
||||
detectCmd.Flags().StringP("gitleaks-ignore-path", "i", ".", "path to .gitleaksignore file or folder containing one")
|
||||
}
|
||||
|
||||
@@ -52,6 +55,17 @@ func runDetect(cmd *cobra.Command, args []string) {
|
||||
|
||||
// Setup detector
|
||||
detector := detect.NewDetector(cfg)
|
||||
// set color flag at first
|
||||
if detector.NoColor, err = cmd.Flags().GetBool("no-color"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
// also init logger again without color
|
||||
if detector.NoColor {
|
||||
log.Logger = log.Output(zerolog.ConsoleWriter{
|
||||
Out: os.Stderr,
|
||||
NoColor: detector.NoColor,
|
||||
})
|
||||
}
|
||||
detector.Config.Path, err = cmd.Flags().GetString("config")
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
@@ -70,14 +84,14 @@ func runDetect(cmd *cobra.Command, args []string) {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
// set redact flag
|
||||
if detector.Redact, err = cmd.Flags().GetBool("redact"); err != nil {
|
||||
if detector.Redact, err = cmd.Flags().GetUint("redact"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
if detector.MaxTargetMegaBytes, err = cmd.Flags().GetInt("max-target-megabytes"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
// set color flag
|
||||
if detector.NoColor, err = cmd.Flags().GetBool("no-color"); err != nil {
|
||||
// set ignore gitleaks:allow flag
|
||||
if detector.IgnoreGitleaksAllow, err = cmd.Flags().GetBool("ignore-gitleaks-allow"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
|
||||
@@ -113,6 +127,21 @@ func runDetect(cmd *cobra.Command, args []string) {
|
||||
}
|
||||
}
|
||||
|
||||
// If set, only apply rules that are defined in the flag
|
||||
rules, _ := cmd.Flags().GetStringSlice("enable-rule")
|
||||
if len(rules) > 0 {
|
||||
log.Info().Msg("Overriding enabled rules: " + strings.Join(rules, ", "))
|
||||
ruleOverride := make(map[string]config.Rule)
|
||||
for _, ruleName := range rules {
|
||||
if rule, ok := cfg.Rules[ruleName]; ok {
|
||||
ruleOverride[ruleName] = rule
|
||||
} else {
|
||||
log.Fatal().Msgf("Requested rule %s not found in rules", ruleName)
|
||||
}
|
||||
}
|
||||
detector.Config.Rules = ruleOverride
|
||||
}
|
||||
|
||||
// set follow symlinks flag
|
||||
if detector.FollowSymlinks, err = cmd.Flags().GetBool("follow-symlinks"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
|
||||
@@ -24,38 +24,11 @@ func main() {
|
||||
configRules = append(configRules, rules.AlgoliaApiKey())
|
||||
configRules = append(configRules, rules.AlibabaAccessKey())
|
||||
configRules = append(configRules, rules.AlibabaSecretKey())
|
||||
configRules = append(configRules, rules.AnsibleVaultToken())
|
||||
configRules = append(configRules, rules.AsanaClientID())
|
||||
configRules = append(configRules, rules.AsanaClientSecret())
|
||||
configRules = append(configRules, rules.Atlassian())
|
||||
configRules = append(configRules, rules.Authress())
|
||||
configRules = append(configRules, rules.AWS())
|
||||
configRules = append(configRules, rules.AzureAppServiceDeploymentSecrets())
|
||||
configRules = append(configRules, rules.AzureDevTFVCSecrets())
|
||||
configRules = append(configRules, rules.AzureDevopsPAT())
|
||||
configRules = append(configRules, rules.AzureNetworkCredential())
|
||||
configRules = append(configRules, rules.AzureNetworkCredentialSchtasks())
|
||||
configRules = append(configRules, rules.AzureNetworkCredentialDotNet())
|
||||
configRules = append(configRules, rules.AzurePasswordDecryptionkey())
|
||||
configRules = append(configRules, rules.AzurePasswordAddKey())
|
||||
configRules = append(configRules, rules.AzurePasswordConnString())
|
||||
configRules = append(configRules, rules.AzurePasswordValueString())
|
||||
configRules = append(configRules, rules.AzurePassworduidpw())
|
||||
configRules = append(configRules, rules.AzureStorageCredential43char())
|
||||
configRules = append(configRules, rules.AzureStorageCredential86char())
|
||||
configRules = append(configRules, rules.AzureStorageCredentialAccountKey())
|
||||
configRules = append(configRules, rules.AzureStorageCredentialBlobURL())
|
||||
configRules = append(configRules, rules.AzureStorageCredentialMonikerKey())
|
||||
configRules = append(configRules, rules.AzureStorageCredentialServiceBus())
|
||||
configRules = append(configRules, rules.AzureStorageCredentialSig53())
|
||||
configRules = append(configRules, rules.AzureStorageCredentialUserIDPW())
|
||||
configRules = append(configRules, rules.AzureStorageCredentialXStore())
|
||||
|
||||
// Below work on Regex.com but something about the internal conversion to generateUniqueTokenRegex is breaking them
|
||||
//configRules = append(configRules, rules.AzurePowershellTokenCache())
|
||||
//configRules = append(configRules, rules.AzurePasswordXMLCredential())
|
||||
//configRules = append(configRules, rules.AzurePasswordXMLValue())
|
||||
//configRules = append(configRules, rules.AzurePasswordSSISProperty())
|
||||
configRules = append(configRules, rules.BitBucketClientID())
|
||||
configRules = append(configRules, rules.BitBucketClientSecret())
|
||||
configRules = append(configRules, rules.BittrexAccessKey())
|
||||
@@ -114,10 +87,16 @@ func main() {
|
||||
configRules = append(configRules, rules.GrafanaCloudApiToken())
|
||||
configRules = append(configRules, rules.GrafanaServiceAccountToken())
|
||||
configRules = append(configRules, rules.Hashicorp())
|
||||
configRules = append(configRules, rules.HashicorpField())
|
||||
configRules = append(configRules, rules.Heroku())
|
||||
configRules = append(configRules, rules.HubSpot())
|
||||
configRules = append(configRules, rules.HuggingFaceAccessToken())
|
||||
configRules = append(configRules, rules.HuggingFaceOrganizationApiToken())
|
||||
configRules = append(configRules, rules.Intercom())
|
||||
configRules = append(configRules, rules.JFrogAPIKey())
|
||||
configRules = append(configRules, rules.JFrogIdentityToken())
|
||||
configRules = append(configRules, rules.JWT())
|
||||
configRules = append(configRules, rules.JWTBase64())
|
||||
configRules = append(configRules, rules.KrakenAccessToken())
|
||||
configRules = append(configRules, rules.KucoinAccessToken())
|
||||
configRules = append(configRules, rules.KucoinSecretKey())
|
||||
@@ -158,6 +137,7 @@ func main() {
|
||||
configRules = append(configRules, rules.RapidAPIAccessToken())
|
||||
configRules = append(configRules, rules.ReadMe())
|
||||
configRules = append(configRules, rules.RubyGemsAPIToken())
|
||||
configRules = append(configRules, rules.ScalingoAPIToken())
|
||||
configRules = append(configRules, rules.SendbirdAccessID())
|
||||
configRules = append(configRules, rules.SendbirdAccessToken())
|
||||
configRules = append(configRules, rules.SendGridAPIToken())
|
||||
@@ -203,6 +183,7 @@ func main() {
|
||||
configRules = append(configRules, rules.YandexAccessToken())
|
||||
configRules = append(configRules, rules.ZendeskSecretKey())
|
||||
configRules = append(configRules, rules.GenericCredential())
|
||||
configRules = append(configRules, rules.InfracostAPIToken())
|
||||
|
||||
// ensure rules have unique ids
|
||||
ruleLookUp := make(map[string]config.Rule)
|
||||
|
||||
@@ -10,8 +10,7 @@ func AdafruitAPIKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Adafruit API Key",
|
||||
RuleID: "adafruit-api-key",
|
||||
Regex: generateSemiGenericRegex([]string{"adafruit"}, alphaNumericExtendedShort("32")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"adafruit"}, alphaNumericExtendedShort("32"), true),
|
||||
Keywords: []string{"adafruit"},
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,7 @@ func AdobeClientID() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Adobe Client ID (OAuth Web)",
|
||||
RuleID: "adobe-client-id",
|
||||
Regex: generateSemiGenericRegex([]string{"adobe"}, hex("32")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"adobe"}, hex("32"), true),
|
||||
Keywords: []string{"adobe"},
|
||||
}
|
||||
|
||||
@@ -27,7 +26,7 @@ func AdobeClientSecret() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "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-"},
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,7 @@ func Airtable() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Airtable API Key",
|
||||
RuleID: "airtable-api-key",
|
||||
Regex: generateSemiGenericRegex([]string{"airtable"}, alphaNumeric("17")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"airtable"}, alphaNumeric("17"), true),
|
||||
Keywords: []string{"airtable"},
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ func AlgoliaApiKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "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"},
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ func AlibabaAccessKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Alibaba AccessKey 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"},
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ func AlibabaSecretKey() *config.Rule {
|
||||
Description: "Alibaba Secret Key",
|
||||
RuleID: "alibaba-secret-key",
|
||||
Regex: generateSemiGenericRegex([]string{"alibaba"},
|
||||
alphaNumeric("30")),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"alibaba"},
|
||||
alphaNumeric("30"), true),
|
||||
|
||||
Keywords: []string{"alibaba"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
func AnsibleVaultToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0270 - Found Azure Subscription Token Cache.",
|
||||
RuleID: "ansible-vault-token",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`ANSIBLE_VAULT;[0-9]\.[0-9];AES256;[\r\n]+[0-9]+`),
|
||||
Keywords: []string{"ANSIBLE_VAULT;", "AES256;"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("ansible-vault-token",
|
||||
"ANSIBLE_VAULT;1.0;AES256;\n" + secrets.NewSecret(numeric("32"))),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
@@ -10,8 +10,7 @@ func AsanaClientID() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Asana Client ID",
|
||||
RuleID: "asana-client-id",
|
||||
Regex: generateSemiGenericRegex([]string{"asana"}, numeric("16")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"asana"}, numeric("16"), true),
|
||||
Keywords: []string{"asana"},
|
||||
}
|
||||
|
||||
@@ -27,9 +26,9 @@ func AsanaClientSecret() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Asana Client Secret",
|
||||
RuleID: "asana-client-secret",
|
||||
Regex: generateSemiGenericRegex([]string{"asana"}, alphaNumeric("32")),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"asana"},
|
||||
Regex: generateSemiGenericRegex([]string{"asana"}, alphaNumeric("32"), true),
|
||||
|
||||
Keywords: []string{"asana"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -11,9 +11,8 @@ func Atlassian() *config.Rule {
|
||||
Description: "Atlassian API token",
|
||||
RuleID: "atlassian-api-token",
|
||||
Regex: generateSemiGenericRegex([]string{
|
||||
"atlassian", "confluence", "jira"}, alphaNumeric("24")),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"atlassian", "confluence", "jira"},
|
||||
"atlassian", "confluence", "jira"}, alphaNumeric("24"), true),
|
||||
Keywords: []string{"atlassian", "confluence", "jira"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -8,12 +8,12 @@ import (
|
||||
)
|
||||
|
||||
func Authress() *config.Rule {
|
||||
// define rule
|
||||
// Rule Definition
|
||||
// (Note: When changes are made to this, rerun `cd cmd/generate/config && go run main.go` and commit the config/gitleaks.toml file
|
||||
r := config.Rule{
|
||||
Description: "Authress Service Client Access Key",
|
||||
RuleID: "authress-service-client-access-key",
|
||||
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_"},
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ func AWS() *config.Rule {
|
||||
Description: "AWS",
|
||||
RuleID: "aws-access-token",
|
||||
Regex: regexp.MustCompile(
|
||||
"(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
||||
"(?:A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
||||
Keywords: []string{
|
||||
"AKIA",
|
||||
"AGPA",
|
||||
|
||||
@@ -1,444 +0,0 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
// Rules come from https://www.powershellgallery.com/packages/AzSK.AzureDevOps/0.9.8/Content/Framework%5CConfigurations%5CSVT%5CAzureDevOps%5CCredentialPatterns.xml
|
||||
// Only rules with 'ContentSearchPatterns' have been used.
|
||||
|
||||
// CSCAN0110, CSCAN0111, CSCAN0140, CSCAN0220 searches for generic passwords - covered elsewhere
|
||||
|
||||
// CSCAN0120 searches for Twilio keys - covered in twilio.go
|
||||
|
||||
// CSCAN0210 checks for Git repo credentials - covered elsewhere
|
||||
|
||||
// CSCAN0230 checks for Slack tokens - covered in slack.go
|
||||
|
||||
// CSCAN0250 - covered in jwt.go
|
||||
|
||||
|
||||
func AzureAppServiceDeploymentSecrets() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0020, CSCAN0030 - Found Azure app service deployment secrets in publish settings file.",
|
||||
RuleID: "azure-app-service-deployment-secrets",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`MII[a-z0-9=_\-]{200}`),
|
||||
Keywords: []string{"MII"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-app-service-deployment-secrets",
|
||||
"MII" + secrets.NewSecret(alphaNumeric("200"))),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func AzureStorageCredential86char() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0030, CSCAN0090, CSCAN0150 - Found Azure storage credential in source code file.",
|
||||
RuleID: "azure-storage-credential-86char",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`[ \t]{0,10}[a-zA-Z0-9/+]{86}==`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-storage-credential-86char",
|
||||
secrets.NewSecret(alphaNumeric("86") + "==")),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func AzureStorageCredential43char() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0030, CSCAN0090, CSCAN0150 - Found Azure storage credential in source code file.",
|
||||
RuleID: "azure-storage-credential-43char",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`[a-zA-Z0-9/+]{43}=[^{@\d%]`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-storage-credential-43char",
|
||||
secrets.NewSecret(alphaNumeric("43") + "=a")),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func AzureStorageCredentialSig53() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0030, CSCAN0090, CSCAN0150 - Found Azure storage credential in source code file.",
|
||||
RuleID: "azure-storage-credential-sig53",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`((sig|sas|password)=|>)[a-zA-Z0-9%]{43,53}%3d[^{a-zA-Z0-9%]`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-storage-credential-sig53",
|
||||
"sig=" + secrets.NewSecret(alphaNumeric("53") + "%3D")),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
|
||||
func AzureStorageCredentialUserIDPW() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0030 - Found Azure storage credential in source code file.",
|
||||
RuleID: "azure-storage-credential-useridpw",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`((user) ?(id|name)|uid)=.{2,128}?\s*?;\s*?((password)|(pwd))=[^'$%>@'";\[\{][^;"']{2,350}?(;|"|')`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-storage-credential-useridpw",
|
||||
"userid=" + secrets.NewSecret(alphaNumeric("128")) + ";password=" + secrets.NewSecret(alphaNumeric("200")) + ";"),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func AzureStorageCredentialAccountKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0030 - Found Azure storage credential in source code file.",
|
||||
RuleID: "azure-storage-credential-accountkey",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`AccountKey\s*=\s*MII[a-zA-Z0-9/+]{43,}?={0,2}`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-storage-credential-accountkey",
|
||||
"AccountKey = MII" + secrets.NewSecret(alphaNumeric("43") + "=")),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func AzureStorageCredentialXStore() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0100 - Found Azure storage credential in source code file.",
|
||||
RuleID: "azure-storage-credential-xstore",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`[<XstoreAccountInfo].*accountSharedKey\s*=\s*['"].*['"]`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-storage-credential-xstore",
|
||||
"<XstoreAccountInfo accountName = 'John Doe' accountSharedKey='" + secrets.NewSecret(alphaNumeric("43")) + "' />"),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func AzureStorageCredentialServiceBus() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0100 - Found Azure storage credential in source code file.",
|
||||
RuleID: "azure-storage-credential-servicebus",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`[<ServiceBusAccountInfo].*SharedAccessKey\s*=\s*[a-zA-Z0-9/+]{10,}['"]`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-storage-credential-servicebus",
|
||||
"<ServiceBusAccountInfo accountName='name' connectionString='Endpoint=sb://foo.net/;SharedAccessKeyName=bar;SharedAccessKey=" + secrets.NewSecret(alphaNumeric("43")) + "' />"),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func AzureStorageCredentialMonikerKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0130 - Found Azure storage credential in MonitoringAgent config file.",
|
||||
RuleID: "azure-storage-credential-monikerkey",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`Account moniker\s?=.*key\s?=.*`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-storage-credential-monikerkey",
|
||||
"Account Moniker = 'John Doe' Key = '" + secrets.NewSecret(alphaNumeric("200") + "'")),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
|
||||
func AzureStorageCredentialBlobURL() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0110 - Found Azure storage credential in source code file.",
|
||||
RuleID: "azure-storage-credential-bloburl",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`(?i)https://[a-zA-Z0-9-]+.(blob|file|queue|table|dfs|z8.web).core.windows.net/.*?sig=[a-zA-Z0-9%]{30,}`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-storage-credential-bloburl",
|
||||
"https://myacct.blob.core.windows.net/a?sp=r&sr=b&sig=" + secrets.NewSecret(alphaNumeric("43"))),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
// CSCAN0050, CSCAN0060, CSCAN0070 - covered in PrivateKey.go
|
||||
|
||||
// CSCAN0080 looks for 'Password' in XML file
|
||||
|
||||
func AzurePasswordDecryptionkey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0090 - Found Azure password, symmetric key or storage credential in source file.",
|
||||
RuleID: "azure-password-machinekey",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`(decryptionKey\s*\=\s*['"].*['"]|validationKey\s*\=\s*['"].*['"])`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-password-machinekey",
|
||||
"<machineKey decryptionKey='" + secrets.NewSecret(alphaNumeric("43")) + "' validationKey='" + secrets.NewSecret(alphaNumeric("43")) + "' useMachineContainer='true'>"),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
|
||||
func AzurePasswordAddKey() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0090 - Found Azure password, symmetric key or storage credential in source file.",
|
||||
RuleID: "azure-password-addkey",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`[<add].*([key](s|[0-9])?|(credential)s?|(secret)(s|S|[0-9])?|[password|token|key](primary|secondary|orsas|sas|encrypted))['"]\s*value\s*=['"].*['"]`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-password-addkey",
|
||||
"<add key='primary' value='" + secrets.NewSecret(alphaNumeric("200") + "' >")),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func AzurePasswordConnString() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0090 - Found Azure password, symmetric key or storage credential in source file.",
|
||||
RuleID: "azure-password-connstring",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`(connectionstring|connstring)[^=]*?=["'][^"']*?(password)=[^\$\s;][^"'\s]*?(;|['"])`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-password-connstring",
|
||||
//connstring='password=secret123;Server=localhost;'
|
||||
"connstring='Server=localhost;password=" + secrets.NewSecret(alphaNumeric("23") + "'")),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func AzurePasswordValueString() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0090 - Found Azure password, symmetric key or storage credential in source file.",
|
||||
RuleID: "azure-password-value-string",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`value\s?=\s?['"]((([A-Za-z0-9+/]){4}){1,200})==['"]`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-password-value-string",
|
||||
"Value='" + secrets.NewSecret(alphaNumeric("20") + "=='")),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func AzurePassworduidpw() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0090, CSCAN0150 - Found Azure password, symmetric key or storage credential in source file.",
|
||||
RuleID: "azure-password-uidpw",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`((user) ?(id|name)|uid)=.{2,128}?\s*?;\s*?((password|(pwd))=[^'$%@'";\[\{][^;"']{2,350}?(;|"|'))`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-password-uidpw",
|
||||
`uid=testuser;pwd=` + secrets.NewSecret(alphaNumeric("86") + ";")),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
// TODO: Come back to the two XML passwords below
|
||||
// func AzurePasswordXMLCredential() *config.Rule {
|
||||
// // define rule
|
||||
// r := config.Rule{
|
||||
// Description: "CSCAN0090, CSCAN0150 - Found Azure password, symmetric key or storage credential in source file.",
|
||||
// RuleID: "azure-password-xml-credential",
|
||||
// SecretGroup: 1,
|
||||
// Regex: generateUniqueTokenRegex(`<credential>\s?name=['"][^"]*(key(s|[0-9])?|credential(s)?|secret(s|[0-9])?|password|token|key(primary|secondary|orsas|encrypted))['"](\s*value\s*=['"][^"]+['"].*?</credential>)`),
|
||||
// }
|
||||
|
||||
// // validate
|
||||
// tps := []string{
|
||||
// generateSampleSecret("azure-password-xml-credential",
|
||||
// "<credential>name='primary_key' value='" + secrets.NewSecret(alphaNumeric("86") + "'</credential>")),
|
||||
// }
|
||||
// return validate(r, tps, nil)
|
||||
// }
|
||||
|
||||
// func AzurePasswordXMLValue() *config.Rule {
|
||||
// // define rule
|
||||
// r := config.Rule{
|
||||
// Description: "CSCAN0090, CSCAN0150 - Found Azure password, symmetric key or storage credential in source file.",
|
||||
// RuleID: "azure-password-xml-value",
|
||||
// SecretGroup: 1,
|
||||
// Regex: generateUniqueTokenRegex(`<setting\sname=.?password.?>.*<value>.+</value>`),
|
||||
// }
|
||||
|
||||
// // validate
|
||||
// tps := []string{
|
||||
// generateSampleSecret("azure-password-xml-value",
|
||||
// //<setting name='password'><value>testpassword123</value>
|
||||
// "<setting name='password'><value>" + secrets.NewSecret(alphaNumeric("86") + "</value>")),
|
||||
// }
|
||||
// return validate(r, tps, nil)
|
||||
// }
|
||||
|
||||
// func AzurePasswordSSISProperty() *config.Rule {
|
||||
// // define rule
|
||||
// r := config.Rule{
|
||||
// Description: "CSCAN0090 - Found Azure password, symmetric key or storage credential in source file.",
|
||||
// RuleID: "azure-password-ssis",
|
||||
// SecretGroup: 1,
|
||||
// Regex: generateUniqueTokenRegex(`(?s)<SSIS:Parameter\n?\s*SSIS:Name="password">.*?<SSIS:Property\n?\s*SSIS:Name="value">[^><#$\[\{\(]+</SSIS:Property>`),
|
||||
// }
|
||||
|
||||
// // validate
|
||||
// tps := []string{
|
||||
// generateSampleSecret("azure-password-ssis",
|
||||
// `
|
||||
// This is a random text string that contains some characters>
|
||||
// ` + secrets.NewSecret(alphaNumeric("86") + "==")),
|
||||
// }
|
||||
// return validate(r, tps, nil)
|
||||
// }
|
||||
|
||||
|
||||
func AzureNetworkCredential() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0160 - Found Azure domain credential in source file.",
|
||||
RuleID: "azure-network-credential",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`NetworkCredential\((\s*).*,(\s*).*,(\s*)(corp|europe|middleeast|northamerica|southpacific|southamerica|fareast|africa|redmond|exchange|extranet|partners|extranettest|parttest|noe|ntdev|ntwksta|sys-wingroup|windeploy|wingroup|winse|segroup|xcorp|xrep|phx|gme|usme|cdocidm|mslpa)\)`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-network-credential",
|
||||
"NetworkCredential(username, password, europe)"),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func AzureNetworkCredentialSchtasks() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0160 - Found Azure domain credential in source file.",
|
||||
RuleID: "azure-network-credential-schtasks",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`schtasks.*/ru\s(corp|europe|middleeast|northamerica|southpacific|southamerica|fareast|africa|redmond|exchange|extranet|partners|extranettest|parttest|noe|ntdev|ntwksta|sys\-wingroup|windeploy|wingroup|winse|segroup|xcorp|xrep|phx|gme|usme|cdocidm|mslpa).*/rp.*`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-network-credential-schtasks",
|
||||
`Schtasks /create /tn corp-daily-backup /tr \corp\backup.bat /ru corp\admin /rp password /sc daily`),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func AzureNetworkCredentialDotNet() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0160 - Found Azure domain credential in source file.",
|
||||
RuleID: "azure-network-credential-dotnet",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`new-object\s*System.Net.NetworkCredential\(.*?,\s*['"][^"]+['"]`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-network-credential-dotnet",
|
||||
"New-Object System.Net.NetworkCredential(username, '" + secrets.NewSecret(alphaNumeric("86")) + "')"),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func AzureDevTFVCSecrets() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0200 - Found Azure DevDiv TFVC repo secrets.",
|
||||
RuleID: "azure-devtfvc-secrets",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`enc_username=.+[\n\r\s]+enc_password=.{3,}`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-devtfvc-secrets",
|
||||
"enc_username=myusername enc_password=" + secrets.NewSecret(alphaNumeric("86"))),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func AzureDevopsPAT() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "CSCAN0240 - Found Azure Devops personal access token in source file.",
|
||||
RuleID: "azure-devops-pat",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`(access_token).*?['="][a-zA-Z0-9/+]{10,99}['"]`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("azure-devops-pat",
|
||||
"Access_token=='" + secrets.NewSecret(hex("52")) + "'"),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
|
||||
// func AzurePowershellTokenCache() *config.Rule {
|
||||
// // define rule
|
||||
// r := config.Rule{
|
||||
// Description: "CSCAN0270 - Found Azure Subscription Token Cache.",
|
||||
// RuleID: "azure-powershell-tokencache",
|
||||
// SecretGroup: 1,
|
||||
// // Below finds the example on Regex101.com! So not sure what's happening here.
|
||||
// Regex: generateUniqueTokenRegex(`["']TokenCache["']\s*:\s*\{\s*["']CacheData["']\s*:\s*["'][a-zA-Z0-9/\+]{86}`),
|
||||
// }
|
||||
|
||||
// // validate
|
||||
// tps := []string{
|
||||
// generateSampleSecret("azure-powershell-tokencache",
|
||||
// "'TokenCache': { 'CacheData': '" + secrets.NewSecret(alphaNumeric("86")) + "'"),
|
||||
// }
|
||||
// return validate(r, tps, nil)
|
||||
// }
|
||||
@@ -10,9 +10,8 @@ func Beamer() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Beamer API token",
|
||||
RuleID: "beamer-api-token",
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"beamer"},
|
||||
`b_[a-z0-9=_\-]{44}`),
|
||||
`b_[a-z0-9=_\-]{44}`, true),
|
||||
Keywords: []string{"beamer"},
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,7 @@ func BitBucketClientID() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Bitbucket Client ID",
|
||||
RuleID: "bitbucket-client-id",
|
||||
Regex: generateSemiGenericRegex([]string{"bitbucket"}, alphaNumeric("32")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"bitbucket"}, alphaNumeric("32"), true),
|
||||
Keywords: []string{"bitbucket"},
|
||||
}
|
||||
|
||||
@@ -27,9 +26,9 @@ func BitBucketClientSecret() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Bitbucket Client Secret",
|
||||
RuleID: "bitbucket-client-secret",
|
||||
Regex: generateSemiGenericRegex([]string{"bitbucket"}, alphaNumericExtended("64")),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"bitbucket"},
|
||||
Regex: generateSemiGenericRegex([]string{"bitbucket"}, alphaNumericExtended("64"), true),
|
||||
|
||||
Keywords: []string{"bitbucket"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -10,8 +10,7 @@ func BittrexAccessKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Bittrex Access Key",
|
||||
RuleID: "bittrex-access-key",
|
||||
Regex: generateSemiGenericRegex([]string{"bittrex"}, alphaNumeric("32")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"bittrex"}, alphaNumeric("32"), true),
|
||||
Keywords: []string{"bittrex"},
|
||||
}
|
||||
|
||||
@@ -27,9 +26,9 @@ func BittrexSecretKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Bittrex Secret Key",
|
||||
RuleID: "bittrex-secret-key",
|
||||
Regex: generateSemiGenericRegex([]string{"bittrex"}, alphaNumeric("32")),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"bittrex"},
|
||||
Regex: generateSemiGenericRegex([]string{"bittrex"}, alphaNumeric("32"), true),
|
||||
|
||||
Keywords: []string{"bittrex"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -10,8 +10,7 @@ func CodecovAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "codecov-access-token",
|
||||
Description: "Codecov Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"codecov"}, alphaNumeric("32")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"codecov"}, alphaNumeric("32"), true),
|
||||
Keywords: []string{
|
||||
"codecov",
|
||||
},
|
||||
|
||||
@@ -11,8 +11,7 @@ func CoinbaseAccessToken() *config.Rule {
|
||||
RuleID: "coinbase-access-token",
|
||||
Description: "Coinbase Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"coinbase"},
|
||||
alphaNumericExtendedShort("64")),
|
||||
SecretGroup: 1,
|
||||
alphaNumericExtendedShort("64"), true),
|
||||
Keywords: []string{
|
||||
"coinbase",
|
||||
},
|
||||
|
||||
@@ -14,51 +14,51 @@ title = "gitleaks config"
|
||||
description = "global allow lists"
|
||||
paths = [
|
||||
'''gitleaks.toml''',
|
||||
'''(.*?)(jpg|gif|doc|docx|zip|xls|pdf|bin|svg|socket)$''',
|
||||
'''(.*?)(jpg|gif|doc|docx|zip|xls|pdf|bin|svg|socket|vsidx|v2|suo|wsuo|.dll|pdb|exe)$''',
|
||||
'''(go.mod|go.sum)$''',
|
||||
'''gradle.lockfile''',
|
||||
'''node_modules''',
|
||||
'''package-lock.json''',
|
||||
'''yarn.lock''',
|
||||
'''pnpm-lock.yaml''',
|
||||
'''Database.refactorlog''',
|
||||
'''vendor''',
|
||||
]
|
||||
|
||||
{{ range $i, $rule := .Rules }}[[rules]]
|
||||
{{ if and $rule.SecretGroup $rule.Entropy $rule.Allowlist.StopWords }}description = "{{$rule.Description}}"
|
||||
id = "{{$rule.RuleID}}"
|
||||
description = "{{$rule.Description}}"
|
||||
regex = '''{{$rule.Regex}}'''
|
||||
secretGroup = {{ $rule.SecretGroup }}
|
||||
entropy = {{ $rule.Entropy}}
|
||||
{{- with $rule.Path }}
|
||||
path = '''{{ . }}'''{{ end -}}
|
||||
{{- with $rule.SecretGroup }}
|
||||
secretGroup = {{ . }}{{ end -}}
|
||||
{{- with $rule.Entropy }}
|
||||
entropy = {{ . }}{{ end -}}
|
||||
{{- with $rule.Keywords }}
|
||||
keywords = [
|
||||
{{ range $j, $keyword := $rule.Keywords }}"{{$keyword}}",{{end}}
|
||||
]
|
||||
{{ range $j, $keyword := . }}"{{ $keyword }}",{{ end }}
|
||||
]{{ end }}
|
||||
{{- with $rule.Tags }}
|
||||
tags = [
|
||||
{{ range $j, $tag := . }}"{{ $tag }}",{{ end }}
|
||||
]{{ end }}
|
||||
{{ if or $rule.Allowlist.Regexes $rule.Allowlist.Paths $rule.Allowlist.Commits $rule.Allowlist.StopWords }}
|
||||
[rules.allowlist]
|
||||
stopwords= [{{ range $j, $stopword := $rule.Allowlist.StopWords }}
|
||||
"{{$stopword}}",{{end}}
|
||||
]
|
||||
{{ else if and $rule.SecretGroup $rule.Entropy }}description = "{{$rule.Description}}"
|
||||
id = "{{$rule.RuleID}}"
|
||||
regex = '''{{$rule.Regex}}'''
|
||||
secretGroup = {{ $rule.SecretGroup }}
|
||||
entropy = {{ $rule.Entropy}}
|
||||
keywords = [
|
||||
{{ range $j, $keyword := $rule.Keywords }}"{{$keyword}}",{{end}}
|
||||
]
|
||||
|
||||
{{ else if $rule.SecretGroup }}description = "{{$rule.Description}}"
|
||||
id = "{{$rule.RuleID}}"
|
||||
regex = '''{{$rule.Regex}}'''
|
||||
secretGroup = {{ $rule.SecretGroup }}
|
||||
keywords = [
|
||||
{{ range $j, $keyword := $rule.Keywords }}"{{$keyword}}",{{end}}
|
||||
]
|
||||
|
||||
{{ else }}description = "{{$rule.Description}}"
|
||||
id = "{{$rule.RuleID}}"
|
||||
regex = '''{{$rule.Regex}}'''
|
||||
keywords = [
|
||||
{{ range $j, $keyword := $rule.Keywords }}"{{$keyword}}",{{end}}
|
||||
]
|
||||
|
||||
{{end}}{{end}}
|
||||
{{ with $rule.Allowlist.RegexTarget }}
|
||||
regexTarget = "{{ . }}"{{ end -}}
|
||||
{{- with $rule.Allowlist.Regexes }}
|
||||
regexes = [
|
||||
{{ range $j, $regex := . }}"{{ $regex }}",{{ end }}
|
||||
]{{ end }}
|
||||
{{- with $rule.Allowlist.Paths }}paths = [
|
||||
{{ range $j, $path := . }}"{{ $path }}",{{ end }}
|
||||
]{{ end }}
|
||||
{{- with $rule.Allowlist.Commits }}commits = [
|
||||
{{ range $j, $commit := . }}"{{ $commit }}",{{ end }}
|
||||
]{{ end }}
|
||||
{{- with $rule.Allowlist.StopWords }}stopwords = [{{ range $j, $stopword := . }}
|
||||
"{{ $stopword }}",{{ end }}
|
||||
]{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@@ -10,8 +10,7 @@ func ConfluentSecretKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "confluent-secret-key",
|
||||
Description: "Confluent Secret Key",
|
||||
Regex: generateSemiGenericRegex([]string{"confluent"}, alphaNumeric("64")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"confluent"}, alphaNumeric("64"), true),
|
||||
Keywords: []string{
|
||||
"confluent",
|
||||
},
|
||||
@@ -29,8 +28,8 @@ func ConfluentAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "confluent-access-token",
|
||||
Description: "Confluent Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"confluent"}, alphaNumeric("16")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"confluent"}, alphaNumeric("16"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"confluent",
|
||||
},
|
||||
|
||||
@@ -11,9 +11,8 @@ func Contentful() *config.Rule {
|
||||
Description: "Contentful delivery API token",
|
||||
RuleID: "contentful-delivery-api-token",
|
||||
Regex: generateSemiGenericRegex([]string{"contentful"},
|
||||
alphaNumericExtended("43")),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"contentful"},
|
||||
alphaNumericExtended("43"), true),
|
||||
Keywords: []string{"contentful"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -10,7 +10,7 @@ func Databricks() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "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"},
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,7 @@ func DatadogtokenAccessToken() *config.Rule {
|
||||
RuleID: "datadog-access-token",
|
||||
Description: "Datadog Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"datadog"},
|
||||
alphaNumeric("40")),
|
||||
SecretGroup: 1,
|
||||
alphaNumeric("40"), true),
|
||||
Keywords: []string{
|
||||
"datadog",
|
||||
},
|
||||
|
||||
@@ -14,11 +14,8 @@ func DefinedNetworkingAPIToken() *config.Rule {
|
||||
// Unique ID for the rule
|
||||
RuleID: "defined-networking-api-token",
|
||||
|
||||
// Regex capture group for the actual secret
|
||||
SecretGroup: 1,
|
||||
|
||||
// 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: []string{"dnkey"},
|
||||
|
||||
@@ -9,8 +9,7 @@ func DigitalOceanPAT() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "DigitalOcean Personal Access Token",
|
||||
RuleID: "digitalocean-pat",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`dop_v1_[a-f0-9]{64}`),
|
||||
Regex: generateUniqueTokenRegex(`dop_v1_[a-f0-9]{64}`, true),
|
||||
Keywords: []string{"dop_v1_"},
|
||||
}
|
||||
|
||||
@@ -24,9 +23,9 @@ func DigitalOceanOAuthToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "DigitalOcean OAuth Access Token",
|
||||
RuleID: "digitalocean-access-token",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`doo_v1_[a-f0-9]{64}`),
|
||||
Keywords: []string{"doo_v1_"},
|
||||
|
||||
Regex: generateUniqueTokenRegex(`doo_v1_[a-f0-9]{64}`, true),
|
||||
Keywords: []string{"doo_v1_"},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
@@ -39,9 +38,9 @@ func DigitalOceanRefreshToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "DigitalOcean OAuth Refresh Token",
|
||||
RuleID: "digitalocean-refresh-token",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`dor_v1_[a-f0-9]{64}`),
|
||||
Keywords: []string{"dor_v1_"},
|
||||
|
||||
Regex: generateUniqueTokenRegex(`dor_v1_[a-f0-9]{64}`, true),
|
||||
Keywords: []string{"dor_v1_"},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
|
||||
@@ -10,8 +10,7 @@ func DiscordAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discord API key",
|
||||
RuleID: "discord-api-token",
|
||||
Regex: generateSemiGenericRegex([]string{"discord"}, hex("64")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"discord"}, hex("64"), true),
|
||||
Keywords: []string{"discord"},
|
||||
}
|
||||
|
||||
@@ -27,8 +26,7 @@ func DiscordClientID() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discord client ID",
|
||||
RuleID: "discord-client-id",
|
||||
Regex: generateSemiGenericRegex([]string{"discord"}, numeric("18")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"discord"}, numeric("18"), true),
|
||||
Keywords: []string{"discord"},
|
||||
}
|
||||
|
||||
@@ -44,8 +42,7 @@ func DiscordClientSecret() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discord client secret",
|
||||
RuleID: "discord-client-secret",
|
||||
Regex: generateSemiGenericRegex([]string{"discord"}, alphaNumericExtended("32")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"discord"}, alphaNumericExtended("32"), true),
|
||||
Keywords: []string{"discord"},
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ func DroneciAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "droneci-access-token",
|
||||
Description: "Droneci Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"droneci"}, alphaNumeric("32")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"droneci"}, alphaNumeric("32"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"droneci",
|
||||
},
|
||||
|
||||
@@ -10,9 +10,9 @@ func DropBoxAPISecret() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Dropbox API secret",
|
||||
RuleID: "dropbox-api-token",
|
||||
Regex: generateSemiGenericRegex([]string{"dropbox"}, alphaNumeric("15")),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"dropbox"},
|
||||
Regex: generateSemiGenericRegex([]string{"dropbox"}, alphaNumeric("15"), true),
|
||||
|
||||
Keywords: []string{"dropbox"},
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -27,7 +27,7 @@ func DropBoxShortLivedAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "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"},
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ func DropBoxLongLivedAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "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"},
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ func EtsyAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "etsy-access-token",
|
||||
Description: "Etsy Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"etsy"}, alphaNumeric("24")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"etsy"}, alphaNumeric("24"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"etsy",
|
||||
},
|
||||
|
||||
@@ -10,9 +10,9 @@ func Facebook() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Facebook Access Token",
|
||||
RuleID: "facebook",
|
||||
Regex: generateSemiGenericRegex([]string{"facebook"}, hex("32")),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"facebook"},
|
||||
Regex: generateSemiGenericRegex([]string{"facebook"}, hex("32"), true),
|
||||
|
||||
Keywords: []string{"facebook"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -10,9 +10,9 @@ func FastlyAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Fastly API key",
|
||||
RuleID: "fastly-api-token",
|
||||
Regex: generateSemiGenericRegex([]string{"fastly"}, alphaNumericExtended("32")),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"fastly"},
|
||||
Regex: generateSemiGenericRegex([]string{"fastly"}, alphaNumericExtended("32"), true),
|
||||
|
||||
Keywords: []string{"fastly"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -10,9 +10,9 @@ func FinicityClientSecret() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Finicity Client Secret",
|
||||
RuleID: "finicity-client-secret",
|
||||
Regex: generateSemiGenericRegex([]string{"finicity"}, alphaNumeric("20")),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"finicity"},
|
||||
Regex: generateSemiGenericRegex([]string{"finicity"}, alphaNumeric("20"), true),
|
||||
|
||||
Keywords: []string{"finicity"},
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -27,9 +27,9 @@ func FinicityAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Finicity API token",
|
||||
RuleID: "finicity-api-token",
|
||||
Regex: generateSemiGenericRegex([]string{"finicity"}, hex("32")),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"finicity"},
|
||||
Regex: generateSemiGenericRegex([]string{"finicity"}, hex("32"), true),
|
||||
|
||||
Keywords: []string{"finicity"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -10,8 +10,8 @@ func FinnhubAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "finnhub-access-token",
|
||||
Description: "Finnhub Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"finnhub"}, alphaNumeric("20")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"finnhub"}, alphaNumeric("20"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"finnhub",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func FlickrAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "flickr-access-token",
|
||||
Description: "Flickr Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"flickr"}, alphaNumeric("32")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"flickr"}, alphaNumeric("32"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"flickr",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func FreshbooksAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "freshbooks-access-token",
|
||||
Description: "Freshbooks Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"freshbooks"}, alphaNumeric("64")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"freshbooks"}, alphaNumeric("64"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"freshbooks",
|
||||
},
|
||||
|
||||
@@ -29,8 +29,8 @@ func GCPAPIKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "gcp-api-key",
|
||||
Description: "GCP API key",
|
||||
Regex: generateUniqueTokenRegex(`AIza[0-9A-Za-z\\-_]{35}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`AIza[0-9A-Za-z\\-_]{35}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"AIza",
|
||||
},
|
||||
|
||||
@@ -19,8 +19,7 @@ func GenericCredential() *config.Rule {
|
||||
"password",
|
||||
"auth",
|
||||
"access",
|
||||
}, `[0-9a-z\-_.=]{10,150}`),
|
||||
SecretGroup: 1,
|
||||
}, `[0-9a-z\-_.=]{10,150}`, true),
|
||||
Keywords: []string{
|
||||
"key",
|
||||
"api",
|
||||
|
||||
@@ -11,8 +11,8 @@ func GitterAccessToken() *config.Rule {
|
||||
RuleID: "gitter-access-token",
|
||||
Description: "Gitter Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"gitter"},
|
||||
alphaNumericExtendedShort("40")),
|
||||
SecretGroup: 1,
|
||||
alphaNumericExtendedShort("40"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"gitter",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func GoCardless() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "gocardless-api-token",
|
||||
Description: "GoCardless API token",
|
||||
Regex: generateSemiGenericRegex([]string{"gocardless"}, `live_(?i)[a-z0-9\-_=]{40}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"gocardless"}, `live_(?i)[a-z0-9\-_=]{40}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"live_",
|
||||
"gocardless",
|
||||
|
||||
@@ -10,9 +10,9 @@ func GrafanaApiKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Grafana api key (or Grafana cloud api key)",
|
||||
RuleID: "grafana-api-key",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`eyJrIjoi[A-Za-z0-9]{70,400}={0,2}`),
|
||||
Keywords: []string{"eyJrIjoi"},
|
||||
|
||||
Regex: generateUniqueTokenRegex(`eyJrIjoi[A-Za-z0-9]{70,400}={0,2}`, true),
|
||||
Keywords: []string{"eyJrIjoi"},
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -29,9 +29,9 @@ func GrafanaCloudApiToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Grafana cloud api token",
|
||||
RuleID: "grafana-cloud-api-token",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`glc_[A-Za-z0-9+/]{32,400}={0,2}`),
|
||||
Keywords: []string{"glc_"},
|
||||
|
||||
Regex: generateUniqueTokenRegex(`glc_[A-Za-z0-9+/]{32,400}={0,2}`, true),
|
||||
Keywords: []string{"glc_"},
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -48,9 +48,9 @@ func GrafanaServiceAccountToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Grafana service account token",
|
||||
RuleID: "grafana-service-account-token",
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8}`),
|
||||
Keywords: []string{"glsa_"},
|
||||
|
||||
Regex: generateUniqueTokenRegex(`glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8}`, true),
|
||||
Keywords: []string{"glsa_"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
@@ -22,3 +23,26 @@ func Hashicorp() *config.Rule {
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func HashicorpField() *config.Rule {
|
||||
keywords := []string{"administrator_login_password", "password"}
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "HashiCorp Terraform password field",
|
||||
RuleID: "hashicorp-tf-password",
|
||||
Regex: generateSemiGenericRegex(keywords, fmt.Sprintf(`"%s"`, alphaNumericExtended("8,20")), true),
|
||||
Keywords: keywords,
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
// Example from: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/sql_server.html
|
||||
"administrator_login_password = " + `"thisIsDog11"`,
|
||||
// https://registry.terraform.io/providers/petoju/mysql/latest/docs
|
||||
"password = " + `"rootpasswd"`,
|
||||
}
|
||||
fps := []string{
|
||||
"administrator_login_password = var.db_password",
|
||||
`password = "${aws_db_instance.default.password}"`,
|
||||
}
|
||||
return validate(r, tps, fps)
|
||||
}
|
||||
@@ -9,9 +9,9 @@ func Heroku() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Heroku API Key",
|
||||
RuleID: "heroku-api-key",
|
||||
Regex: generateSemiGenericRegex([]string{"heroku"}, hex8_4_4_4_12()),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"heroku"},
|
||||
Regex: generateSemiGenericRegex([]string{"heroku"}, hex8_4_4_4_12(), true),
|
||||
|
||||
Keywords: []string{"heroku"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -10,9 +10,9 @@ func HubSpot() *config.Rule {
|
||||
Description: "HubSpot API Token",
|
||||
RuleID: "hubspot-api-key",
|
||||
Regex: generateSemiGenericRegex([]string{"hubspot"},
|
||||
`[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}`),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"hubspot"},
|
||||
`[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}`, true),
|
||||
|
||||
Keywords: []string{"hubspot"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
// Reference: https://huggingface.co/docs/hub/security-tokens
|
||||
//
|
||||
// Old tokens have the prefix `api_`, however, I am not sure it's worth detecting them as that would be high noise.
|
||||
// https://huggingface.co/docs/api-inference/quicktour
|
||||
func HuggingFaceAccessToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
RuleID: "huggingface-access-token",
|
||||
Description: "Hugging Face Access token",
|
||||
Regex: regexp.MustCompile(`(?:^|[\\'"` + "`" + ` >=:])(hf_[a-zA-Z]{34})(?:$|[\\'"` + "`" + ` <])`),
|
||||
|
||||
Entropy: 1,
|
||||
Keywords: []string{
|
||||
"hf_",
|
||||
},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
`huggingface-cli login --token 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`,
|
||||
`huggingface-cli login --token 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`,
|
||||
`huggingface-cli login --token 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`,
|
||||
`huggingface-cli login --token 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`,
|
||||
`huggingface-cli login --token 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`,
|
||||
`huggingface-cli login --token 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`,
|
||||
`huggingface-cli login --token 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`,
|
||||
`huggingface-cli login --token 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`,
|
||||
`-H "Authorization: Bearer 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"`,
|
||||
`DEV=1 HF_TOKEN=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 poetry run python app.py`,
|
||||
`use_auth_token='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')`,
|
||||
`CI_HUB_USER_TOKEN = "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"`,
|
||||
`- Change line 5 and add your Hugging Face token, that is, instead of 'hf_token = "ADD_YOUR_HUGGING_FACE_TOKEN_HERE"', you will need to change it to something like'hf_token = "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"'`,
|
||||
` " hf_token = \"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\"\n",`,
|
||||
`# Not critical, only usable on the sandboxed CI instance.
|
||||
TOKEN = "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"`,
|
||||
` parser.add_argument("--hf_token", type=str, default='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', help="Hugging Face Access Token to access PyAnnote gated models")`,
|
||||
}
|
||||
fps := []string{
|
||||
`- (id)hf_requiredCharacteristicTypesForDisplayMetadata;`,
|
||||
`amazon.de#@#div[data-cel-widget="desktop-rhf_SponsoredProductsRemoteRHFSearchEXPSubsK2ClickPagination"]`,
|
||||
` _kHMSymptomhf_generatedByHomeAppForDebuggingPurposesKey,`,
|
||||
` #define OSCHF_DebugGetExpectedAverageCrystalAmplitude NOROM_OSCHF_DebugGetExpectedAverageCrystalAmplitude`,
|
||||
` M_UINT (ServingCellPriorityParametersDescription_t, H_PRIO, 2, &hf_servingcellpriorityparametersdescription_h_prio),`,
|
||||
`+HWI-ST565_0092:4:1101:5508:5860#ACTTGA/1
|
||||
bb_eeeeegfgffhiiiiiiiiiiihiiiiicgafhf_eefghihhiiiifhifhhdhifhiiiihifdgdhggf\bbceceedbcd
|
||||
@HWI-ST565_0092:4:1101:7621:5770#ACTTGA/1`,
|
||||
`y{}x|~|}{~}}~|~}||�~|�{��|{}{|~z{}{{|{||{|}|{}{~|y}vjoePbUBJ7&;"; <; :;?!!;<7%$IACa_ecghbfbaebejhahfbhf_ddbficghbgfbhhcghdghfhigiifhhehhdggcgfchf_fgcei^[[.40&54"5666 6`,
|
||||
` change_dir(cwd)
|
||||
subdirs = glob.glob('HF_CAASIMULIAComputeServicesBuildTime.HF*.Linux64')
|
||||
if len(subdirs) == 1:`,
|
||||
` os.environ.get("HF_AUTH_TOKEN",
|
||||
"hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),`,
|
||||
`# HuggingFace API Token https://huggingface.co/settings/tokens
|
||||
HUGGINGFACE_API_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,`,
|
||||
}
|
||||
return validate(r, tps, fps)
|
||||
}
|
||||
|
||||
// Will be deprecated Aug 1st, 2023.
|
||||
func HuggingFaceOrganizationApiToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
RuleID: "huggingface-organization-api-token",
|
||||
Description: "Hugging Face Organization API token",
|
||||
Regex: regexp.MustCompile(`(?:^|[\\'"` + "`" + ` >=:\(,)])(api_org_[a-zA-Z]{34})(?:$|[\\'"` + "`" + ` <\),])`),
|
||||
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"api_org_",
|
||||
},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
`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`,
|
||||
"`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`",
|
||||
`\'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'\`,
|
||||
`\"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\"`,
|
||||
`,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,`,
|
||||
`(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)`,
|
||||
`<foo>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</foo>`,
|
||||
`def test_private_space(self):
|
||||
hf_token = "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" # Intentionally revealing this key for testing purposes
|
||||
io = gr.load(`,
|
||||
`hf_token = "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" # Intentionally revealing this key for testing purposes`,
|
||||
`"news_train_dataset = datasets.load_dataset('nlpHakdang/aihub-news30k', data_files = \"train_news_text.csv\", use_auth_token='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')\n",`,
|
||||
`os.environ['HUGGINGFACEHUB_API_TOKEN'] = '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'`,
|
||||
fmt.Sprintf("api_org_%s", secrets.NewSecret(`[a-zA-Z]{34}`)),
|
||||
}
|
||||
fps := []string{
|
||||
`public static final String API_ORG_EXIST = "APIOrganizationExist";`,
|
||||
`const api_org_controller = require('../../controllers/api/index').organizations;`,
|
||||
`API_ORG_CREATE("https://qyapi.weixin.qq.com/cgi-bin/department/create?access_token=ACCESS_TOKEN"),`,
|
||||
`def test_internal_api_org_inclusion_with_href(api_name, href, expected, monkeypatch, called_with):
|
||||
monkeypatch.setattr("requests.sessions.Session.request", called_with)`,
|
||||
` def _api_org_96726c78_4ae3_402f_b08b_7a78c6903d2a(self, method, url, body, headers):
|
||||
body = self.fixtures.load("api_org_96726c78_4ae3_402f_b08b_7a78c6903d2a.xml")
|
||||
return httplib.OK, body, headers, httplib.responses[httplib.OK]`,
|
||||
`<p>You should see a token <code>hf_xxxxx</code> (old tokens are <code>api_XXXXXXXX</code> or <code>api_org_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</code>).</p>`,
|
||||
` From Hugging Face docs:
|
||||
You should see a token hf_xxxxx (old tokens are api_XXXXXXXX or api_org_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx).
|
||||
If you do not submit your API token when sending requests to the API, you will not be able to run inference on your private models.`,
|
||||
}
|
||||
return validate(r, tps, fps)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
func InfracostAPIToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
// Human readable description of the rule
|
||||
Description: "Infracost API Token",
|
||||
|
||||
// Unique ID for the rule
|
||||
RuleID: "infracost-api-token",
|
||||
|
||||
// Regex capture group for the actual secret
|
||||
|
||||
// Regex used for detecting secrets. See regex section below for more details
|
||||
Regex: generateUniqueTokenRegex(`ico-[a-zA-Z0-9]{32}`, true),
|
||||
|
||||
// Keywords used for string matching on fragments (think of this as a prefilter)
|
||||
Keywords: []string{"ico-"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("ico", "ico-"+secrets.NewSecret("[A-Za-z0-9]{32}")),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
@@ -10,9 +10,9 @@ func Intercom() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Intercom API Token",
|
||||
RuleID: "intercom-api-key",
|
||||
Regex: generateSemiGenericRegex([]string{"intercom"}, alphaNumericExtended("60")),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"intercom"},
|
||||
Regex: generateSemiGenericRegex([]string{"intercom"}, alphaNumericExtended("60"), true),
|
||||
|
||||
Keywords: []string{"intercom"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
func JFrogAPIKey() *config.Rule {
|
||||
keywords := []string{"jfrog", "artifactory", "bintray", "xray"}
|
||||
|
||||
// Define Rule
|
||||
r := config.Rule{
|
||||
// Human readable description of the rule
|
||||
Description: "JFrog API Key",
|
||||
|
||||
// Unique ID for the rule
|
||||
RuleID: "jfrog-api-key",
|
||||
|
||||
// Regex capture group for the actual secret
|
||||
|
||||
// Regex used for detecting secrets. See regex section below for more details
|
||||
Regex: generateSemiGenericRegex(keywords, alphaNumeric("73"), true),
|
||||
|
||||
// Keywords used for string matching on fragments (think of this as a prefilter)
|
||||
Keywords: keywords,
|
||||
}
|
||||
// validate
|
||||
tps := []string{
|
||||
fmt.Sprintf("--set imagePullSecretJfrog.password=%s", secrets.NewSecret(alphaNumeric("73"))),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func JFrogIdentityToken() *config.Rule {
|
||||
keywords := []string{"jfrog", "artifactory", "bintray", "xray"}
|
||||
|
||||
// Define Rule
|
||||
r := config.Rule{
|
||||
// Human readable description of the rule
|
||||
Description: "JFrog Identity Token",
|
||||
|
||||
// Unique ID for the rule
|
||||
RuleID: "jfrog-identity-token",
|
||||
|
||||
// Regex capture group for the actual secret
|
||||
|
||||
// Regex used for detecting secrets. See regex section below for more details
|
||||
Regex: generateSemiGenericRegex(keywords, alphaNumeric("64"), true),
|
||||
|
||||
// Keywords used for string matching on fragments (think of this as a prefilter)
|
||||
Keywords: keywords,
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("jfrog", secrets.NewSecret(alphaNumeric("64"))),
|
||||
generateSampleSecret("artifactory", secrets.NewSecret(alphaNumeric("64"))),
|
||||
generateSampleSecret("bintray", secrets.NewSecret(alphaNumeric("64"))),
|
||||
generateSampleSecret("xray", secrets.NewSecret(alphaNumeric("64"))),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
b64 "encoding/base64"
|
||||
"fmt"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
@@ -9,13 +13,176 @@ func JWT() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "JSON Web Token",
|
||||
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[a-zA-Z0-9]{17,}\.ey[a-zA-Z0-9\/\\_-]{17,}\.(?:[a-zA-Z0-9\/\\_-]{10,}={0,2})?`, false),
|
||||
Keywords: []string{"ey"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{`eyJhbGciOieeeiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwic3ViZSI6IjEyMzQ1Njc4OTAiLCJuYW1lZWEiOiJKb2huIERvZSIsInN1ZmV3YWZiIjoiMTIzNDU2Nzg5MCIsIm5hbWVmZWF3ZnciOiJKb2huIERvZSIsIm5hbWVhZmV3ZmEiOiJKb2huIERvZSIsInN1ZndhZndlYWIiOiIxMjM0NTY3ODkwIiwibmFtZWZ3YWYiOiJKb2huIERvZSIsInN1YmZ3YWYiOiIxMjM0NTY3ODkwIiwibmFtZndhZSI6IkpvaG4gRG9lIiwiaWZ3YWZhYXQiOjE1MTYyMzkwMjJ9.a_5icKBDo-8EjUlrfvz2k2k-FYaindQ0DEYNrlsnRG0==`, // gitleaks:allow
|
||||
`JWT := eyJhbGciOieeeiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwib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WQiOnRydWUsImV4cCI6IjE1OTQ2MDAxODIiLCJpYXQiOjE1OTQ1ODkzODQsImlzcyI6Imh0dHA6Ly8xMjcuMC4wLjE6NTU1Ni9kZXgiLCJuYW1lIjoiYWRtaW4iLCJzdWIiOiJDaVF3T0dFNE5qZzBZaTFrWWpnNExUUmlOek10T1RCaE9TMHpZMlF4TmpZeFpqVTBOallTQld4dlkyRnMifQ.nrbzIJz99Om7TvJ04jnSTmhvlM7aR9hMM1Aqjp2ONJ1UKYCvegBLrTu6cYR968_OpmnAGJ8vkd7sIjUjtR4zbw"`, // gitleaks:allow
|
||||
`https://dai2-playlistserver.aws.syncbak.com/cpl/20980038/dai2v5/1.0/7b2264657669636554797065223a387d/master.m3u8?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkdyYXkyMDE2MDgyOSJ9.eyJtaWQiOiIyMDk4MDAzOCIsImNpZCI6MjE5MDMsInNpZCI6MTU4LCJtZDUiOiIwN2QxMmRjNjAwOTM2MGI0MmY3NjNkNTRiMWIwZjI1NCIsImlhdCI6MTY2MDkxMzU2MCwiZXhwIjoxNjkyNDQ5NTYwLCJpc3MiOiJTeW5jYmFrIChURykifQ.JrWVgwzIn_RcNuWhkzIjr1i4qjXU1v4n0KFrSzoTQvQ`, // gitleaks:allow `
|
||||
`"SessionToken": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NLZXkiOiI2TjJCQUxYN0VMTzgyN0RYUzNHSyIsImFjciI6IjAiLCJhdWQiOiJhY2NvdW50IiwiYXV0aF90aW1lIjoxNTY5OTEwNTUyLCJhenAiOiJhY2NvdW50IiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJleHAiOjE1Njk5MTQ1NTQsImlhdCI6MTU2OTkxMDk1NCwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgxL2F1dGgvcmVhbG1zL2RlbW8iLCJqdGkiOiJkOTk4YTBlZS01NDk2LTQ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uJqBIKgfn0M7ta2bY_qx-UrsEW0CqnXol7vhXuDAfMeWZYKuDP8qc2VH1T6wpO2JnZ0EaNDuZfQLOWFYKsFGlaYcus9j462AfJQBSFQTbkIjkvKMK6aI_rMEesAnJr2eei1UYi14JYiQ"`, // gitleaks:allow
|
||||
`eyJhbGciOiJSUzI1NiIsImtpZCI6IkRIRmJwb0lVcXJZOHQyenBBMnFYZkNtcjVWTzVaRXI0UnpIVV8tZW52dlEiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjM1MzczOTExMDQsImdyb3VwcyI6WyJncm91cDEiLCJncm91cDIiXSwiaWF0IjoxNTM3MzkxMTA0LCJpc3MiOiJ0ZXN0aW5nQHNlY3VyZS5pc3Rpby5pbyIsInNjb3BlIjpbInNjb3BlMSIsInNjb3BlMiJdLCJzdWIiOiJ0ZXN0aW5nQHNlY3VyZS5pc3Rpby5pbyJ9.EdJnEZSH6X8hcyEii7c8H5lnhgjB5dwo07M5oheC8Xz8mOllyg--AHCFWHybM48reunF--oGaG6IXVngCEpVF0_P5DwsUoBgpPmK1JOaKN6_pe9sh0ZwTtdgK_RP01PuI7kUdbOTlkuUi2AO-qUyOm7Art2POzo36DLQlUXv8Ad7NBOqfQaKjE9ndaPWT7aexUsBHxmgiGbz1SyLH879f7uHYPbPKlpHU6P9S-DaKnGLaEchnoKnov7ajhrEhGXAQRukhDPKUHO9L30oPIr5IJllEQfHYtt6IZvlNUGeLUcif3wpry1R5tBXRicx2sXMQ7LyuDremDbcNy_iE76Upg`, // gitleaks:allow
|
||||
`python examples/cli.py eyJhbGciOiJIUzI1NiJ9.eyJJc3N1ZXIiOiJJc3N1ZXIiLCJVc2VybmFtZSI6IkJhZFNlY3JldHMiLCJleHAiOjE1OTMxMzM0ODMsImlhdCI6MTQ2NjkwMzA4M30.ovqRikAo_0kKJ0GVrAwQlezymxrLGjcEiW_s3UJMMCo`, // gitleaks:allow
|
||||
`"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6I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","expires_at":"2021-02-14T20:41:01Z"}`, // gitleaks:allow
|
||||
`curl -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsiQVBJIl0sImV4cCI6MTYxMzMzNTI2MSwianRpIjoiYzBrb2gxZmNkcnBjaHNzMGZwZmciLCJuYmYiOjE2MTMzMzQ2MzEsInBlcm1pc3Npb25zIjpbIioiXSwic3ViIjoiYUJ0SHUwMHNBUmxzZ29yeEtLQ1pZZWVqSTRKVTlXbThHSGNiVWtWVmc1TT0iLCJ1c2VybmFtZSI6ImFkbWluIn0.WiyqvUF-92zCr--y4Q_sxn-tPnISFzGZd_exsG-K7ME" "http://127.0.0.1:8080/api/v2/dumpdata?output-data=1"`, // gitleaks:allow
|
||||
`"authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiZ3Vlc3QiLCJzdWIiOiJZV3hwWTJVPSIsIm5iZiI6MTUxNDg1MTEzOSwiZXhwIjoxNjQxMDgxNTM5fQ.K5DnnbbIOspRbpCr2IKXE9cPVatGOCBrBQobQmBmaeU"`, // gitleaks:allow
|
||||
`{"signatures": [ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaWxlcyI6W3sibmFtZSI6Ii5tYW5pZmVzdCIsImhhc2giOiJjMjEzMTU0NGM3MTZhMjVhNWUzMWY1MDQzMDBmNTI0MGU4MjM1Y2FkYjlhNTdmMGJkMWI2ZjRiZDc0YjI2NjEyIiwiYWxnb3JpdGhtIjoiU0hBMjU2In0seyJuYW1lIjoicm9sZXMvYmluZGluZ3MvZGF0YS5qc29uIiwiaGFzaCI6IjQyY2ZlNjc2OGI1N2JiNWY3NTAzYzE2NWMyOGRkMDdhYzViODEzNTU0ZWJjODUwZjJjYzM1ODQzZTcxMzdiMWQifV0sImlhdCI6MTU5MjI0ODAyNywiaXNzIjoiSldUU2VydmljZSIsImtleWlkIjoibXlQdWJsaWNLZXkiLCJzY29wZSI6IndyaXRlIn0.ZjtUgXC6USwmhv4XP9gFH6MzZwpZrGpAL_2sTK1P-mg"]}`, // gitleaks:allow
|
||||
`"id_token": "eyJ4NXQiOiJOVEF4Wm1NeE5ETXlaRGczTVRVMVpHTTBNekV6T0RKaFpXSTRORE5sWkRVMU9HRmtOakZpTVEiLCJraWQiOiJOVEF4Wm1NeE5ETXlaRGczTVRVMVpHTTBNekV6T0RKaFpXSTRORE5sWkRVMU9HRmtOakZpTVEiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJQb0VnWFA2dVZPNDVJc0VOUm5nRFhqNUF1NVlhIiwiYXpwIjoiUG9FZ1hQNnVWTzQ1SXNFTlJuZ0RYajVBdTVZYSIsImlzcyI6Imh0dHBzOlwvXC9sb2NhbGhvc3Q6OTQ0M1wvb2F1dGgyXC90b2tlbiIsImV4cCI6MTUzNDg5MTc3OCwiaWF0IjoxNTM0ODg4MTc4LCJqdGkiOiIxODQ0MzI5Yy1kNjVhLTQ4YTMtODIyOC05ZGY3M2ZlODNkNTYifQ.ELZ8ujk2Xp9xTGgMqnCa5ehuimaAPXWlSCW5QeBbTJIT4M5OB_2XEVIV6p89kftjUdKu50oiYe4SbfrxmLm6NGSGd2qxkjzJK3SRKqsrmVWEn19juj8fz1neKtUdXVHuSZu6ws_bMDy4f_9hN2Jv9dFnkoyeNT54r4jSTJ4A2FzN2rkiURheVVsc8qlm8O7g64Az-5h4UGryyXU4zsnjDCBKYk9jdbEpcUskrFMYhuUlj1RWSASiGhHHHDU5dTRqHkVLIItfG48k_fb-ehU60T7EFWH1JBdNjOxM9oN_yb0hGwOjLUyCUJO_Y7xcd5F4dZzrBg8LffFmvJ09wzHNtQ",`, // gitleaks:allow
|
||||
` # The following default key is generated by the local Supabase start and doesn't change
|
||||
- SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0`, // gitleaks:allow
|
||||
`Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoxLCJiIjoyLCJjIjozfQ.hxhGCCCmGV9nT1slief1WgEsOsfdnlVizNrODxfh1M8`, // gitleaks:allow
|
||||
`--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJhY3RvclR5cGUiOiJVU0VSIiwiYWN0b3JJZCI6ImRhdGFodWIiLCJ0eXBlIjoiUEVSU09OQUwiLCJ2ZXJzaW9uIjoiMSIsImV4cCI6MTY1MDY2MDY1NSwianRpIjoiM2E4ZDY3ZTItOTM5Yi00NTY3LWE0MjYtZDdlMDA1ZGU3NjJjIiwic3ViIjoiZGF0YWh1YiIsImlzcyI6ImRhdGFodWItbWV0YWRhdGEtc2VydmljZSJ9.pp_vW2u1tiiTT7U0nDF2EQdcayOMB8jatiOA8Je4JJA' \`, // gitleaks:allow
|
||||
`"Cookie": "auth-token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NDIxMTEsImlzQWRtaW4iOmZhbHNlLCJnaXRodWJJZCI6ImR5ZXhwbG9kZSIsImFwcFJvbGVzIjpbInVzZXIiXSwicm9sZXMiOnsiNDciOiJzdHVkZW50IiwiNTYiOiJzdHVkZW50In0sImNvdXJzZXNSb2xlcyI6eyI0NyI6WyJzdHVkZW50Il0sIjU2IjpbInN0dWRlbnQiXX0sImNvdXJzZXMiOnsiNDciOnsibWVudG9ySWQiOm51bGwsInN0dWRlbnRJZCI6NjY3OTMsInJvbGVzIjpbInN0dWRlbnQiXX0sIjU2Ijp7Im1lbnRvcklkIjpudWxsLCJzdHVkZW50SWQiOjYzMzk4LCJyb2xlcyI6WyJzdHVkZW50Il19fSwiaWF0IjoxNjQ1MjA5NzI2LCJleHAiOjE2NDUzODI1MjZ9.btpYeSioEDUNMI6bAPqgu5zndA8XR5DT8P9U9kotOEA",`, // gitleaks:allow
|
||||
`<li> <a class="cbtn btn-grad-s btn-shadow btn-width"
|
||||
target="_blank"
|
||||
href="https://demo.kuboard.cn/dashboard?k8sToken=eyJhbGciOiJSUzI1NiIsImtpZCI6InZ6SzVqZFNJOXZFMmxQSkhXamNBcFY4RU9FR0RvSUR5bzJIY0NwVG1zODQifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJvYXJkLXZpZXdlci10b2tlbi0yOW40cyIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJrdWJvYXJkLXZpZXdlciIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjQzMWMwNmYyLTNiNTAtNGEyMy1hYjM1LTkyNDQwNTQ2NzFkZCIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDprdWJlLXN5c3RlbTprdWJvYXJkLXZpZXdlciJ9.kgwTa6t00gNC0vgr6HOvCqkDghPcW-jVDg-_K6WLy97ppb9jvaqVz-AxXzF7mJqXnNetbJw-8-x_L3ogSsDlTKmRucao96VA2tPKxel8pM04J8MU0ZmYgWhTJelibbxmQK3jwGM4x32bckOOvmtumcXdsBRN0z1SZ1iu4H0VoaswhfoFS4ZJKoe61xyqoDhQx4RLCVJh_-Uctd5RCcPLWFEk-BHqC8vUTy8QcRst6RIIozQdTqsv7Xs6bH6dHrHFS--eVVTH2orQdm8znuUFhlqFOOjmCIMzIlaUQC_SO9URIGYOs0jrk27N9KC0HvQ5dLgFmwyNJ0Gu7cYi23NP1A">
|
||||
在线演示</a></li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
||||
// https://github.com/mongodb/mongo/blob/1960b792ade4e179ddc6113a3cd400e9492ca11d/src/mongo/crypto/README.JWT.md?plain=1#L115-L117
|
||||
// TODO: Detect empty claims section?
|
||||
// `eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImVwayI6eyJrdHkiOiJFQyIsImNydiI6IlAtMzg0Iiwia2V5X29wcyI6W10sImV4dCI6dHJ1ZSwieCI6IllUcEY3bGtTc3JvZVVUVFdCb21LNzBTN0FhVTJyc0ptMURpZ1ZzbjRMY2F5eUxFNFBabldkYmFVcE9jQVV5a1ciLCJ5IjoiLU5pS3loUktjSk52Nm02Z0ZJUWc4cy1Xd1VXUW9uT3A5dkQ4cHpoa2tUU3U2RzFlU2FUTVlhZGltQ2Q4V0ExMSJ9LCJhcHUiOiIiLCJhcHYiOiIifQ`,
|
||||
`String tokenWithNoneAlg = "eyJhbGciOiJub25lIn0.eyJzdWIiOiJ0ZXN0LXVzZXIifQ.";`, // gitleaks:allow
|
||||
`# Req: Invoke-RestMethod -Uri 'http://localhost:8085/users' -Headers @{ 'X-API-KEY' = 'eyJhbGciOiJub25lIn0.eyJ1c2VybmFtZSI6Im1vcnR5Iiwic3ViIjoiMTIzIn0.' }`, // gitleaks:allow
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
fps := []string{}
|
||||
return validate(r, tps, fps)
|
||||
}
|
||||
|
||||
func JWTBase64() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
RuleID: "jwt-base64",
|
||||
Description: "Base64-encoded JSON Web Token",
|
||||
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}`),
|
||||
Keywords: []string{"zxlk"},
|
||||
}
|
||||
|
||||
tps := generateTestValues()
|
||||
fps := []string{
|
||||
`-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: GnuPG/MacGPG2 v2
|
||||
Comment: GPGTools - https://gpgtools.org
|
||||
|
||||
mQENBFOrMNcBCAC+gLI4s3bUkobS5NpOQbWfjWXbqC0Ixpc5bZYDOvsmfstmswna
|
||||
UWUXkRH9RONabzrAu4TGvW0f5DkC2fuWWHJhZWEccn+VE83+avMZN4/mzldSXPNX
|
||||
A6F7+wHb1DjG+FCDcxMghkwDjGc16LOtZGufUo5iRQaC5pmNBOgDWdiObGPKOTEL
|
||||
/uU8zLtKi2cibbkhRm22IGOzGyZMZN6zvEtPzlCp3eZEGMW0Ig+kbl6SaSDrSJNK
|
||||
wElYcr/kJ9QF6CQ2iwZCGeL2jH5QaOi5uj1LXONpCd9nPeyDXc+Z20gXZiqkwRLc
|
||||
IBPKza6hq/+4nwHBq8DNLv0W4xNC59jLb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oicHgf2R35OXTyqhv4kFJL3eukQ6oLW
|
||||
QOqQKLRycrQUu7eSESAiVmJ1gbuXLAWJmvUABGSYzj3BjWQRexYW/MZ51XqNftF9
|
||||
oOSAoFWrdqeJbHoxPTXIb6P8EWk4Ei2j2bSIfBBSbBMSB6Kfk9IjpISM8+97RS5o
|
||||
6605rmM5MY1Lz8cq8AZIYJs/MnUCZrpQ0c9QSWrflHAeWAy6xMGfdSynbEExQ4z8
|
||||
AIfKWMro74nRFbAnv/BzrF2R8uHmdE7T6q9ZZsAydlaxQbdmyhCeGAdw93CwAypb
|
||||
vHVobJ8A
|
||||
=mIC1
|
||||
-----END PGP PUBLIC KEY BLOCK-----`,
|
||||
}
|
||||
return validate(r, tps, fps)
|
||||
}
|
||||
|
||||
func generateTestValues() []string {
|
||||
// Sample JWT from RFC-7519
|
||||
jwtSuffix := ".eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
|
||||
// Validate known header parameters
|
||||
// https://www.iana.org/assignments/jose/jose.xhtml
|
||||
headers := map[string][]string{
|
||||
"alg": {
|
||||
`"ES256"`,
|
||||
`"ES384"`,
|
||||
`"ES512"`,
|
||||
`"ECDH-ES"`,
|
||||
`"HS256"`,
|
||||
`"HS384"`,
|
||||
`"HS512"`,
|
||||
`"RS256"`,
|
||||
`"RS384"`,
|
||||
`"RS512"`,
|
||||
`"PS256"`,
|
||||
`"PS384"`, `"PS512"`,
|
||||
`"none"`,
|
||||
// Nonstandard
|
||||
`"A128KW"`,
|
||||
`"ECDH-ES+A256KW"`,
|
||||
`"RSA-OAEP"`,
|
||||
},
|
||||
"apu": {`"Tx9qG69ZfodhRos-8qfhTPc6ZFnNUcgNDVdHqX1UR3s"`, `"RfXdxTfIzilWBzWWX3ovHBDzgDcLNy0BFJWSxa0dqnw"`},
|
||||
"apv": {`"ZGlkOmVsZW06cm9wc3RlbjpFa"`, `"ZGlkOmtleTp6Nk1rak1TWWF1dU1neDlhekV5VW5UVzVvNWpGUmtiQnU1VDgzZjM5dU53bnNHbW0jejZMU29HdFpTclVNWnVkQWFnekVmWWY3azhqSFpjR0Q3OVNveDd2NHdDa0RLTlN3"`},
|
||||
"aud": {`"https://vault.example.com"`, `"http://example.com"`},
|
||||
"b64": {`true`, `false`},
|
||||
"crit": {`["exp"]`},
|
||||
"cty": {`"example"`, `"json"`},
|
||||
"epk": {`{"crv":"X25519","kty":"OKP","x":"Tx9qG69ZfodhRos-8qfhTPc6ZFnNUcgNDVdHqX1UR3s"}`, `{"kty":"OKP","crv":"X25519","x":"RfXdxTfIzilWBzWWX3ovHBDzgDcLNy0BFJWSxa0dqnw"}`},
|
||||
"enc": {`"A256GCM"`, `"A256CBC-HS512"`, `"A128CBC-HS256"`},
|
||||
"jku": {`"https://c2id.com/jwks.json"`},
|
||||
"jwk": {`{"crv":"P-256","kid":"DB2X:GSG2:72H3:AE3R:KCMI:Y77E:W7TF:ERHK:V5HR:JJ2Y:YMS6:HFGJ","kty":"EC","x":"jyr9-xZBorSC9fhqNsmfU_Ud31wbaZ-bVGz0HmySvbQ","y":"vkE6qZCCvYRWjSUwgAOvibQx_s8FipYkAiHS0VnAFNs"}`, `{"kty":"RSA","n":"jyTwiSJACtW_SW-aiihQS5Y5QR704zUwjhlevY0oK-y5wP7SlIc2hq2OPVRarCzjhOxZl2AQFzM5VCR7xRDcnIn9t_pl7Mgsnx9hKDS9yQ24YXzhQ4cMEVVuqwcHvXqPdWDSoCZ1ccMqiiPyBSNGQTXMPY5PBxMOR47XwOb4eNMOPqnzVio3MEtL2wphtEonP3MY6pxJJzzel04wSCRZ4n06reqwER3KwRFPnRpRxAgmSEot5IBLIT3jj-amT5sD7YoUDbPmLk23zgDBIhX88fkClilg1W-fUi1XxYZomEPGvV7OrE1yszt4YDPqKgjJT8t2JPy__1ri-8rZgSxn5Q","e":"AQAB"`},
|
||||
"iss": {`"http://localhost:8087/realms/grafana"`, `"kubernetes/serviceaccount"`},
|
||||
"iv": {`"zjJPRrj0TGez9JYkChTrB3iqKoDkiBhn"`, `"10PlAIteHLVABtt"`},
|
||||
"kid": {`"my_key_id"`, `"did:example:123#zC1Rnuvw9rVa6E5TKF4uQVRuQuaCpVgB81Um2u17Fu7UK"`},
|
||||
"key_ops": {`["sign"]`, `["decrypt"]`, `["encrypt"]`},
|
||||
"kty": {`"EC"`, `"RSA"`},
|
||||
"nonce": {`"Os_sBjfWzVZenwwjvLrwXA"`, `"LDDZAGcBuKYpuNlFTCxPYw"`},
|
||||
"p2c": {`4096`, `1000`},
|
||||
"p2s": {`"c_ORk4HSsqZD2LvVeCUHqg"`},
|
||||
"ppt": {`"foo"`},
|
||||
"sub": {`"project_path:my-group/my-project:ref_type:branch:ref:feature-branch-1"`, `"1234567890"`},
|
||||
// I cannot find any real-world examples of the svt header
|
||||
// and the RFC doesn't seem to explicitly state the content.
|
||||
"svt": {``},
|
||||
"tag": {`"h6mJqHn33oCsDd5X57MI-g"`},
|
||||
"typ": {`"JWT"`, `"JWK"`, `"JSOE"`, `"JSON"`, `"plain"`},
|
||||
"url": {`"https://example.com"`},
|
||||
"use": {`"enc"`, `"sig"`},
|
||||
"ver": {`"2"`, `"3"`},
|
||||
"version": {`"2"`, `"3"`},
|
||||
"x5c": {`["MIICmzCCAYMCBgF4HR7HNDANBgkqhkiG9w0BAQsFADARMQ8wDQYDVQQDDAZtYXN0ZXIwHhcNMjEwMzEwMTcwOTE5WhcNMzEwMzEwMTcxMDU5WjARMQ8wDQYDVQQDDAZtYXN0ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDCpLzXHp8i09R2HU5YJPyncC4tiAWWmaDrVZenqynWlWKOjIXb0Y5JoP3ET68u16Bf7mHQGc/u9rRvCw4A92HpJ15WyUSJ80YcK0gPTE0Woc1ZxdK3h4t9AoA8VSrROwQ77w/VAdGrrJ4bwkAVrFqSRpqAsW5XxV3/bU8YkVaG8mh0kuFf/5ib0vxdSkg+mz+ZCuIxQ5YN77kNaMecO19XuaBo7FsG9WjfCPxXYuajkuLgdptPgwTN4np70h0WjaSP/jhjL2ixf48w+27wFDP+ic+B/TCOtVa3fj1GPo6RLxHGU0Zh64jFhmvRM6E/kX7IQ+FJcOwp1VPA9/vMABopAgMBAAEwDQYJKoZIhvcNAQELBQADggEBALILq1Z4oQNJZEUt24VZcvknsWtQtvPxl3JNcBQgDR5/IMgl5VndRZ9OT56KUqrR5xRsWiCvh5Lgv4fUEzAAo9ToiPLub1SKP063zWrvfgi3YZ19bty0iXFm7l2cpQ3ejFV7WpcdLJE0lapFdPLo6QaRdgNu/1p4vbYg7zSK1fQ0OY5b3ajhAx/bhWlrN685owRbO5/r4rUOa6oo9l4Qn7jUxKUx4rcoe7zUM7qrpOPqKvn0DBp3n1/+9pOZXCjIfZGvYwP5NhzBDCkRzaXcJHlOqWzMBzyovVrzVmUilBcj+EsTYJs0gVXKzduX5zO6YWhFs23lu7AijdkxTY65YM0="]`},
|
||||
"x5t": {`"IYIeevIT57t8ppUejM42Bqx6f3I"`},
|
||||
"x5t#S256": {`"TuOrBy2NcTlFSWuZ8Kh8W8AjQagb4fnfP1SlKMO8-So"`},
|
||||
"x5u": {`"https://tel.example.org/passport.cer"`},
|
||||
"zip": {`"DEF"`},
|
||||
}
|
||||
|
||||
var examples []string
|
||||
for key, values := range headers {
|
||||
for _, value := range values {
|
||||
header := fmt.Sprintf(`{"%s":%s}`, key, value)
|
||||
jwt := []byte(b64.RawURLEncoding.EncodeToString([]byte(header)) + jwtSuffix)
|
||||
examples = append(examples, b64.StdEncoding.EncodeToString(jwt))
|
||||
examples = append(examples, b64.RawStdEncoding.EncodeToString(jwt))
|
||||
examples = append(examples, b64.URLEncoding.EncodeToString(jwt))
|
||||
examples = append(examples, b64.RawURLEncoding.EncodeToString(jwt))
|
||||
}
|
||||
}
|
||||
return examples
|
||||
}
|
||||
@@ -11,8 +11,8 @@ func KrakenAccessToken() *config.Rule {
|
||||
RuleID: "kraken-access-token",
|
||||
Description: "Kraken Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"kraken"},
|
||||
alphaNumericExtendedLong("80,90")),
|
||||
SecretGroup: 1,
|
||||
alphaNumericExtendedLong("80,90"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"kraken",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func KucoinAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "kucoin-access-token",
|
||||
Description: "Kucoin Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"kucoin"}, hex("24")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"kucoin"}, hex("24"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"kucoin",
|
||||
},
|
||||
@@ -29,8 +29,8 @@ func KucoinSecretKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "kucoin-secret-key",
|
||||
Description: "Kucoin Secret Key",
|
||||
Regex: generateSemiGenericRegex([]string{"kucoin"}, hex8_4_4_4_12()),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"kucoin"}, hex8_4_4_4_12(), true),
|
||||
|
||||
Keywords: []string{
|
||||
"kucoin",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func LaunchDarklyAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "launchdarkly-access-token",
|
||||
Description: "Launchdarkly Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"launchdarkly"}, alphaNumericExtended("40")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"launchdarkly"}, alphaNumericExtended("40"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"launchdarkly",
|
||||
},
|
||||
|
||||
@@ -28,9 +28,8 @@ func LinearClientSecret() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Linear Client Secret",
|
||||
RuleID: "linear-client-secret",
|
||||
Regex: generateSemiGenericRegex([]string{"linear"}, hex("32")),
|
||||
Regex: generateSemiGenericRegex([]string{"linear"}, hex("32"), true),
|
||||
Keywords: []string{"linear"},
|
||||
SecretGroup: 1,
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -13,8 +13,8 @@ func LinkedinClientSecret() *config.Rule {
|
||||
Regex: generateSemiGenericRegex([]string{
|
||||
"linkedin",
|
||||
"linked-in",
|
||||
}, alphaNumeric("16")),
|
||||
SecretGroup: 1,
|
||||
}, alphaNumeric("16"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"linkedin",
|
||||
"linked-in",
|
||||
@@ -36,8 +36,8 @@ func LinkedinClientID() *config.Rule {
|
||||
Regex: generateSemiGenericRegex([]string{
|
||||
"linkedin",
|
||||
"linked-in",
|
||||
}, alphaNumeric("14")),
|
||||
SecretGroup: 1,
|
||||
}, alphaNumeric("14"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"linkedin",
|
||||
"linked-in",
|
||||
|
||||
@@ -10,8 +10,8 @@ func LobPubAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Lob Publishable API Key",
|
||||
RuleID: "lob-pub-api-key",
|
||||
Regex: generateSemiGenericRegex([]string{"lob"}, `(test|live)_pub_[a-f0-9]{31}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"lob"}, `(test|live)_pub_[a-f0-9]{31}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"test_pub",
|
||||
"live_pub",
|
||||
@@ -31,12 +31,11 @@ func LobAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "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{
|
||||
"test_",
|
||||
"live_",
|
||||
},
|
||||
SecretGroup: 1,
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -10,8 +10,8 @@ func MailChimp() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "mailchimp-api-key",
|
||||
Description: "Mailchimp API key",
|
||||
Regex: generateSemiGenericRegex([]string{"mailchimp"}, `[a-f0-9]{32}-us20`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"mailchimp"}, `[a-f0-9]{32}-us20`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"mailchimp",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func MailGunPrivateAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "mailgun-private-api-token",
|
||||
Description: "Mailgun private API token",
|
||||
Regex: generateSemiGenericRegex([]string{"mailgun"}, `key-[a-f0-9]{32}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"mailgun"}, `key-[a-f0-9]{32}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"mailgun",
|
||||
},
|
||||
@@ -29,8 +29,8 @@ func MailGunPubAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "mailgun-pub-key",
|
||||
Description: "Mailgun public validation key",
|
||||
Regex: generateSemiGenericRegex([]string{"mailgun"}, `pubkey-[a-f0-9]{32}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"mailgun"}, `pubkey-[a-f0-9]{32}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"mailgun",
|
||||
},
|
||||
@@ -48,8 +48,8 @@ func MailGunSigningKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "mailgun-signing-key",
|
||||
Description: "Mailgun webhook signing key",
|
||||
Regex: generateSemiGenericRegex([]string{"mailgun"}, `[a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"mailgun"}, `[a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"mailgun",
|
||||
},
|
||||
|
||||
@@ -10,9 +10,9 @@ func MapBox() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "MapBox API token",
|
||||
RuleID: "mapbox-api-token",
|
||||
Regex: generateSemiGenericRegex([]string{"mapbox"}, `pk\.[a-z0-9]{60}\.[a-z0-9]{22}`),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"mapbox"},
|
||||
Regex: generateSemiGenericRegex([]string{"mapbox"}, `pk\.[a-z0-9]{60}\.[a-z0-9]{22}`, true),
|
||||
|
||||
Keywords: []string{"mapbox"},
|
||||
}
|
||||
|
||||
// validate
|
||||
|
||||
@@ -10,8 +10,8 @@ func MattermostAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "mattermost-access-token",
|
||||
Description: "Mattermost Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"mattermost"}, alphaNumeric("26")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"mattermost"}, alphaNumeric("26"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"mattermost",
|
||||
},
|
||||
|
||||
@@ -14,8 +14,8 @@ func MessageBirdAPIToken() *config.Rule {
|
||||
"messagebird",
|
||||
"message-bird",
|
||||
"message_bird",
|
||||
}, alphaNumeric("25")),
|
||||
SecretGroup: 1,
|
||||
}, alphaNumeric("25"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"messagebird",
|
||||
"message-bird",
|
||||
@@ -41,8 +41,8 @@ func MessageBirdClientID() *config.Rule {
|
||||
"messagebird",
|
||||
"message-bird",
|
||||
"message_bird",
|
||||
}, hex8_4_4_4_12()),
|
||||
SecretGroup: 1,
|
||||
}, hex8_4_4_4_12(), true),
|
||||
|
||||
Keywords: []string{
|
||||
"messagebird",
|
||||
"message-bird",
|
||||
|
||||
@@ -11,8 +11,8 @@ func NetlifyAccessToken() *config.Rule {
|
||||
RuleID: "netlify-access-token",
|
||||
Description: "Netlify Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"netlify"},
|
||||
alphaNumericExtended("40,46")),
|
||||
SecretGroup: 1,
|
||||
alphaNumericExtended("40,46"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"netlify",
|
||||
},
|
||||
|
||||
@@ -14,8 +14,8 @@ func NewRelicUserID() *config.Rule {
|
||||
"new-relic",
|
||||
"newrelic",
|
||||
"new_relic",
|
||||
}, `NRAK-[a-z0-9]{27}`),
|
||||
SecretGroup: 1,
|
||||
}, `NRAK-[a-z0-9]{27}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"NRAK",
|
||||
},
|
||||
@@ -37,8 +37,8 @@ func NewRelicUserKey() *config.Rule {
|
||||
"new-relic",
|
||||
"newrelic",
|
||||
"new_relic",
|
||||
}, alphaNumeric("64")),
|
||||
SecretGroup: 1,
|
||||
}, alphaNumeric("64"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"new-relic",
|
||||
"newrelic",
|
||||
@@ -62,8 +62,8 @@ func NewRelicBrowserAPIKey() *config.Rule {
|
||||
"new-relic",
|
||||
"newrelic",
|
||||
"new_relic",
|
||||
}, `NRJS-[a-f0-9]{19}`),
|
||||
SecretGroup: 1,
|
||||
}, `NRJS-[a-f0-9]{19}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"NRJS-",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func NPM() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "npm-access-token",
|
||||
Description: "npm access token",
|
||||
Regex: generateUniqueTokenRegex(`npm_[a-z0-9]{36}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`npm_[a-z0-9]{36}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"npm_",
|
||||
},
|
||||
|
||||
@@ -12,8 +12,8 @@ func NytimesAccessToken() *config.Rule {
|
||||
Description: "Nytimes Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{
|
||||
"nytimes", "new-york-times,", "newyorktimes"},
|
||||
alphaNumericExtended("32")),
|
||||
SecretGroup: 1,
|
||||
alphaNumericExtended("32"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"nytimes",
|
||||
"new-york-times",
|
||||
|
||||
@@ -11,8 +11,8 @@ func OktaAccessToken() *config.Rule {
|
||||
RuleID: "okta-access-token",
|
||||
Description: "Okta Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"okta"},
|
||||
alphaNumericExtended("42")),
|
||||
SecretGroup: 1,
|
||||
alphaNumericExtended("42"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"okta",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func OpenAI() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "openai-api-key",
|
||||
Description: "OpenAI API Key",
|
||||
Regex: generateUniqueTokenRegex(`sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"T3BlbkFJ",
|
||||
},
|
||||
|
||||
@@ -12,8 +12,9 @@ func PlaidAccessID() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "plaid-client-id",
|
||||
Description: "Plaid Client ID",
|
||||
Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("24")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("24"), true),
|
||||
|
||||
Entropy: 3.5,
|
||||
Keywords: []string{
|
||||
"plaid",
|
||||
},
|
||||
@@ -31,8 +32,9 @@ func PlaidSecretKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "plaid-secret-key",
|
||||
Description: "Plaid Secret key",
|
||||
Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("30")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("30"), true),
|
||||
|
||||
Entropy: 3.5,
|
||||
Keywords: []string{
|
||||
"plaid",
|
||||
},
|
||||
@@ -51,8 +53,8 @@ func PlaidAccessToken() *config.Rule {
|
||||
RuleID: "plaid-api-token",
|
||||
Description: "Plaid API Token",
|
||||
Regex: generateSemiGenericRegex([]string{"plaid"},
|
||||
fmt.Sprintf("access-(?:sandbox|development|production)-%s", hex8_4_4_4_12())),
|
||||
SecretGroup: 1,
|
||||
fmt.Sprintf("access-(?:sandbox|development|production)-%s", hex8_4_4_4_12()), true),
|
||||
|
||||
Keywords: []string{
|
||||
"plaid",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func PlanetScalePassword() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "planetscale-password",
|
||||
Description: "PlanetScale password",
|
||||
Regex: generateUniqueTokenRegex(`pscale_pw_(?i)[a-z0-9=\-_\.]{32,64}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`pscale_pw_(?i)[a-z0-9=\-_\.]{32,64}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"pscale_pw_",
|
||||
},
|
||||
@@ -31,8 +31,8 @@ func PlanetScaleAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "planetscale-api-token",
|
||||
Description: "PlanetScale API token",
|
||||
Regex: generateUniqueTokenRegex(`pscale_tkn_(?i)[a-z0-9=\-_\.]{32,64}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`pscale_tkn_(?i)[a-z0-9=\-_\.]{32,64}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"pscale_tkn_",
|
||||
},
|
||||
@@ -52,8 +52,8 @@ func PlanetScaleOAuthToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "planetscale-oauth-token",
|
||||
Description: "PlanetScale OAuth token",
|
||||
Regex: generateUniqueTokenRegex(`pscale_oauth_(?i)[a-z0-9=\-_\.]{32,64}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`pscale_oauth_(?i)[a-z0-9=\-_\.]{32,64}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"pscale_oauth_",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func PostManAPI() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "postman-api-token",
|
||||
Description: "Postman API token",
|
||||
Regex: generateUniqueTokenRegex(`PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"PMAK-",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func Prefect() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "prefect-api-token",
|
||||
Description: "Prefect API token",
|
||||
Regex: generateUniqueTokenRegex(`pnu_[a-z0-9]{36}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`pnu_[a-z0-9]{36}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"pnu_",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func PulumiAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "pulumi-api-token",
|
||||
Description: "Pulumi API token",
|
||||
Regex: generateUniqueTokenRegex(`pul-[a-f0-9]{40}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`pul-[a-f0-9]{40}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"pul-",
|
||||
},
|
||||
|
||||
@@ -11,8 +11,8 @@ func RapidAPIAccessToken() *config.Rule {
|
||||
RuleID: "rapidapi-access-token",
|
||||
Description: "RapidAPI Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"rapidapi"},
|
||||
alphaNumericExtendedShort("50")),
|
||||
SecretGroup: 1,
|
||||
alphaNumericExtendedShort("50"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"rapidapi",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func ReadMe() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "readme-api-token",
|
||||
Description: "Readme API token",
|
||||
Regex: generateUniqueTokenRegex(`rdme_[a-z0-9]{70}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`rdme_[a-z0-9]{70}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"rdme_",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func RubyGemsAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "rubygems-api-token",
|
||||
Description: "Rubygem API token",
|
||||
Regex: generateUniqueTokenRegex(`rubygems_[a-f0-9]{48}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`rubygems_[a-f0-9]{48}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"rubygems_",
|
||||
},
|
||||
|
||||
@@ -15,8 +15,10 @@ const (
|
||||
caseInsensitive = `(?i)`
|
||||
|
||||
// identifier prefix (just an ignore group)
|
||||
identifierPrefix = `(?:`
|
||||
identifierSuffix = `)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}`
|
||||
identifierCaseInsensitivePrefix = `(?i:`
|
||||
identifierCaseInsensitiveSuffix = `)`
|
||||
identifierPrefix = `(?:`
|
||||
identifierSuffix = `)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}`
|
||||
|
||||
// commonly used assignment operators or function call
|
||||
operator = `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)`
|
||||
@@ -28,12 +30,18 @@ const (
|
||||
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
|
||||
sb.WriteString(caseInsensitive)
|
||||
sb.WriteString(identifierPrefix)
|
||||
sb.WriteString(strings.Join(identifiers, "|"))
|
||||
sb.WriteString(identifierSuffix)
|
||||
// The identifiers should always be case-insensitive.
|
||||
// This is inelegant but prevents an extraneous `(?i:)` from being added to the pattern; it could be removed.
|
||||
if isCaseInsensitive {
|
||||
sb.WriteString(caseInsensitive)
|
||||
writeIdentifiers(&sb, identifiers)
|
||||
} else {
|
||||
sb.WriteString(identifierCaseInsensitivePrefix)
|
||||
writeIdentifiers(&sb, identifiers)
|
||||
sb.WriteString(identifierCaseInsensitiveSuffix)
|
||||
}
|
||||
sb.WriteString(operator)
|
||||
sb.WriteString(secretPrefix)
|
||||
sb.WriteString(secretRegex)
|
||||
@@ -41,9 +49,17 @@ func generateSemiGenericRegex(identifiers []string, secretRegex string) *regexp.
|
||||
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
|
||||
sb.WriteString(caseInsensitive)
|
||||
if isCaseInsensitive {
|
||||
sb.WriteString(caseInsensitive)
|
||||
}
|
||||
sb.WriteString(secretPrefixUnique)
|
||||
sb.WriteString(secretRegex)
|
||||
sb.WriteString(secretSuffix)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
func ScalingoAPIToken() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Scalingo API token",
|
||||
RuleID: "scalingo-api-token",
|
||||
Regex: regexp.MustCompile(`\btk-us-[a-zA-Z0-9-_]{48}\b`),
|
||||
Keywords: []string{"tk-us-"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("scalingo", "tk-us-"+secrets.NewSecret(alphaNumericExtendedShort("48"))),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
@@ -10,8 +10,8 @@ func SendbirdAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "sendbird-access-token",
|
||||
Description: "Sendbird Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"sendbird"}, hex("40")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"sendbird"}, hex("40"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"sendbird",
|
||||
},
|
||||
@@ -29,8 +29,8 @@ func SendbirdAccessID() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "sendbird-access-id",
|
||||
Description: "Sendbird Access ID",
|
||||
Regex: generateSemiGenericRegex([]string{"sendbird"}, hex8_4_4_4_12()),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"sendbird"}, hex8_4_4_4_12(), true),
|
||||
|
||||
Keywords: []string{
|
||||
"sendbird",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func SendGridAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "sendgrid-api-token",
|
||||
Description: "SendGrid API token",
|
||||
Regex: generateUniqueTokenRegex(`SG\.(?i)[a-z0-9=_\-\.]{66}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`SG\.(?i)[a-z0-9=_\-\.]{66}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"SG.",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func SendInBlueAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "sendinblue-api-token",
|
||||
Description: "Sendinblue API token",
|
||||
Regex: generateUniqueTokenRegex(`xkeysib-[a-f0-9]{64}\-(?i)[a-z0-9]{16}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`xkeysib-[a-f0-9]{64}\-(?i)[a-z0-9]{16}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"xkeysib-",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func SentryAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "sentry-access-token",
|
||||
Description: "Sentry Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"sentry"}, hex("64")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"sentry"}, hex("64"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"sentry",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func ShippoAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "shippo-api-token",
|
||||
Description: "Shippo API token",
|
||||
Regex: generateUniqueTokenRegex(`shippo_(live|test)_[a-f0-9]{40}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateUniqueTokenRegex(`shippo_(live|test)_[a-f0-9]{40}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"shippo_",
|
||||
},
|
||||
|
||||
@@ -11,9 +11,9 @@ func SidekiqSecret() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Sidekiq Secret",
|
||||
RuleID: "sidekiq-secret",
|
||||
SecretGroup: 1,
|
||||
|
||||
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"},
|
||||
}
|
||||
|
||||
|
||||
@@ -5,25 +5,35 @@ import (
|
||||
)
|
||||
|
||||
func Snyk() *config.Rule {
|
||||
|
||||
keywords := []string{
|
||||
"snyk_token",
|
||||
"snyk_key",
|
||||
"snyk_api_token",
|
||||
"snyk_api_key",
|
||||
"snyk_oauth_token",
|
||||
}
|
||||
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Snyk API token",
|
||||
RuleID: "snyk-api-token",
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"snyk"}, hex8_4_4_4_12()),
|
||||
Keywords: []string{"snyk"},
|
||||
|
||||
Regex: generateSemiGenericRegex(keywords, hex8_4_4_4_12(), true),
|
||||
Keywords: keywords,
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
`const SNYK_TOKEN = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`const SNYK_KEY = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`const SNYK = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`SNYK = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`SNYK_TOKEN := "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`SNYK_TOKEN ::= "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`SNYK_TOKEN :::= "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`SNYK_TOKEN ?= "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`SNYK_API_KEY ?= "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`SNYK_API_TOKEN = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`SNYK_OAUTH_TOKEN = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
}
|
||||
@@ -10,7 +10,7 @@ func SquareAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "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-"},
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ func SquareSecret() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "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-"},
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ func SquareSpaceAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "squarespace-access-token",
|
||||
Description: "Squarespace Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"squarespace"}, hex8_4_4_4_12()),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"squarespace"}, hex8_4_4_4_12(), true),
|
||||
|
||||
Keywords: []string{
|
||||
"squarespace",
|
||||
},
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
@@ -12,7 +10,7 @@ func StripeAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Stripe Access Token",
|
||||
RuleID: "stripe-access-token",
|
||||
Regex: regexp.MustCompile(`(?i)(sk|pk)_(test|live)_[0-9a-z]{10,32}`),
|
||||
Regex: generateUniqueTokenRegex(`(sk|pk)_(test|live)_[0-9a-z]{10,32}`, true),
|
||||
Keywords: []string{
|
||||
"sk_test",
|
||||
"pk_test",
|
||||
@@ -23,5 +21,6 @@ func StripeAccessToken() *config.Rule {
|
||||
|
||||
// validate
|
||||
tps := []string{"stripeToken := \"sk_test_" + secrets.NewSecret(alphaNumeric("30")) + "\""}
|
||||
return validate(r, tps, nil)
|
||||
fps := []string{"nonMatchingToken := \"task_test_" + secrets.NewSecret(alphaNumeric("30")) + "\""}
|
||||
return validate(r, tps, fps)
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
@@ -10,19 +12,42 @@ func SumoLogicAccessID() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "sumologic-access-id",
|
||||
Description: "SumoLogic Access ID",
|
||||
// TODO: Make 'su' case-sensitive.
|
||||
Regex: generateSemiGenericRegex([]string{"sumo"},
|
||||
alphaNumeric("14")),
|
||||
SecretGroup: 1,
|
||||
"su[a-zA-Z0-9]{12}", false),
|
||||
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"sumo",
|
||||
},
|
||||
Allowlist: config.Allowlist{
|
||||
RegexTarget: "line",
|
||||
Regexes: []*regexp.Regexp{
|
||||
regexp.MustCompile(`sumOf`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
generateSampleSecret("sumo", secrets.NewSecret(alphaNumeric("14"))),
|
||||
`sumologic.accessId = "su9OL59biWiJu7"`, // gitleaks:allow
|
||||
`sumologic_access_id = "sug5XpdpaoxtOH"`, // gitleaks:allow
|
||||
`export SUMOLOGIC_ACCESSID="suDbJw97o9WVo0"`, // gitleaks:allow
|
||||
`SUMO_ACCESS_ID = "suGyI5imvADdvU"`, // gitleaks:allow
|
||||
generateSampleSecret("sumo", "su"+secrets.NewSecret(alphaNumeric("12"))),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
fps := []string{
|
||||
`- (NSNumber *)sumOfProperty:(NSString *)property;`,
|
||||
`- (NSInteger)sumOfValuesInRange:(NSRange)range;`,
|
||||
`+ (unsigned char)byteChecksumOfData:(id)arg1;`,
|
||||
`sumOfExposures = sumOfExposures;`, // gitleaks:allow
|
||||
`.si-sumologic.si--color::before { color: #000099; }`,
|
||||
`/// Based on the SumoLogic keyword syntax:`,
|
||||
`sumologic_access_id = ""`,
|
||||
`SUMOLOGIC_ACCESSID: ${SUMOLOGIC_ACCESSID}`,
|
||||
`export SUMOLOGIC_ACCESSID=XXXXXXXXXXXXXX`, // gitleaks:allow
|
||||
}
|
||||
return validate(r, tps, fps)
|
||||
}
|
||||
|
||||
func SumoLogicAccessToken() *config.Rule {
|
||||
@@ -31,8 +56,9 @@ func SumoLogicAccessToken() *config.Rule {
|
||||
RuleID: "sumologic-access-token",
|
||||
Description: "SumoLogic Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"sumo"},
|
||||
alphaNumeric("64")),
|
||||
SecretGroup: 1,
|
||||
alphaNumeric("64"), true),
|
||||
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
"sumo",
|
||||
},
|
||||
@@ -40,7 +66,19 @@ func SumoLogicAccessToken() *config.Rule {
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
`export SUMOLOGIC_ACCESSKEY="3HSa1hQfz6BYzlxf7Yb1WKG3Hyovm56LMFChV2y9LgkRipsXCujcLb5ej3oQUJlx"`, // gitleaks:allow
|
||||
`SUMO_ACCESS_KEY: gxq3rJQkS6qovOg9UY2Q70iH1jFZx0WBrrsiAYv4XHodogAwTKyLzvFK4neRN8Dk`, // gitleaks:allow
|
||||
`SUMOLOGIC_ACCESSKEY: 9RITWb3I3kAnSyUolcVJq4gwM17JRnQK8ugRaixFfxkdSl8ys17ZtEL3LotESKB7`, // gitleaks:allow
|
||||
`sumo_access_key = "3Kof2VffNQ0QgYIhXUPJosVlCaQKm2hfpWE6F1fT9YGY74blQBIPsrkCcf1TwKE5"`, // gitleaks:allow
|
||||
generateSampleSecret("sumo", secrets.NewSecret(alphaNumeric("64"))),
|
||||
}
|
||||
return validate(r, tps, nil)
|
||||
fps := []string{
|
||||
`# SUMO_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`, // gitleaks:allow
|
||||
"-e SUMO_ACCESS_KEY=`etcdctl get /sumologic_secret`",
|
||||
`SUMO_ACCESS_KEY={SumoAccessKey}`,
|
||||
`SUMO_ACCESS_KEY=${SUMO_ACCESS_KEY:=$2}`,
|
||||
`sumo_access_key = "<SUMOLOGIC ACCESS KEY>"`,
|
||||
`SUMO_ACCESS_KEY: AbCeFG123`,
|
||||
}
|
||||
return validate(r, tps, fps)
|
||||
}
|
||||
@@ -12,8 +12,8 @@ func TelegramBotToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Telegram Bot API Token",
|
||||
RuleID: "telegram-bot-api-token",
|
||||
SecretGroup: 1,
|
||||
Regex: regexp.MustCompile(`(?i)(?:^|[^0-9])([0-9]{5,16}:A[a-zA-Z0-9_\-]{34})(?:$|[^a-zA-Z0-9_\-])`),
|
||||
|
||||
Regex: regexp.MustCompile(`(?i)(?:^|[^0-9])([0-9]{5,16}:A[a-zA-Z0-9_\-]{34})(?:$|[^a-zA-Z0-9_\-])`),
|
||||
Keywords: []string{
|
||||
"telegram",
|
||||
"api",
|
||||
|
||||
@@ -10,8 +10,8 @@ func TravisCIAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "travisci-access-token",
|
||||
Description: "Travis CI Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"travis"}, alphaNumeric("22")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"travis"}, alphaNumeric("22"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"travis",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,8 @@ func TrelloAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "trello-access-token",
|
||||
Description: "Trello Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"trello"}, `[a-zA-Z-0-9]{32}`),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"trello"}, `[a-zA-Z-0-9]{32}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"trello",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,7 @@ func TwitchAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "twitch-api-token",
|
||||
Description: "Twitch API token",
|
||||
Regex: generateSemiGenericRegex([]string{"twitch"}, alphaNumeric("30")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"twitch"}, alphaNumeric("30"), true),
|
||||
Keywords: []string{
|
||||
"twitch",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,7 @@ func TwitterAPIKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Twitter API Key",
|
||||
RuleID: "twitter-api-key",
|
||||
Regex: generateSemiGenericRegex([]string{"twitter"}, alphaNumeric("25")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"twitter"}, alphaNumeric("25"), true),
|
||||
Keywords: []string{"twitter"},
|
||||
}
|
||||
|
||||
@@ -27,8 +26,7 @@ func TwitterAPISecret() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Twitter API Secret",
|
||||
RuleID: "twitter-api-secret",
|
||||
Regex: generateSemiGenericRegex([]string{"twitter"}, alphaNumeric("50")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"twitter"}, alphaNumeric("50"), true),
|
||||
Keywords: []string{"twitter"},
|
||||
}
|
||||
|
||||
@@ -44,9 +42,9 @@ func TwitterBearerToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Twitter Bearer Token",
|
||||
RuleID: "twitter-bearer-token",
|
||||
Regex: generateSemiGenericRegex([]string{"twitter"}, "A{22}[a-zA-Z0-9%]{80,100}"),
|
||||
SecretGroup: 1,
|
||||
Keywords: []string{"twitter"},
|
||||
Regex: generateSemiGenericRegex([]string{"twitter"}, "A{22}[a-zA-Z0-9%]{80,100}", true),
|
||||
|
||||
Keywords: []string{"twitter"},
|
||||
}
|
||||
|
||||
// validate
|
||||
@@ -61,8 +59,7 @@ func TwitterAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Twitter Access Token",
|
||||
RuleID: "twitter-access-token",
|
||||
Regex: generateSemiGenericRegex([]string{"twitter"}, "[0-9]{15,25}-[a-zA-Z0-9]{20,40}"),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"twitter"}, "[0-9]{15,25}-[a-zA-Z0-9]{20,40}", true),
|
||||
Keywords: []string{"twitter"},
|
||||
}
|
||||
|
||||
@@ -78,8 +75,7 @@ func TwitterAccessSecret() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Twitter Access Secret",
|
||||
RuleID: "twitter-access-secret",
|
||||
Regex: generateSemiGenericRegex([]string{"twitter"}, alphaNumeric("45")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"twitter"}, alphaNumeric("45"), true),
|
||||
Keywords: []string{"twitter"},
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,7 @@ func Typeform() *config.Rule {
|
||||
RuleID: "typeform-api-token",
|
||||
Description: "Typeform API token",
|
||||
Regex: generateSemiGenericRegex([]string{"typeform"},
|
||||
`tfp_[a-z0-9\-_\.=]{59}`),
|
||||
SecretGroup: 1,
|
||||
`tfp_[a-z0-9\-_\.=]{59}`, true),
|
||||
Keywords: []string{
|
||||
"tfp_",
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@ func VaultServiceToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "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"},
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ func VaultBatchToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "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"},
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,7 @@ func YandexAWSAccessToken() *config.Rule {
|
||||
RuleID: "yandex-aws-access-token",
|
||||
Description: "Yandex AWS Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"yandex"},
|
||||
`YC[a-zA-Z0-9_\-]{38}`),
|
||||
SecretGroup: 1,
|
||||
`YC[a-zA-Z0-9_\-]{38}`, true),
|
||||
Keywords: []string{
|
||||
"yandex",
|
||||
},
|
||||
@@ -32,8 +31,8 @@ func YandexAPIKey() *config.Rule {
|
||||
RuleID: "yandex-api-key",
|
||||
Description: "Yandex API Key",
|
||||
Regex: generateSemiGenericRegex([]string{"yandex"},
|
||||
`AQVN[A-Za-z0-9_\-]{35,38}`),
|
||||
SecretGroup: 1,
|
||||
`AQVN[A-Za-z0-9_\-]{35,38}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"yandex",
|
||||
},
|
||||
@@ -53,8 +52,8 @@ func YandexAccessToken() *config.Rule {
|
||||
RuleID: "yandex-access-token",
|
||||
Description: "Yandex Access Token",
|
||||
Regex: generateSemiGenericRegex([]string{"yandex"},
|
||||
`t1\.[A-Z0-9a-z_-]+[=]{0,2}\.[A-Z0-9a-z_-]{86}[=]{0,2}`),
|
||||
SecretGroup: 1,
|
||||
`t1\.[A-Z0-9a-z_-]+[=]{0,2}\.[A-Z0-9a-z_-]{86}[=]{0,2}`, true),
|
||||
|
||||
Keywords: []string{
|
||||
"yandex",
|
||||
},
|
||||
|
||||
@@ -10,8 +10,7 @@ func ZendeskSecretKey() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "zendesk-secret-key",
|
||||
Description: "Zendesk Secret Key",
|
||||
Regex: generateSemiGenericRegex([]string{"zendesk"}, alphaNumeric("40")),
|
||||
SecretGroup: 1,
|
||||
Regex: generateSemiGenericRegex([]string{"zendesk"}, alphaNumeric("40"), true),
|
||||
Keywords: []string{
|
||||
"zendesk",
|
||||
},
|
||||
|
||||
+15
-3
@@ -5,6 +5,7 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
@@ -46,6 +47,17 @@ func runProtect(cmd *cobra.Command, args []string) {
|
||||
|
||||
// Setup detector
|
||||
detector := detect.NewDetector(cfg)
|
||||
// set color flag at first
|
||||
if detector.NoColor, err = cmd.Flags().GetBool("no-color"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
// also init logger again without color
|
||||
if detector.NoColor {
|
||||
log.Logger = log.Output(zerolog.ConsoleWriter{
|
||||
Out: os.Stderr,
|
||||
NoColor: detector.NoColor,
|
||||
})
|
||||
}
|
||||
detector.Config.Path, err = cmd.Flags().GetString("config")
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
@@ -64,14 +76,14 @@ func runProtect(cmd *cobra.Command, args []string) {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
// set redact flag
|
||||
if detector.Redact, err = cmd.Flags().GetBool("redact"); err != nil {
|
||||
if detector.Redact, err = cmd.Flags().GetUint("redact"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
if detector.MaxTargetMegaBytes, err = cmd.Flags().GetInt("max-target-megabytes"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
// set color flag
|
||||
if detector.NoColor, err = cmd.Flags().GetBool("no-color"); err != nil {
|
||||
// set ignore gitleaks:allow flag
|
||||
if detector.IgnoreGitleaksAllow, err = cmd.Flags().GetBool("ignore-gitleaks-allow"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
|
||||
|
||||
Loaded 100 of 126 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user