mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98d5648f6e | ||
|
|
9358e84588 | ||
|
|
958c18f0b7 |
No files matched your search
@@ -79,7 +79,7 @@ Flags:
|
|||||||
order of precedence:
|
order of precedence:
|
||||||
1. --config/-c
|
1. --config/-c
|
||||||
2. (--source/-s)/.gitleaks.toml
|
2. (--source/-s)/.gitleaks.toml
|
||||||
if --config/-c is not set and no .gitleaks.toml/gitleaks.toml present
|
if --config/-c is not set and no (--source/-s)/.gitleaks.toml present
|
||||||
then .gitleaks.toml will be written to (--source/-s)/.gitleaks.toml for future use
|
then .gitleaks.toml will be written to (--source/-s)/.gitleaks.toml for future use
|
||||||
--exit-code string exit code when leaks have been encountered (default: 1)
|
--exit-code string exit code when leaks have been encountered (default: 1)
|
||||||
-h, --help help for gitleaks
|
-h, --help help for gitleaks
|
||||||
@@ -110,7 +110,7 @@ You can scan files and directories by using the `--no-git` option.
|
|||||||
#### Protect
|
#### Protect
|
||||||
The `protect` command is used to uncommitted changes in a git repo. This command should be used on developer machines in accordance with
|
The `protect` command is used to uncommitted changes in a git repo. This command should be used on developer machines in accordance with
|
||||||
[shifting left on security](https://cloud.google.com/architecture/devops/devops-tech-shifting-left-on-security).
|
[shifting left on security](https://cloud.google.com/architecture/devops/devops-tech-shifting-left-on-security).
|
||||||
When running `detect` on a git repository, gitleaks will parse the output of a `git diff` command (you can see how this executed
|
When running `protect` on a git repository, gitleaks will parse the output of a `git diff` command (you can see how this executed
|
||||||
[here](https://github.com/zricethezav/gitleaks/blob/7240e16769b92d2a1b137c17d6bf9d55a8562899/git/git.go#L48-L49)). You can set the
|
[here](https://github.com/zricethezav/gitleaks/blob/7240e16769b92d2a1b137c17d6bf9d55a8562899/git/git.go#L48-L49)). You can set the
|
||||||
`--staged` flag to check for changes in commits that have been `git add`ed. The `--staged` flag should be used when running Gitleaks
|
`--staged` flag to check for changes in commits that have been `git add`ed. The `--staged` flag should be used when running Gitleaks
|
||||||
as a pre-commit.
|
as a pre-commit.
|
||||||
@@ -127,7 +127,7 @@ Example output:
|
|||||||
"EndLine": 37,
|
"EndLine": 37,
|
||||||
"StartColumn": 19,
|
"StartColumn": 19,
|
||||||
"EndColumn": 38,
|
"EndColumn": 38,
|
||||||
"Context": "\t\t\"aws_secret= \\\"AKIAIMNOJVGFDXXXE4OA\\\"\": true,",
|
"Match": "\t\t\"aws_secret= \\\"AKIAIMNOJVGFDXXXE4OA\\\"\": true,",
|
||||||
"Secret": "AKIAIMNOJVGFDXXXE4OA",
|
"Secret": "AKIAIMNOJVGFDXXXE4OA",
|
||||||
"File": "checks_test.go",
|
"File": "checks_test.go",
|
||||||
"Commit": "ec2fc9d6cb0954fb3b57201cf6133c48d8ca0d29",
|
"Commit": "ec2fc9d6cb0954fb3b57201cf6133c48d8ca0d29",
|
||||||
@@ -192,8 +192,9 @@ regex = '''one-go-style-regex-for-this-rule'''
|
|||||||
path = '''a-file-path-regex'''
|
path = '''a-file-path-regex'''
|
||||||
# Array of strings used for metadata and reporting purposes.
|
# Array of strings used for metadata and reporting purposes.
|
||||||
tags = ["tag","another tag"]
|
tags = ["tag","another tag"]
|
||||||
# Int used to check shannon entropy of a specific group in a regex match.
|
# Int used to extract secret from regex match and used as the group that will have
|
||||||
entropyGroup = 3
|
# its entropy checked if `entropy` is set.
|
||||||
|
secretGroup = 3
|
||||||
# Float representing the minimum shannon entropy a regex group must have to be considered a secret.
|
# Float representing the minimum shannon entropy a regex group must have to be considered a secret.
|
||||||
entropy = 3.5
|
entropy = 3.5
|
||||||
# You can include an allowlist table for a single rule to reduce false positives or ignore commits
|
# You can include an allowlist table for a single rule to reduce false positives or ignore commits
|
||||||
@@ -246,6 +247,27 @@ discord_client_secret = "8dyfuiRyq=vVc3RRr_edRk-fK__JItpZ"
|
|||||||
Secret
|
Secret
|
||||||
|
|
||||||
|
|
||||||
|
#### A Note on Generic Secrets
|
||||||
|
Let's continue with the example `discord_client_secret = "8dyfuiRyq=vVc3RRr_edRk-fK__JItpZ"`.
|
||||||
|
This secret would match both the `discord-client-secret` rule and the `generic-api-key` rule in the default config.
|
||||||
|
```
|
||||||
|
[[rules]]
|
||||||
|
id = "discord-client-secret"
|
||||||
|
description = "Discord client secret"
|
||||||
|
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9=_\-]{32})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
|
[[rules]]
|
||||||
|
id = "generic-api-key"
|
||||||
|
description = "Generic API Key"
|
||||||
|
regex = '''(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]'''
|
||||||
|
entropy = 3.7
|
||||||
|
secretGroup = 4
|
||||||
|
```
|
||||||
|
If gitleaks encountered `discord_client_secret = "8dyfuiRyq=vVc3RRr_edRk-fK__JItpZ"`, only the `discord` rule would report a finding because
|
||||||
|
the generic rule has the string `generic` somewhere in the rule's `id`. If a secret is encountered and both a `generic` and non-generic rule have discovered the same secret, the non-generic
|
||||||
|
will be given precedence.
|
||||||
|
|
||||||
|
|
||||||
## Exit Codes
|
## Exit Codes
|
||||||
You can always set the exit code when leaks are encountered with the --exit-code flag. Default exit codes below:
|
You can always set the exit code when leaks are encountered with the --exit-code flag. Default exit codes below:
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ const configDescription = `config file path
|
|||||||
order of precedence:
|
order of precedence:
|
||||||
1. --config/-c
|
1. --config/-c
|
||||||
2. (--source/-s)/.gitleaks.toml
|
2. (--source/-s)/.gitleaks.toml
|
||||||
if --config/-c is not set and no .gitleaks.toml/gitleaks.toml present
|
if --config/-c is not set and no (--source/s)/.gitleaks.toml is present
|
||||||
then .gitleaks.toml will be written to (--source/-s)/.gitleaks.toml for future use`
|
then .gitleaks.toml will be written to (--source/-s)/.gitleaks.toml for future use`
|
||||||
|
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
|
|||||||
+16
-16
@@ -15,13 +15,13 @@ var DefaultConfig string
|
|||||||
type ViperConfig struct {
|
type ViperConfig struct {
|
||||||
Description string
|
Description string
|
||||||
Rules []struct {
|
Rules []struct {
|
||||||
ID string
|
ID string
|
||||||
Description string
|
Description string
|
||||||
Entropy float64
|
Entropy float64
|
||||||
EntropyGroup int
|
SecretGroup int
|
||||||
Regex string
|
Regex string
|
||||||
Path string
|
Path string
|
||||||
Tags []string
|
Tags []string
|
||||||
|
|
||||||
Allowlist struct {
|
Allowlist struct {
|
||||||
Regexes []string
|
Regexes []string
|
||||||
@@ -73,21 +73,21 @@ func (vc *ViperConfig) Translate() (Config, error) {
|
|||||||
configPathRegex = regexp.MustCompile(r.Path)
|
configPathRegex = regexp.MustCompile(r.Path)
|
||||||
}
|
}
|
||||||
r := &Rule{
|
r := &Rule{
|
||||||
Description: r.Description,
|
Description: r.Description,
|
||||||
RuleID: r.ID,
|
RuleID: r.ID,
|
||||||
Regex: configRegex,
|
Regex: configRegex,
|
||||||
Path: configPathRegex,
|
Path: configPathRegex,
|
||||||
EntropyReGroup: r.EntropyGroup,
|
SecretGroup: r.SecretGroup,
|
||||||
Entropy: r.Entropy,
|
Entropy: r.Entropy,
|
||||||
Tags: r.Tags,
|
Tags: r.Tags,
|
||||||
Allowlist: Allowlist{
|
Allowlist: Allowlist{
|
||||||
Regexes: allowlistRegexes,
|
Regexes: allowlistRegexes,
|
||||||
Paths: allowlistPaths,
|
Paths: allowlistPaths,
|
||||||
Commits: r.Allowlist.Commits,
|
Commits: r.Allowlist.Commits,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if r.Regex != nil && r.EntropyReGroup > r.Regex.NumSubexp() {
|
if r.Regex != nil && r.SecretGroup > r.Regex.NumSubexp() {
|
||||||
return Config{}, fmt.Errorf("%s invalid regex entropy group %d, max regex entropy group %d", r.Description, r.EntropyReGroup, r.Regex.NumSubexp())
|
return Config{}, fmt.Errorf("%s invalid regex secret group %d, max regex secret group %d", r.Description, r.SecretGroup, r.Regex.NumSubexp())
|
||||||
}
|
}
|
||||||
rules = append(rules, r)
|
rules = append(rules, r)
|
||||||
|
|
||||||
|
|||||||
+23
-34
@@ -74,13 +74,13 @@ func TestTranslate(t *testing.T) {
|
|||||||
cfg: Config{
|
cfg: Config{
|
||||||
Rules: []*Rule{
|
Rules: []*Rule{
|
||||||
{
|
{
|
||||||
Description: "Discord API key",
|
Description: "Discord API key",
|
||||||
Regex: regexp.MustCompile(`(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{64})['\"]`),
|
Regex: regexp.MustCompile(`(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{64})['\"]`),
|
||||||
RuleID: "discord-api-key",
|
RuleID: "discord-api-key",
|
||||||
Allowlist: Allowlist{},
|
Allowlist: Allowlist{},
|
||||||
Entropy: 3.5,
|
Entropy: 3.5,
|
||||||
EntropyReGroup: 3,
|
SecretGroup: 3,
|
||||||
Tags: []string{},
|
Tags: []string{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -88,7 +88,7 @@ func TestTranslate(t *testing.T) {
|
|||||||
{
|
{
|
||||||
cfgName: "bad_entropy_group",
|
cfgName: "bad_entropy_group",
|
||||||
cfg: Config{},
|
cfg: Config{},
|
||||||
wantError: fmt.Errorf("Discord API key invalid regex entropy group 5, max regex entropy group 3"),
|
wantError: fmt.Errorf("Discord API key invalid regex secret group 5, max regex secret group 3"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,45 +125,34 @@ func TestIncludeEntropy(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
rule: Rule{
|
rule: Rule{
|
||||||
RuleID: "generic-api-key",
|
RuleID: "generic-api-key",
|
||||||
EntropyReGroup: 4,
|
SecretGroup: 4,
|
||||||
Entropy: 3.5,
|
Entropy: 3.5,
|
||||||
Regex: regexp.MustCompile(`(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]`),
|
Regex: regexp.MustCompile(`(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]`),
|
||||||
},
|
},
|
||||||
secret: `Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`,
|
secret: `e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5`,
|
||||||
entropy: 3.7906235872459746,
|
entropy: 3.7906235872459746,
|
||||||
include: true,
|
include: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rule: Rule{
|
rule: Rule{
|
||||||
RuleID: "generic-api-key",
|
RuleID: "generic-api-key",
|
||||||
EntropyReGroup: 4,
|
SecretGroup: 4,
|
||||||
Entropy: 4,
|
Entropy: 4,
|
||||||
Regex: regexp.MustCompile(`(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]`),
|
Regex: regexp.MustCompile(`(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]`),
|
||||||
},
|
},
|
||||||
secret: `Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`,
|
secret: `e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5`,
|
||||||
entropy: 3.7906235872459746,
|
entropy: 3.7906235872459746,
|
||||||
include: false,
|
include: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rule: Rule{
|
rule: Rule{
|
||||||
RuleID: "generic-api-key",
|
RuleID: "generic-api-key",
|
||||||
EntropyReGroup: 4,
|
SecretGroup: 4,
|
||||||
Entropy: 3.0,
|
Entropy: 3.0,
|
||||||
Regex: regexp.MustCompile(`(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]`),
|
Regex: regexp.MustCompile(`(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]`),
|
||||||
},
|
},
|
||||||
secret: `KeyboardInteractiveName = "ssh-keyboard-interactive"`,
|
secret: `ssh-keyboard-interactive`,
|
||||||
entropy: 0,
|
|
||||||
include: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
rule: Rule{
|
|
||||||
RuleID: "generic-api-key",
|
|
||||||
EntropyReGroup: 4,
|
|
||||||
Entropy: 3.0,
|
|
||||||
Regex: regexp.MustCompile(`(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]`),
|
|
||||||
},
|
|
||||||
secret: `KeyboardInteractiveName = "ssh-keyboard-interactive"`,
|
|
||||||
entropy: 0,
|
entropy: 0,
|
||||||
include: false,
|
include: false,
|
||||||
},
|
},
|
||||||
|
|||||||
+100
-6
@@ -135,6 +135,7 @@ regex = '''\"type\": \"service_account\"'''
|
|||||||
id = "heroku-api-key"
|
id = "heroku-api-key"
|
||||||
description = "Heroku API Key"
|
description = "Heroku API Key"
|
||||||
regex = ''' (?i)(heroku[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})['\"]'''
|
regex = ''' (?i)(heroku[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
id = "slack-web-hook"
|
id = "slack-web-hook"
|
||||||
@@ -155,16 +156,19 @@ regex = '''AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}'''
|
|||||||
id = "facebook-token"
|
id = "facebook-token"
|
||||||
description = "Facebook token"
|
description = "Facebook token"
|
||||||
regex = '''(?i)(facebook[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{32})['\"]'''
|
regex = '''(?i)(facebook[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{32})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
id = "twitter-token"
|
id = "twitter-token"
|
||||||
description = "Twitter token"
|
description = "Twitter token"
|
||||||
regex = '''(?i)(twitter[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{35,44})['\"]'''
|
regex = '''(?i)(twitter[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{35,44})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
id = "adobe-client-id"
|
id = "adobe-client-id"
|
||||||
description = "Adobe Client ID (Oauth Web)"
|
description = "Adobe Client ID (Oauth Web)"
|
||||||
regex = '''(?i)(adobe[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{32})['\"]'''
|
regex = '''(?i)(adobe[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{32})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
id = "adobe-client-secret"
|
id = "adobe-client-secret"
|
||||||
@@ -180,265 +184,355 @@ regex = '''(LTAI)(?i)[a-z0-9]{20}'''
|
|||||||
id = "alibaba-secret-key"
|
id = "alibaba-secret-key"
|
||||||
description = "Alibaba Secret Key"
|
description = "Alibaba Secret Key"
|
||||||
regex = '''(?i)(alibaba[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{30})['\"]'''
|
regex = '''(?i)(alibaba[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{30})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
id = "asana-client-id"
|
id = "asana-client-id"
|
||||||
description = "Asana Client ID"
|
description = "Asana Client ID"
|
||||||
regex = '''(?i)(asana[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9]{16})['\"]'''
|
regex = '''(?i)(asana[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9]{16})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
id = "asana-client-secret"
|
id = "asana-client-secret"
|
||||||
description = "Asana Client Secret"
|
description = "Asana Client Secret"
|
||||||
regex = '''(?i)(asana[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{32})['\"]'''
|
regex = '''(?i)(asana[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{32})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
id = "atlassian-api-token"
|
id = "atlassian-api-token"
|
||||||
description = "Atlassian API token"
|
description = "Atlassian API token"
|
||||||
regex = '''(?i)(atlassian[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{24})['\"]'''
|
regex = '''(?i)(atlassian[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{24})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
id = "bitbucket-client-id"
|
id = "bitbucket-client-id"
|
||||||
description = "Bitbucket client ID"
|
description = "Bitbucket client ID"
|
||||||
regex = '''(?i)(bitbucket[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{32})['\"]'''
|
regex = '''(?i)(bitbucket[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{32})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "bitbucket-client-secret"
|
||||||
description = "Bitbucket client secret"
|
description = "Bitbucket client secret"
|
||||||
regex = '''(?i)(bitbucket[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9_\-]{64})['\"]'''
|
regex = '''(?i)(bitbucket[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9_\-]{64})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "beamer-api-token"
|
||||||
description = "Beamer API token"
|
description = "Beamer API token"
|
||||||
regex = '''(?i)(beamer[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"](b_[a-z0-9=_\-]{44})['\"]'''
|
regex = '''(?i)(beamer[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"](b_[a-z0-9=_\-]{44})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "clojars-api-token"
|
||||||
description = "Clojars API token"
|
description = "Clojars API token"
|
||||||
regex = '''(CLOJARS_)(?i)[a-z0-9]{60}'''
|
regex = '''(CLOJARS_)(?i)[a-z0-9]{60}'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "contentful-delivery-api-token"
|
||||||
description = "Contentful delivery API token"
|
description = "Contentful delivery API token"
|
||||||
regex = '''(?i)(contentful[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9\-=_]{43})['\"]'''
|
regex = '''(?i)(contentful[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9\-=_]{43})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "contentful-preview-api-token"
|
||||||
description = "Contentful preview API token"
|
description = "Contentful preview API token"
|
||||||
regex = '''(?i)(contentful[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9\-=_]{43})['\"]'''
|
regex = '''(?i)(contentful[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9\-=_]{43})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "databricks-api-token"
|
||||||
description = "Databricks API token"
|
description = "Databricks API token"
|
||||||
regex = '''dapi[a-h0-9]{32}'''
|
regex = '''dapi[a-h0-9]{32}'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "discord-api-token"
|
||||||
description = "Discord API key"
|
description = "Discord API key"
|
||||||
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{64})['\"]'''
|
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{64})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "discord-client-id"
|
||||||
description = "Discord client ID"
|
description = "Discord client ID"
|
||||||
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9]{18})['\"]'''
|
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9]{18})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "discord-client-secret"
|
||||||
description = "Discord client secret"
|
description = "Discord client secret"
|
||||||
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9=_\-]{32})['\"]'''
|
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9=_\-]{32})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "doppler-api-token"
|
||||||
description = "Doppler API token"
|
description = "Doppler API token"
|
||||||
regex = '''['\"](dp\.pt\.)(?i)[a-z0-9]{43}['\"]'''
|
regex = '''['\"](dp\.pt\.)(?i)[a-z0-9]{43}['\"]'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "dropbox-api-secret"
|
||||||
description = "Dropbox API secret/key"
|
description = "Dropbox API secret/key"
|
||||||
regex = '''(?i)(dropbox[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{15})['\"]'''
|
regex = '''(?i)(dropbox[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{15})['\"]'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "dropbox-sl-api-token"
|
||||||
description = "Dropbox short lived API token"
|
description = "Dropbox short lived API token"
|
||||||
regex = '''(?i)(dropbox[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"](sl\.[a-z0-9\-=_]{135})['\"]'''
|
regex = '''(?i)(dropbox[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"](sl\.[a-z0-9\-=_]{135})['\"]'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "dropbox-ll-api-token"
|
||||||
description = "Dropbox long lived API token"
|
description = "Dropbox long lived API token"
|
||||||
regex = '''(?i)(dropbox)(.{0,20})['\"](?i)[a-z0-9]{11}(AAAAAAAAAA)[a-z0-9-_=]{43}['\"]'''
|
regex = '''(?i)(dropbox)(.{0,20})['\"](?i)[a-z0-9]{11}(AAAAAAAAAA)[a-z0-9-_=]{43}['\"]'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "duffel-api-token"
|
||||||
description = "Duffel API token"
|
description = "Duffel API token"
|
||||||
regex = '''['\"]duffel_(test|live)_(?i)[a-z0-9_-]{43}['\"]'''
|
regex = '''['\"]duffel_(test|live)_(?i)[a-z0-9_-]{43}['\"]'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "dynatrace-api-token"
|
||||||
description = "Dynatrace API token"
|
description = "Dynatrace API token"
|
||||||
regex = '''['\"]dt0c01\.(?i)[a-z0-9]{24}\.[a-z0-9]{64}['\"]'''
|
regex = '''['\"]dt0c01\.(?i)[a-z0-9]{24}\.[a-z0-9]{64}['\"]'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "easypost-api-token"
|
||||||
description = "EasyPost API token"
|
description = "EasyPost API token"
|
||||||
regex = '''['\"]EZAK(?i)[a-z0-9]{54}['\"]'''
|
regex = '''['\"]EZAK(?i)[a-z0-9]{54}['\"]'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "easypost-test-api-token"
|
||||||
description = "EasyPost test API token"
|
description = "EasyPost test API token"
|
||||||
regex = '''['\"]EZTK(?i)[a-z0-9]{54}['\"]'''
|
regex = '''['\"]EZTK(?i)[a-z0-9]{54}['\"]'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "fastly-api-token"
|
||||||
description = "Fastly API token"
|
description = "Fastly API token"
|
||||||
regex = '''(?i)(fastly[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9\-=_]{32})['\"]'''
|
regex = '''(?i)(fastly[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9\-=_]{32})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "finicity-client-secret"
|
||||||
description = "Finicity client secret"
|
description = "Finicity client secret"
|
||||||
regex = '''(?i)(finicity[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{20})['\"]'''
|
regex = '''(?i)(finicity[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{20})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "finicity-api-token"
|
||||||
description = "Finicity API token"
|
description = "Finicity API token"
|
||||||
regex = '''(?i)(finicity[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{32})['\"]'''
|
regex = '''(?i)(finicity[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{32})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "flutterweave-public-key"
|
||||||
description = "Flutterweave public key"
|
description = "Flutterweave public key"
|
||||||
regex = '''FLWPUBK_TEST-(?i)[a-h0-9]{32}-X'''
|
regex = '''FLWPUBK_TEST-(?i)[a-h0-9]{32}-X'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "flutterweave-secret-key"
|
||||||
description = "Flutterweave secret key"
|
description = "Flutterweave secret key"
|
||||||
regex = '''FLWSECK_TEST-(?i)[a-h0-9]{32}-X'''
|
regex = '''FLWSECK_TEST-(?i)[a-h0-9]{32}-X'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "flutterweave-enc-key"
|
||||||
description = "Flutterweave encrypted key"
|
description = "Flutterweave encrypted key"
|
||||||
regex = '''FLWSECK_TEST[a-h0-9]{12}'''
|
regex = '''FLWSECK_TEST[a-h0-9]{12}'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "frameio-api-token"
|
||||||
description = "Frame.io API token"
|
description = "Frame.io API token"
|
||||||
regex = '''fio-u-(?i)[a-z0-9-_=]{64}'''
|
regex = '''fio-u-(?i)[a-z0-9-_=]{64}'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "gocardless-api-token"
|
||||||
description = "GoCardless API token"
|
description = "GoCardless API token"
|
||||||
regex = '''['\"]live_(?i)[a-z0-9-_=]{40}['\"]'''
|
regex = '''['\"]live_(?i)[a-z0-9-_=]{40}['\"]'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "grafana-api-token"
|
||||||
description = "Grafana API token"
|
description = "Grafana API token"
|
||||||
regex = '''['\"]eyJrIjoi(?i)[a-z0-9-_=]{72,92}['\"]'''
|
regex = '''['\"]eyJrIjoi(?i)[a-z0-9-_=]{72,92}['\"]'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "hashicorp-tf-api-token"
|
||||||
description = "Hashicorp Terraform user/org API token"
|
description = "Hashicorp Terraform user/org API token"
|
||||||
regex = '''['\"](?i)[a-z0-9]{14}\.atlasv1\.[a-z0-9-_=]{60,70}['\"]'''
|
regex = '''['\"](?i)[a-z0-9]{14}\.atlasv1\.[a-z0-9-_=]{60,70}['\"]'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "hubspot-api-token"
|
||||||
description = "Hubspot API token"
|
description = "Hubspot API token"
|
||||||
regex = '''(?i)(hubspot[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{8}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{12})['\"]'''
|
regex = '''(?i)(hubspot[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{8}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{12})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "intercom-api-token"
|
||||||
description = "Intercom API token"
|
description = "Intercom API token"
|
||||||
regex = '''(?i)(intercom[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9=_]{60})['\"]'''
|
regex = '''(?i)(intercom[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9=_]{60})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "intercom-client-secret"
|
||||||
description = "Intercom client secret/ID"
|
description = "Intercom client secret/ID"
|
||||||
regex = '''(?i)(intercom[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{8}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{12})['\"]'''
|
regex = '''(?i)(intercom[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{8}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{12})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "ionic-api-token"
|
||||||
description = "Ionic API token"
|
description = "Ionic API token"
|
||||||
regex = '''ion_(?i)[a-z0-9]{42}'''
|
regex = '''ion_(?i)[a-z0-9]{42}'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "linear-api-token"
|
||||||
description = "Linear API token"
|
description = "Linear API token"
|
||||||
regex = '''lin_api_(?i)[a-z0-9]{40}'''
|
regex = '''lin_api_(?i)[a-z0-9]{40}'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "linear-client-secret"
|
||||||
description = "Linear client secret/ID"
|
description = "Linear client secret/ID"
|
||||||
regex = '''(?i)(linear[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{32})['\"]'''
|
regex = '''(?i)(linear[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{32})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "lob-api-key"
|
||||||
description = "Lob API Key"
|
description = "Lob API Key"
|
||||||
regex = '''(?i)(lob[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]((live|test)_[a-f0-9]{35})['\"]'''
|
regex = '''(?i)(lob[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]((live|test)_[a-f0-9]{35})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "lob-pub-api-key"
|
||||||
description = "Lob Publishable API Key"
|
description = "Lob Publishable API Key"
|
||||||
regex = '''(?i)(lob[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]((test|live)_pub_[a-f0-9]{31})['\"]'''
|
regex = '''(?i)(lob[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]((test|live)_pub_[a-f0-9]{31})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "mailchimp-api-key"
|
||||||
description = "Mailchimp API key"
|
description = "Mailchimp API key"
|
||||||
regex = '''(?i)(mailchimp[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{32}-us20)['\"]'''
|
regex = '''(?i)(mailchimp[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-f0-9]{32}-us20)['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "mailgun-private-api-token"
|
||||||
description = "Mailgun private API token"
|
description = "Mailgun private API token"
|
||||||
regex = '''(?i)(mailgun[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"](key-[a-f0-9]{32})['\"]'''
|
regex = '''(?i)(mailgun[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"](key-[a-f0-9]{32})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "mailgun-pub-key"
|
||||||
description = "Mailgun public validation key"
|
description = "Mailgun public validation key"
|
||||||
regex = '''(?i)(mailgun[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"](pubkey-[a-f0-9]{32})['\"]'''
|
regex = '''(?i)(mailgun[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"](pubkey-[a-f0-9]{32})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "mailgun-signing-key"
|
||||||
description = "Mailgun webhook signing key"
|
description = "Mailgun webhook signing key"
|
||||||
regex = '''(?i)(mailgun[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8})['\"]'''
|
regex = '''(?i)(mailgun[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "mapbox-api-token"
|
||||||
description = "Mapbox API token"
|
description = "Mapbox API token"
|
||||||
regex = '''(?i)(pk\.[a-z0-9]{60}\.[a-z0-9]{22})'''
|
regex = '''(?i)(pk\.[a-z0-9]{60}\.[a-z0-9]{22})'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "messagebird-api-token"
|
||||||
description = "MessageBird API token"
|
description = "MessageBird API token"
|
||||||
regex = '''(?i)(messagebird[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{25})['\"]'''
|
regex = '''(?i)(messagebird[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{25})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "messagebird-client-id"
|
||||||
description = "MessageBird API client ID"
|
description = "MessageBird API client ID"
|
||||||
regex = '''(?i)(messagebird[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{8}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{12})['\"]'''
|
regex = '''(?i)(messagebird[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{8}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{12})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "new-relic-user-api-key"
|
||||||
description = "New Relic user API Key"
|
description = "New Relic user API Key"
|
||||||
regex = '''['\"](NRAK-[A-Z0-9]{27})['\"]'''
|
regex = '''['\"](NRAK-[A-Z0-9]{27})['\"]'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "new-relic-user-api-id"
|
||||||
description = "New Relic user API ID"
|
description = "New Relic user API ID"
|
||||||
regex = '''(?i)(newrelic[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([A-Z0-9]{64})['\"]'''
|
regex = '''(?i)(newrelic[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([A-Z0-9]{64})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "new-relic-browser-api-token"
|
||||||
description = "New Relic ingest browser API token"
|
description = "New Relic ingest browser API token"
|
||||||
regex = '''['\"](NRJS-[a-f0-9]{19})['\"]'''
|
regex = '''['\"](NRJS-[a-f0-9]{19})['\"]'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "npm-access-token"
|
||||||
description = "npm access token"
|
description = "npm access token"
|
||||||
regex = '''['\"](npm_(?i)[a-z0-9]{36})['\"]'''
|
regex = '''['\"](npm_(?i)[a-z0-9]{36})['\"]'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "planetscale-password"
|
||||||
description = "Planetscale password"
|
description = "Planetscale password"
|
||||||
regex = '''pscale_pw_(?i)[a-z0-9\-_\.]{43}'''
|
regex = '''pscale_pw_(?i)[a-z0-9\-_\.]{43}'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "planetscale-api-token"
|
||||||
description = "Planetscale API token"
|
description = "Planetscale API token"
|
||||||
regex = '''pscale_tkn_(?i)[a-z0-9\-_\.]{43}'''
|
regex = '''pscale_tkn_(?i)[a-z0-9\-_\.]{43}'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "postman-api-token"
|
||||||
description = "Postman API token"
|
description = "Postman API token"
|
||||||
regex = '''PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34}'''
|
regex = '''PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34}'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "pulumi-api-token"
|
||||||
description = "Pulumi API token"
|
description = "Pulumi API token"
|
||||||
regex = '''pul-[a-f0-9]{40}'''
|
regex = '''pul-[a-f0-9]{40}'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "rubygems-api-token"
|
||||||
description = "Rubygem API token"
|
description = "Rubygem API token"
|
||||||
regex = '''rubygems_[a-f0-9]{48}'''
|
regex = '''rubygems_[a-f0-9]{48}'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "sendgrid-api-token"
|
||||||
description = "Sendgrid API token"
|
description = "Sendgrid API token"
|
||||||
regex = '''SG\.(?i)[a-z0-9_\-\.]{66}'''
|
regex = '''SG\.(?i)[a-z0-9_\-\.]{66}'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "sendinblue-api-token"
|
||||||
description = "Sendinblue API token"
|
description = "Sendinblue API token"
|
||||||
regex = '''xkeysib-[a-f0-9]{64}\-(?i)[a-z0-9]{16}'''
|
regex = '''xkeysib-[a-f0-9]{64}\-(?i)[a-z0-9]{16}'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "shippo-api-token"
|
||||||
description = "Shippo API token"
|
description = "Shippo API token"
|
||||||
regex = '''shippo_(live|test)_[a-f0-9]{40}'''
|
regex = '''shippo_(live|test)_[a-f0-9]{40}'''
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "linedin-client-secret"
|
||||||
description = "Linkedin Client secret"
|
description = "Linkedin Client secret"
|
||||||
regex = '''(?i)(linkedin[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z]{16})['\"]'''
|
regex = '''(?i)(linkedin[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z]{16})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "linedin-client-id"
|
||||||
description = "Linkedin Client ID"
|
description = "Linkedin Client ID"
|
||||||
regex = '''(?i)(linkedin[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{14})['\"]'''
|
regex = '''(?i)(linkedin[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{14})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "twitch-api-token"
|
||||||
description = "Twitch API token"
|
description = "Twitch API token"
|
||||||
regex = '''(?i)(twitch[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{30})['\"]'''
|
regex = '''(?i)(twitch[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9]{30})['\"]'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
|
id = "typeform-api-token"
|
||||||
description = "Typeform API token"
|
description = "Typeform API token"
|
||||||
regex = '''(?i)(typeform[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}(tfp_[a-z0-9\-_\.=]{59})'''
|
regex = '''(?i)(typeform[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}(tfp_[a-z0-9\-_\.=]{59})'''
|
||||||
|
secretGroup = 3
|
||||||
|
|
||||||
# [[rules]]
|
[[rules]]
|
||||||
# id = "generic-api-key"
|
id = "generic-api-key"
|
||||||
# description = "Generic API Key"
|
description = "Generic API Key"
|
||||||
# regex = '''(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]'''
|
regex = '''(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]'''
|
||||||
# entropy = 3.7
|
entropy = 3.7
|
||||||
# entropyGroup = 4
|
secretGroup = 4
|
||||||
|
|
||||||
|
|
||||||
[allowlist]
|
[allowlist]
|
||||||
|
|||||||
+10
-16
@@ -6,23 +6,17 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Rule struct {
|
type Rule struct {
|
||||||
Description string
|
Description string
|
||||||
RuleID string
|
RuleID string
|
||||||
Entropy float64
|
Entropy float64
|
||||||
EntropyReGroup int
|
SecretGroup int
|
||||||
Regex *regexp.Regexp
|
Regex *regexp.Regexp
|
||||||
Path *regexp.Regexp
|
Path *regexp.Regexp
|
||||||
Tags []string
|
Tags []string
|
||||||
Allowlist Allowlist
|
Allowlist Allowlist
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Rule) IncludeEntropy(secret string) (bool, float64) {
|
func (r *Rule) IncludeEntropy(secret string) (bool, float64) {
|
||||||
groups := r.Regex.FindStringSubmatch(secret)
|
|
||||||
if len(groups)-1 > r.EntropyReGroup || len(groups) == 0 {
|
|
||||||
// Config validation should prevent this
|
|
||||||
return false, 0.0
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: this is a goofy hack to get around the fact there golang's regex engine
|
// NOTE: this is a goofy hack to get around the fact there golang's regex engine
|
||||||
// does not support positive lookaheads. Ideally we would want to add a
|
// does not support positive lookaheads. Ideally we would want to add a
|
||||||
// restriction on generic rules regex that requires the secret match group
|
// restriction on generic rules regex that requires the secret match group
|
||||||
@@ -30,12 +24,12 @@ func (r *Rule) IncludeEntropy(secret string) (bool, float64) {
|
|||||||
// check if the ruleid is prepended with "generic" and enforces the
|
// check if the ruleid is prepended with "generic" and enforces the
|
||||||
// secret contains both digits and alphabetical characters.
|
// secret contains both digits and alphabetical characters.
|
||||||
if strings.HasPrefix(r.RuleID, "generic") {
|
if strings.HasPrefix(r.RuleID, "generic") {
|
||||||
if !containsDigit(groups[r.EntropyReGroup]) {
|
if !containsDigit(secret) {
|
||||||
return false, 0.0
|
return false, 0.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// group = 0 will check the entropy of the whole regex match
|
// group = 0 will check the entropy of the whole regex match
|
||||||
e := shannonEntropy(groups[r.EntropyReGroup])
|
e := shannonEntropy(secret)
|
||||||
if e > r.Entropy {
|
if e > r.Entropy {
|
||||||
return true, e
|
return true, e
|
||||||
}
|
}
|
||||||
|
|||||||
+48
-5
@@ -6,6 +6,7 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/zricethezav/gitleaks/v8/config"
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
"github.com/zricethezav/gitleaks/v8/report"
|
"github.com/zricethezav/gitleaks/v8/report"
|
||||||
)
|
)
|
||||||
@@ -42,7 +43,7 @@ func DetectFindings(cfg config.Config, b []byte, filePath string, commit string)
|
|||||||
Description: r.Description,
|
Description: r.Description,
|
||||||
File: filePath,
|
File: filePath,
|
||||||
RuleID: r.RuleID,
|
RuleID: r.RuleID,
|
||||||
Context: fmt.Sprintf("file detected: %s", filePath),
|
Match: fmt.Sprintf("file detected: %s", filePath),
|
||||||
Tags: r.Tags,
|
Tags: r.Tags,
|
||||||
}
|
}
|
||||||
findings = append(findings, f)
|
findings = append(findings, f)
|
||||||
@@ -59,6 +60,7 @@ func DetectFindings(cfg config.Config, b []byte, filePath string, commit string)
|
|||||||
matchIndices := r.Regex.FindAllIndex(b, -1)
|
matchIndices := r.Regex.FindAllIndex(b, -1)
|
||||||
for _, m := range matchIndices {
|
for _, m := range matchIndices {
|
||||||
location := getLocation(linePairs, m[0], m[1])
|
location := getLocation(linePairs, m[0], m[1])
|
||||||
|
secret := strings.Trim(string(b[m[0]:m[1]]), "\n")
|
||||||
f := report.Finding{
|
f := report.Finding{
|
||||||
Description: r.Description,
|
Description: r.Description,
|
||||||
File: filePath,
|
File: filePath,
|
||||||
@@ -67,8 +69,8 @@ func DetectFindings(cfg config.Config, b []byte, filePath string, commit string)
|
|||||||
EndLine: location.endLine,
|
EndLine: location.endLine,
|
||||||
StartColumn: location.startColumn,
|
StartColumn: location.startColumn,
|
||||||
EndColumn: location.endColumn,
|
EndColumn: location.endColumn,
|
||||||
Secret: strings.Trim(string(b[m[0]:m[1]]), "\n"),
|
Secret: secret,
|
||||||
Context: limit(strings.Trim(string(b[location.startLineIndex:location.endLineIndex]), "\n")),
|
Match: secret,
|
||||||
Tags: r.Tags,
|
Tags: r.Tags,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,8 +78,20 @@ func DetectFindings(cfg config.Config, b []byte, filePath string, commit string)
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// extract secret from secret group if set
|
||||||
|
if r.SecretGroup != 0 {
|
||||||
|
groups := r.Regex.FindStringSubmatch(secret)
|
||||||
|
if len(groups)-1 > r.SecretGroup || len(groups) == 0 {
|
||||||
|
// Config validation should prevent this
|
||||||
|
break
|
||||||
|
}
|
||||||
|
secret = groups[r.SecretGroup]
|
||||||
|
f.Secret = secret
|
||||||
|
}
|
||||||
|
|
||||||
|
// extract secret from secret group if set
|
||||||
if r.EntropySet() {
|
if r.EntropySet() {
|
||||||
include, entropy := r.IncludeEntropy(strings.Trim(string(b[m[0]:m[1]]), "\n"))
|
include, entropy := r.IncludeEntropy(secret)
|
||||||
if include {
|
if include {
|
||||||
f.Entropy = float32(entropy)
|
f.Entropy = float32(entropy)
|
||||||
findings = append(findings, f)
|
findings = append(findings, f)
|
||||||
@@ -88,7 +102,7 @@ func DetectFindings(cfg config.Config, b []byte, filePath string, commit string)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return findings
|
return dedupe(findings)
|
||||||
}
|
}
|
||||||
|
|
||||||
func limit(s string) string {
|
func limit(s string) string {
|
||||||
@@ -103,3 +117,32 @@ func printFinding(f report.Finding) {
|
|||||||
b, _ = json.MarshalIndent(f, "", " ")
|
b, _ = json.MarshalIndent(f, "", " ")
|
||||||
fmt.Println(string(b))
|
fmt.Println(string(b))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func dedupe(findings []report.Finding) []report.Finding {
|
||||||
|
var retFindings []report.Finding
|
||||||
|
for _, f := range findings {
|
||||||
|
include := true
|
||||||
|
if strings.Contains(strings.ToLower(f.RuleID), "generic") {
|
||||||
|
for _, fPrime := range findings {
|
||||||
|
if f.StartLine == fPrime.StartLine &&
|
||||||
|
f.EndLine == fPrime.EndLine &&
|
||||||
|
f.Commit == fPrime.Commit &&
|
||||||
|
f.RuleID != fPrime.RuleID &&
|
||||||
|
strings.Contains(fPrime.Secret, f.Secret) &&
|
||||||
|
!strings.Contains(strings.ToLower(fPrime.RuleID), "generic") {
|
||||||
|
|
||||||
|
genericMatch := strings.Replace(f.Match, f.Secret, "REDACTED", -1)
|
||||||
|
betterMatch := strings.Replace(fPrime.Match, fPrime.Secret, "REDACTED", -1)
|
||||||
|
log.Debug().Msgf("skipping %s finding (%s), %s rule takes precendence (%s)", f.RuleID, genericMatch, fPrime.RuleID, betterMatch)
|
||||||
|
include = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if include {
|
||||||
|
retFindings = append(retFindings, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return retFindings
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ func TestDetectFindings(t *testing.T) {
|
|||||||
{
|
{
|
||||||
Description: "AWS Access Key",
|
Description: "AWS Access Key",
|
||||||
Secret: "AKIALALEMEL33243OLIA",
|
Secret: "AKIALALEMEL33243OLIA",
|
||||||
|
Match: "AKIALALEMEL33243OLIA",
|
||||||
File: "tmp.go",
|
File: "tmp.go",
|
||||||
RuleID: "aws-access-key",
|
RuleID: "aws-access-key",
|
||||||
Tags: []string{"key", "AWS"},
|
Tags: []string{"key", "AWS"},
|
||||||
@@ -62,7 +63,8 @@ func TestDetectFindings(t *testing.T) {
|
|||||||
expectedFindings: []report.Finding{
|
expectedFindings: []report.Finding{
|
||||||
{
|
{
|
||||||
Description: "Discord API key",
|
Description: "Discord API key",
|
||||||
Secret: "Discord_Public_Key = \"e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5\"",
|
Match: "Discord_Public_Key = \"e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5\"",
|
||||||
|
Secret: "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5",
|
||||||
File: "tmp.go",
|
File: "tmp.go",
|
||||||
RuleID: "discord-api-key",
|
RuleID: "discord-api-key",
|
||||||
Tags: []string{},
|
Tags: []string{},
|
||||||
@@ -83,7 +85,8 @@ func TestDetectFindings(t *testing.T) {
|
|||||||
expectedFindings: []report.Finding{
|
expectedFindings: []report.Finding{
|
||||||
{
|
{
|
||||||
Description: "Generic API Key",
|
Description: "Generic API Key",
|
||||||
Secret: "Key = \"e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5\"",
|
Match: "Key = \"e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5\"",
|
||||||
|
Secret: "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5",
|
||||||
File: "tmp.py",
|
File: "tmp.py",
|
||||||
RuleID: "generic-api-key",
|
RuleID: "generic-api-key",
|
||||||
Tags: []string{},
|
Tags: []string{},
|
||||||
@@ -98,7 +101,7 @@ func TestDetectFindings(t *testing.T) {
|
|||||||
expectedFindings: []report.Finding{
|
expectedFindings: []report.Finding{
|
||||||
{
|
{
|
||||||
Description: "Python Files",
|
Description: "Python Files",
|
||||||
Context: "file detected: tmp.py",
|
Match: "file detected: tmp.py",
|
||||||
File: "tmp.py",
|
File: "tmp.py",
|
||||||
RuleID: "python-files-only",
|
RuleID: "python-files-only",
|
||||||
Tags: []string{},
|
Tags: []string{},
|
||||||
@@ -110,7 +113,7 @@ func TestDetectFindings(t *testing.T) {
|
|||||||
bytes: []byte(`const Discord_Public_Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`),
|
bytes: []byte(`const Discord_Public_Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`),
|
||||||
filePath: "tmp.go",
|
filePath: "tmp.go",
|
||||||
expectedFindings: []report.Finding{},
|
expectedFindings: []report.Finding{},
|
||||||
wantError: fmt.Errorf("Discord API key invalid regex entropy group 5, max regex entropy group 3"),
|
wantError: fmt.Errorf("Discord API key invalid regex secret group 5, max regex secret group 3"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
cfgName: "simple",
|
cfgName: "simple",
|
||||||
@@ -148,10 +151,6 @@ func TestDetectFindings(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
findings := DetectFindings(cfg, tt.bytes, tt.filePath, tt.commit)
|
findings := DetectFindings(cfg, tt.bytes, tt.filePath, tt.commit)
|
||||||
for _, f := range findings {
|
|
||||||
f.Context = "" // remove lines cause copying and pasting them has some wack formatting
|
|
||||||
f.Date = ""
|
|
||||||
}
|
|
||||||
assert.ElementsMatch(t, tt.expectedFindings, findings)
|
assert.ElementsMatch(t, tt.expectedFindings, findings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ func TestFromFiles(t *testing.T) {
|
|||||||
EndLine: 19,
|
EndLine: 19,
|
||||||
StartColumn: 16,
|
StartColumn: 16,
|
||||||
EndColumn: 35,
|
EndColumn: 35,
|
||||||
Context: "\tawsToken := \"AKIALALEMEL33243OLIA\"",
|
Match: "AKIALALEMEL33243OLIA",
|
||||||
Secret: "AKIALALEMEL33243OLIA",
|
Secret: "AKIALALEMEL33243OLIA",
|
||||||
File: "../testdata/repos/nogit/main.go",
|
File: "../testdata/repos/nogit/main.go",
|
||||||
RuleID: "aws-access-key",
|
RuleID: "aws-access-key",
|
||||||
@@ -47,7 +47,7 @@ func TestFromFiles(t *testing.T) {
|
|||||||
EndLine: 19,
|
EndLine: 19,
|
||||||
StartColumn: 16,
|
StartColumn: 16,
|
||||||
EndColumn: 35,
|
EndColumn: 35,
|
||||||
Context: "\tawsToken := \"AKIALALEMEL33243OLIA\"",
|
Match: "AKIALALEMEL33243OLIA",
|
||||||
Secret: "AKIALALEMEL33243OLIA",
|
Secret: "AKIALALEMEL33243OLIA",
|
||||||
File: "../testdata/repos/nogit/main.go",
|
File: "../testdata/repos/nogit/main.go",
|
||||||
RuleID: "aws-access-key",
|
RuleID: "aws-access-key",
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@ func FromGit(files <-chan *gitdiff.File, cfg config.Config, outputOptions Option
|
|||||||
|
|
||||||
for _, fi := range DetectFindings(cfg, []byte(tf.Raw(gitdiff.OpAdd)), f.NewName, commitSHA) {
|
for _, fi := range DetectFindings(cfg, []byte(tf.Raw(gitdiff.OpAdd)), f.NewName, commitSHA) {
|
||||||
// don't add to start/end lines if finding is from a file only rule
|
// don't add to start/end lines if finding is from a file only rule
|
||||||
if !strings.HasPrefix(fi.Context, "file detected") {
|
if !strings.HasPrefix(fi.Match, "file detected") {
|
||||||
fi.StartLine += int(tf.NewPosition)
|
fi.StartLine += int(tf.NewPosition)
|
||||||
fi.EndLine += int(tf.NewPosition)
|
fi.EndLine += int(tf.NewPosition)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -119,7 +119,7 @@ func TestFromGit(t *testing.T) {
|
|||||||
|
|
||||||
findings := FromGit(files, cfg, tt.opts)
|
findings := FromGit(files, cfg, tt.opts)
|
||||||
for _, f := range findings {
|
for _, f := range findings {
|
||||||
f.Context = "" // remove lines cause copying and pasting them has some wack formatting
|
f.Match = "" // remove lines cause copying and pasting them has some wack formatting
|
||||||
f.Date = ""
|
f.Date = ""
|
||||||
}
|
}
|
||||||
assert.ElementsMatch(t, tt.expectedFindings, findings)
|
assert.ElementsMatch(t, tt.expectedFindings, findings)
|
||||||
|
|||||||
+2
-2
@@ -17,7 +17,7 @@ func writeCsv(f []*Finding, w io.WriteCloser) error {
|
|||||||
"Commit",
|
"Commit",
|
||||||
"File",
|
"File",
|
||||||
"Secret",
|
"Secret",
|
||||||
"Context",
|
"Match",
|
||||||
"StartLine",
|
"StartLine",
|
||||||
"EndLine",
|
"EndLine",
|
||||||
"StartColumn",
|
"StartColumn",
|
||||||
@@ -35,7 +35,7 @@ func writeCsv(f []*Finding, w io.WriteCloser) error {
|
|||||||
f.Commit,
|
f.Commit,
|
||||||
f.File,
|
f.File,
|
||||||
f.Secret,
|
f.Secret,
|
||||||
f.Context,
|
f.Match,
|
||||||
strconv.Itoa(f.StartLine),
|
strconv.Itoa(f.StartLine),
|
||||||
strconv.Itoa(f.EndLine),
|
strconv.Itoa(f.EndLine),
|
||||||
strconv.Itoa(f.StartColumn),
|
strconv.Itoa(f.StartColumn),
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ func TestWriteCSV(t *testing.T) {
|
|||||||
findings: []*Finding{
|
findings: []*Finding{
|
||||||
{
|
{
|
||||||
RuleID: "test-rule",
|
RuleID: "test-rule",
|
||||||
Context: "line containing secret",
|
Match: "line containing secret",
|
||||||
Secret: "a secret",
|
Secret: "a secret",
|
||||||
StartLine: 1,
|
StartLine: 1,
|
||||||
EndLine: 2,
|
EndLine: 2,
|
||||||
|
|||||||
+2
-2
@@ -11,7 +11,7 @@ type Finding struct {
|
|||||||
StartColumn int
|
StartColumn int
|
||||||
EndColumn int
|
EndColumn int
|
||||||
|
|
||||||
Context string
|
Match string
|
||||||
|
|
||||||
// Secret contains the full content of what is matched in
|
// Secret contains the full content of what is matched in
|
||||||
// the tree-sitter query.
|
// the tree-sitter query.
|
||||||
@@ -37,6 +37,6 @@ type Finding struct {
|
|||||||
|
|
||||||
// Redact removes sensitive information from a finding.
|
// Redact removes sensitive information from a finding.
|
||||||
func (f *Finding) Redact() {
|
func (f *Finding) Redact() {
|
||||||
f.Context = strings.Replace(f.Context, f.Secret, "REDACTED", -1)
|
f.Match = strings.Replace(f.Match, f.Secret, "REDACTED", -1)
|
||||||
f.Secret = "REDACT"
|
f.Secret = "REDACT"
|
||||||
}
|
}
|
||||||
@@ -11,8 +11,8 @@ func TestRedact(t *testing.T) {
|
|||||||
redact: true,
|
redact: true,
|
||||||
findings: []Finding{
|
findings: []Finding{
|
||||||
{
|
{
|
||||||
Secret: "line containing secret",
|
Secret: "line containing secret",
|
||||||
Context: "secret",
|
Match: "secret",
|
||||||
},
|
},
|
||||||
}},
|
}},
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ func TestWriteJSON(t *testing.T) {
|
|||||||
|
|
||||||
Description: "",
|
Description: "",
|
||||||
RuleID: "test-rule",
|
RuleID: "test-rule",
|
||||||
Context: "line containing secret",
|
Match: "line containing secret",
|
||||||
Secret: "a secret",
|
Secret: "a secret",
|
||||||
StartLine: 1,
|
StartLine: 1,
|
||||||
EndLine: 2,
|
EndLine: 2,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ func TestWriteSarif(t *testing.T) {
|
|||||||
|
|
||||||
Description: "",
|
Description: "",
|
||||||
RuleID: "test-rule",
|
RuleID: "test-rule",
|
||||||
Context: "line containing secret",
|
Match: "line containing secret",
|
||||||
Secret: "a secret",
|
Secret: "a secret",
|
||||||
StartLine: 1,
|
StartLine: 1,
|
||||||
EndLine: 2,
|
EndLine: 2,
|
||||||
|
|||||||
+1
-1
@@ -4,5 +4,5 @@ title = "gitleaks config"
|
|||||||
id = "discord-api-key"
|
id = "discord-api-key"
|
||||||
description = "Discord API key"
|
description = "Discord API key"
|
||||||
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{64})['\"]'''
|
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{64})['\"]'''
|
||||||
entropyGroup = 5
|
secretGroup = 5
|
||||||
entropy = 3.5
|
entropy = 3.5
|
||||||
Vendored
+1
-1
@@ -4,5 +4,5 @@ title = "gitleaks config"
|
|||||||
id = "discord-api-key"
|
id = "discord-api-key"
|
||||||
description = "Discord API key"
|
description = "Discord API key"
|
||||||
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{64})['\"]'''
|
regex = '''(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{64})['\"]'''
|
||||||
entropyGroup = 3
|
secretGroup = 3
|
||||||
entropy = 3.5
|
entropy = 3.5
|
||||||
Vendored
+1
-1
@@ -5,4 +5,4 @@ description = "Generic API Key"
|
|||||||
id = "generic-api-key"
|
id = "generic-api-key"
|
||||||
regex = '''(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]'''
|
regex = '''(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]'''
|
||||||
entropy = 3.7
|
entropy = 3.7
|
||||||
entropyGroup = 4
|
secretGroup = 4
|
||||||
+1
-1
@@ -6,4 +6,4 @@ id = "generic-api-key"
|
|||||||
regex = '''(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]'''
|
regex = '''(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]'''
|
||||||
path = '''.py'''
|
path = '''.py'''
|
||||||
entropy = 3.7
|
entropy = 3.7
|
||||||
entropyGroup = 4
|
secretGroup = 4
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
RuleID,Commit,File,Secret,Context,StartLine,EndLine,StartColumn,EndColumn,Author,Message,Date,Email
|
RuleID,Commit,File,Secret,Match,StartLine,EndLine,StartColumn,EndColumn,Author,Message,Date,Email
|
||||||
test-rule,0000000000000000,auth.py,a secret,line containing secret,1,2,1,2,John Doe,opps,10-19-2003,johndoe@gmail.com
|
test-rule,0000000000000000,auth.py,a secret,line containing secret,1,2,1,2,John Doe,opps,10-19-2003,johndoe@gmail.com
|
||||||
|
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
"EndLine": 2,
|
"EndLine": 2,
|
||||||
"StartColumn": 1,
|
"StartColumn": 1,
|
||||||
"EndColumn": 2,
|
"EndColumn": 2,
|
||||||
"Context": "line containing secret",
|
"Match": "line containing secret",
|
||||||
"Secret": "a secret",
|
"Secret": "a secret",
|
||||||
"File": "auth.py",
|
"File": "auth.py",
|
||||||
"Commit": "0000000000000000",
|
"Commit": "0000000000000000",
|
||||||
|
|||||||
Reference in new issue
Block a user