mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 04:34:46 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a62cc52aba | ||
|
|
f93e5dc844 | ||
|
|
8481f0e9cd | ||
|
|
82f7d61593 | ||
|
|
a42b32bdf1 | ||
|
|
79638b080c | ||
|
|
3474c58c9e | ||
|
|
d8cd93cabe | ||
|
|
48b79facfa | ||
|
|
e23f7f58f3 | ||
|
|
606bb1a13b | ||
|
|
e784980515 | ||
|
|
c33ee3f252 | ||
|
|
b0a958f55e | ||
|
|
237b03af18 | ||
|
|
f348991d21 | ||
|
|
e0745adbd2 | ||
|
|
1ddc924a67 | ||
|
|
0b07625567 |
No files matched your search
@@ -9,7 +9,10 @@
|
|||||||
*.got
|
*.got
|
||||||
gitleaks
|
gitleaks
|
||||||
build
|
build
|
||||||
|
|
||||||
|
# configs
|
||||||
.gitleaks.toml
|
.gitleaks.toml
|
||||||
|
cmd/generate/config/gitleaks.toml
|
||||||
|
|
||||||
# Test binary
|
# Test binary
|
||||||
*.out
|
*.out
|
||||||
|
|||||||
@@ -4,3 +4,8 @@
|
|||||||
entry: gitleaks protect --verbose --redact --staged
|
entry: gitleaks protect --verbose --redact --staged
|
||||||
language: golang
|
language: golang
|
||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
|
- id: gitleaks-docker
|
||||||
|
name: Detect hardcoded secrets
|
||||||
|
description: Detect hardcoded secrets using Gitleaks
|
||||||
|
entry: zricethezav/gitleaks protect --verbose --redact --staged
|
||||||
|
language: docker_image
|
||||||
+14
-2
@@ -1,12 +1,24 @@
|
|||||||
FROM golang:1.17 AS build
|
FROM golang:1.18 AS build
|
||||||
WORKDIR /go/src/github.com/zricethezav/gitleaks
|
WORKDIR /go/src/github.com/zricethezav/gitleaks
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN VERSION=$(git describe --tags --abbrev=0) && \
|
RUN VERSION=$(git describe --tags --abbrev=0) && \
|
||||||
CGO_ENABLED=0 go build -o bin/gitleaks -ldflags "-X="github.com/zricethezav/gitleaks/v8/cmd.Version=${VERSION}
|
CGO_ENABLED=0 go build -o bin/gitleaks -ldflags "-X="github.com/zricethezav/gitleaks/v8/cmd.Version=${VERSION}
|
||||||
|
|
||||||
FROM alpine:3.14.2
|
FROM alpine:3.15.4
|
||||||
RUN adduser -D gitleaks && \
|
RUN adduser -D gitleaks && \
|
||||||
apk add --no-cache bash git openssh-client
|
apk add --no-cache bash git openssh-client
|
||||||
COPY --from=build /go/src/github.com/zricethezav/gitleaks/bin/* /usr/bin/
|
COPY --from=build /go/src/github.com/zricethezav/gitleaks/bin/* /usr/bin/
|
||||||
USER gitleaks
|
USER gitleaks
|
||||||
|
|
||||||
|
# default to avoid the follow error:
|
||||||
|
# 11:09PM ERR fatal: unsafe repository ('/path' is owned by someone else)
|
||||||
|
# 11:09PM ERR To add an exception for this directory, call:
|
||||||
|
# 11:09PM ERR
|
||||||
|
# 11:09PM ERR git config --global --add safe.directory /path
|
||||||
|
# This means that when you run gitleaks from docker you must mount to /path
|
||||||
|
# in order to avoid this error.
|
||||||
|
|
||||||
|
# TODO waiting to push this until I've thought a bit more about it
|
||||||
|
# RUN git config --global --add safe.directory /path
|
||||||
|
|
||||||
ENTRYPOINT ["gitleaks"]
|
ENTRYPOINT ["gitleaks"]
|
||||||
@@ -41,7 +41,7 @@ brew install gitleaks
|
|||||||
docker pull zricethezav/gitleaks:latest
|
docker pull zricethezav/gitleaks:latest
|
||||||
docker run -v ${path_to_host_folder_to_scan}:/path zricethezav/gitleaks:latest [COMMAND] --source="/path" [OPTIONS]
|
docker run -v ${path_to_host_folder_to_scan}:/path zricethezav/gitleaks:latest [COMMAND] --source="/path" [OPTIONS]
|
||||||
```
|
```
|
||||||
#### ghrc.io
|
#### ghcr.io
|
||||||
```bash
|
```bash
|
||||||
docker pull ghcr.io/zricethezav/gitleaks:latest
|
docker pull ghcr.io/zricethezav/gitleaks:latest
|
||||||
docker run -v ${path_to_host_folder_to_scan}:/path zricethezav/gitleaks:latest [COMMAND] --source="/path" [OPTIONS]
|
docker run -v ${path_to_host_folder_to_scan}:/path zricethezav/gitleaks:latest [COMMAND] --source="/path" [OPTIONS]
|
||||||
@@ -62,13 +62,15 @@ make build
|
|||||||
### Pre-Commit
|
### Pre-Commit
|
||||||
1. Install pre-commit from https://pre-commit.com/#install
|
1. Install pre-commit from https://pre-commit.com/#install
|
||||||
2. Create a `.pre-commit-config.yaml` file at the root of your repository with the following content:
|
2. Create a `.pre-commit-config.yaml` file at the root of your repository with the following content:
|
||||||
```
|
```
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/zricethezav/gitleaks
|
- repo: https://github.com/zricethezav/gitleaks
|
||||||
rev: v8.2.0
|
rev: v8.2.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: gitleaks
|
- id: gitleaks
|
||||||
```
|
```
|
||||||
|
for a [native execution of GitLeaks](https://github.com/zricethezav/gitleaks/releases) or use the [`gitleaks-docker` pre-commit ID](https://github.com/zricethezav/gitleaks/blob/master/.pre-commit-hooks.yaml) for executing GitLeaks using the [official Docker images](#docker)
|
||||||
|
|
||||||
3. Install with `pre-commit install`
|
3. Install with `pre-commit install`
|
||||||
4. Now you're all set!
|
4. Now you're all set!
|
||||||
```
|
```
|
||||||
@@ -225,19 +227,37 @@ 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
|
||||||
|
|
||||||
|
# Keywords are used for pre-regex check filtering. Rules that contain
|
||||||
|
# keywords will perform a quick string compare check to make sure the
|
||||||
|
# keyword(s) are in the content being scanned. Ideally these values should
|
||||||
|
# either be part of the idenitifer or unique strings specific to the rule's regex
|
||||||
|
# (introduced in v8.6.0)
|
||||||
|
keywords = [
|
||||||
|
"auth",
|
||||||
|
"password",
|
||||||
|
"token",
|
||||||
|
]
|
||||||
|
|
||||||
# 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
|
||||||
# with known/rotated secrets
|
# with known/rotated secrets
|
||||||
[rules.allowlist]
|
[rules.allowlist]
|
||||||
description = "ignore commit A"
|
description = "ignore commit A"
|
||||||
commits = [ "commit-A", "commit-B"]
|
commits = [ "commit-A", "commit-B"]
|
||||||
paths = [
|
paths = [
|
||||||
'''go\.mod''',
|
'''go\.mod''',
|
||||||
'''go\.sum'''
|
'''go\.sum'''
|
||||||
]
|
]
|
||||||
regexes = [
|
regexes = [
|
||||||
'''process''',
|
'''process''',
|
||||||
'''getenv''',
|
'''getenv''',
|
||||||
]
|
]
|
||||||
|
# note: stopwords targets the extracted secret, not the entire regex match
|
||||||
|
# like 'regexes' does. (stopwords introduced in 8.8.0)
|
||||||
|
stopwords = [
|
||||||
|
'''client''',
|
||||||
|
'''endpoint''',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
# This is a global allowlist which has a higher order of precedence than rule-specific allowlists.
|
# This is a global allowlist which has a higher order of precedence than rule-specific allowlists.
|
||||||
# If a commit listed in the `commits` field below is encountered then that commit will be skipped and no
|
# If a commit listed in the `commits` field below is encountered then that commit will be skipped and no
|
||||||
@@ -246,13 +266,19 @@ regexes = [
|
|||||||
description = "global allow list"
|
description = "global allow list"
|
||||||
commits = [ "commit-A", "commit-B", "commit-C"]
|
commits = [ "commit-A", "commit-B", "commit-C"]
|
||||||
paths = [
|
paths = [
|
||||||
'''gitleaks\.toml''',
|
'''gitleaks\.toml''',
|
||||||
'''(.*?)(jpg|gif|doc)'''
|
'''(.*?)(jpg|gif|doc)'''
|
||||||
]
|
]
|
||||||
regexes = [
|
regexes = [
|
||||||
'''219-09-9999''',
|
'''219-09-9999''',
|
||||||
'''078-05-1120''',
|
'''078-05-1120''',
|
||||||
'''(9[0-9]{2}|666)-\d{2}-\d{4}''',
|
'''(9[0-9]{2}|666)-\d{2}-\d{4}''',
|
||||||
|
]
|
||||||
|
# note: stopwords targets the extracted secret, not the entire regex match
|
||||||
|
# like 'regexes' does. (stopwords introduced in 8.8.0)
|
||||||
|
stopwords = [
|
||||||
|
'''client''',
|
||||||
|
'''endpoint''',
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
Refer to the default [gitleaks config](https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml) for examples and advice on writing regular expressions for secret detection.
|
Refer to the default [gitleaks config](https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml) for examples and advice on writing regular expressions for secret detection.
|
||||||
|
|||||||
@@ -0,0 +1,119 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"text/template"
|
||||||
|
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/rules"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
templatePath = "rules/config.tmpl"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
configRules := []*config.Rule{}
|
||||||
|
configRules = append(configRules, rules.AdobeClientID())
|
||||||
|
configRules = append(configRules, rules.AdobeClientSecret())
|
||||||
|
configRules = append(configRules, rules.AgeSecretKey())
|
||||||
|
configRules = append(configRules, rules.AlibabaAccessKey())
|
||||||
|
configRules = append(configRules, rules.AlibabaSecretKey())
|
||||||
|
configRules = append(configRules, rules.AsanaClientID())
|
||||||
|
configRules = append(configRules, rules.AsanaClientSecret())
|
||||||
|
configRules = append(configRules, rules.Atlassian())
|
||||||
|
configRules = append(configRules, rules.AWS())
|
||||||
|
configRules = append(configRules, rules.BitBucketClientID())
|
||||||
|
configRules = append(configRules, rules.BitBucketClientSecret())
|
||||||
|
configRules = append(configRules, rules.Beamer())
|
||||||
|
configRules = append(configRules, rules.Clojars())
|
||||||
|
configRules = append(configRules, rules.Contentful())
|
||||||
|
configRules = append(configRules, rules.Databricks())
|
||||||
|
configRules = append(configRules, rules.DiscordAPIToken())
|
||||||
|
configRules = append(configRules, rules.DiscordClientID())
|
||||||
|
configRules = append(configRules, rules.DiscordClientSecret())
|
||||||
|
configRules = append(configRules, rules.DropBoxAPISecret())
|
||||||
|
configRules = append(configRules, rules.DropBoxLongLivedAPIToken())
|
||||||
|
configRules = append(configRules, rules.DropBoxShortLivedAPIToken())
|
||||||
|
configRules = append(configRules, rules.Doppler())
|
||||||
|
configRules = append(configRules, rules.Duffel())
|
||||||
|
configRules = append(configRules, rules.Dynatrace())
|
||||||
|
configRules = append(configRules, rules.EasyPost())
|
||||||
|
configRules = append(configRules, rules.EasyPostTestAPI())
|
||||||
|
configRules = append(configRules, rules.Facebook())
|
||||||
|
configRules = append(configRules, rules.FastlyAPIToken())
|
||||||
|
configRules = append(configRules, rules.FinicityClientSecret())
|
||||||
|
configRules = append(configRules, rules.FinicityAPIToken())
|
||||||
|
configRules = append(configRules, rules.FlutterwavePublicKey())
|
||||||
|
configRules = append(configRules, rules.FlutterwaveSecretKey())
|
||||||
|
configRules = append(configRules, rules.FlutterwaveSecretKey())
|
||||||
|
configRules = append(configRules, rules.FrameIO())
|
||||||
|
configRules = append(configRules, rules.GoCardless())
|
||||||
|
// TODO figure out what makes sense for GCP
|
||||||
|
// configRules = append(configRules, rules.GCPServiceAccount())
|
||||||
|
configRules = append(configRules, rules.GitHubPat())
|
||||||
|
configRules = append(configRules, rules.GitHubOauth())
|
||||||
|
configRules = append(configRules, rules.GitHubApp())
|
||||||
|
configRules = append(configRules, rules.GitHubRefresh())
|
||||||
|
configRules = append(configRules, rules.Gitlab())
|
||||||
|
configRules = append(configRules, rules.Hashicorp())
|
||||||
|
configRules = append(configRules, rules.Heroku())
|
||||||
|
configRules = append(configRules, rules.HubSpot())
|
||||||
|
configRules = append(configRules, rules.Intercom())
|
||||||
|
configRules = append(configRules, rules.LinearAPIToken())
|
||||||
|
configRules = append(configRules, rules.LinearClientSecret())
|
||||||
|
configRules = append(configRules, rules.LinkedinClientID())
|
||||||
|
configRules = append(configRules, rules.LinkedinClientSecret())
|
||||||
|
configRules = append(configRules, rules.LobAPIToken())
|
||||||
|
configRules = append(configRules, rules.LobPubAPIToken())
|
||||||
|
configRules = append(configRules, rules.MailChimp())
|
||||||
|
configRules = append(configRules, rules.MailGunPubAPIToken())
|
||||||
|
configRules = append(configRules, rules.MailGunPrivateAPIToken())
|
||||||
|
configRules = append(configRules, rules.MailGunSigningKey())
|
||||||
|
configRules = append(configRules, rules.MapBox())
|
||||||
|
configRules = append(configRules, rules.MessageBirdAPIToken())
|
||||||
|
configRules = append(configRules, rules.MessageBirdClientID())
|
||||||
|
configRules = append(configRules, rules.NewRelicUserID())
|
||||||
|
configRules = append(configRules, rules.NewRelicUserKey())
|
||||||
|
configRules = append(configRules, rules.NewRelicBrowserAPIKey())
|
||||||
|
configRules = append(configRules, rules.NPM())
|
||||||
|
configRules = append(configRules, rules.PlanetScalePassword())
|
||||||
|
configRules = append(configRules, rules.PlanetScaleToken())
|
||||||
|
configRules = append(configRules, rules.PostManAPI())
|
||||||
|
configRules = append(configRules, rules.PrivateKey())
|
||||||
|
configRules = append(configRules, rules.PulumiAPIToken())
|
||||||
|
configRules = append(configRules, rules.PyPiUploadToken())
|
||||||
|
configRules = append(configRules, rules.RubyGemsAPIToken())
|
||||||
|
configRules = append(configRules, rules.SendGridAPIToken())
|
||||||
|
configRules = append(configRules, rules.SendInBlueAPIToken())
|
||||||
|
configRules = append(configRules, rules.ShippoAPIToken())
|
||||||
|
configRules = append(configRules, rules.ShopifyAccessToken())
|
||||||
|
configRules = append(configRules, rules.ShopifyCustomAccessToken())
|
||||||
|
configRules = append(configRules, rules.ShopifyPrivateAppAccessToken())
|
||||||
|
configRules = append(configRules, rules.ShopifySharedSecret())
|
||||||
|
configRules = append(configRules, rules.SlackAccessToken())
|
||||||
|
configRules = append(configRules, rules.SlackWebHook())
|
||||||
|
configRules = append(configRules, rules.StripeAccessToken())
|
||||||
|
configRules = append(configRules, rules.Twilio())
|
||||||
|
configRules = append(configRules, rules.TwitchAPIToken())
|
||||||
|
configRules = append(configRules, rules.Twitter())
|
||||||
|
configRules = append(configRules, rules.Typeform())
|
||||||
|
configRules = append(configRules, rules.GenericCredential())
|
||||||
|
|
||||||
|
config := config.Config{
|
||||||
|
Rules: configRules,
|
||||||
|
}
|
||||||
|
tmpl, err := template.ParseFiles(templatePath)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal().Err(err).Msg("Failed to parse template")
|
||||||
|
}
|
||||||
|
|
||||||
|
f, err := os.Create("gitleaks.toml")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal().Err(err).Msg("Failed to create rules.toml")
|
||||||
|
}
|
||||||
|
tmpl.Execute(f, config)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func AdobeClientID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Adobe Client ID (Oauth Web)",
|
||||||
|
RuleID: "adobe-client-id",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"adobe"}, hex("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"adobe"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("adobe", secrets.NewSecret(hex("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func AdobeClientSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Adobe Client Secret",
|
||||||
|
RuleID: "adobe-client-secret",
|
||||||
|
Regex: generateUniqueTokenRegex(`(p8e-)(?i)[a-z0-9]{32}`),
|
||||||
|
Keywords: []string{"p8e-"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
"adobeClient := \"p8e-" + secrets.NewSecret(hex("32")) + "\"",
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func AgeSecretKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Age secret key",
|
||||||
|
RuleID: "age secret key",
|
||||||
|
Regex: regexp.MustCompile(`AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}`),
|
||||||
|
Keywords: []string{"AGE-SECRET-KEY-1"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
`apiKey := "AGE-SECRET-KEY-1QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ`, // gitleaks:allow
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func AlibabaAccessKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Alibaba AccessKey ID",
|
||||||
|
RuleID: "alibaba-access-key-id",
|
||||||
|
Regex: generateUniqueTokenRegex(`(LTAI)(?i)[a-z0-9]{20}`),
|
||||||
|
Keywords: []string{"LTAI"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
"alibabaKey := \"LTAI" + secrets.NewSecret(hex("20")) + "\"",
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
func AlibabaSecretKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Alibaba Secret Key",
|
||||||
|
RuleID: "alibaba-secret-key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"alibaba"},
|
||||||
|
alphaNumeric("30")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"alibaba"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("alibaba", secrets.NewSecret(alphaNumeric("30"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func AsanaClientID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Asana Client ID",
|
||||||
|
RuleID: "asana-client-id",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"asana"}, numeric("16")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"asana"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("asana", secrets.NewSecret(numeric("16"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func AsanaClientSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Asana Client Secret",
|
||||||
|
RuleID: "asana-client-secret",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"asana"}, alphaNumeric("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"asana"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("asana", secrets.NewSecret(alphaNumeric("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Atlassian() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Atlassian API token",
|
||||||
|
RuleID: "atlassian-api-token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"atlassian", "confluence"}, alphaNumeric("24")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"atlassian", "confluence"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("atlassian", secrets.NewSecret(alphaNumeric("24"))),
|
||||||
|
generateSampleSecret("confluence", secrets.NewSecret(alphaNumeric("24"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func AWS() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := 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}"),
|
||||||
|
Keywords: []string{
|
||||||
|
"AKIA",
|
||||||
|
"AGPA",
|
||||||
|
"AIDA",
|
||||||
|
"AROA",
|
||||||
|
"AIPA",
|
||||||
|
"ANPA",
|
||||||
|
"ANVA",
|
||||||
|
"ASIA",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{generateSampleSecret("AWS", "AKIALALEMEL33243OLIB")} // gitleaks:allow
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Beamer() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Beamer API token",
|
||||||
|
RuleID: "beamer-api-token",
|
||||||
|
SecretGroup: 1,
|
||||||
|
Regex: generateSemiGenericRegex([]string{"beamer"},
|
||||||
|
`b_[a-z0-9=_\-]{44}`),
|
||||||
|
Keywords: []string{"beamer"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("beamer", "b_"+secrets.NewSecret(alphaNumericExtended("44"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func BitBucketClientID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "BitBucket Client ID",
|
||||||
|
RuleID: "bitbucket-client-id",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"bitbucket"}, alphaNumeric("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"bitbucket"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("bitbucket", secrets.NewSecret(alphaNumeric("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func BitBucketClientSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "BitBucket Client Secret",
|
||||||
|
RuleID: "bitbucket-client-secret",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"bitbucket"}, alphaNumericExtended("64")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"bitbucket"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("bitbucket", secrets.NewSecret(alphaNumeric("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Clojars() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Clojars API token",
|
||||||
|
RuleID: "clojars-api-token",
|
||||||
|
Regex: regexp.MustCompile(`(?i)(CLOJARS_)[a-z0-9]{60}`),
|
||||||
|
Keywords: []string{"clojars"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("clojars", "CLOJARS_"+secrets.NewSecret(alphaNumeric("60"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
# This is the default gitleaks configuration file.
|
||||||
|
# Rules and allowlists are defined within this file.
|
||||||
|
# Rules instruct gitleaks on what should be considered a secret.
|
||||||
|
# Allowlists instruct gitleaks on what is allowed, i.e. not a secret.
|
||||||
|
title = "gitleaks config"
|
||||||
|
|
||||||
|
[allowlist]
|
||||||
|
description = "global allow lists"
|
||||||
|
regexes = [
|
||||||
|
'''219-09-9999''',
|
||||||
|
'''078-05-1120''',
|
||||||
|
'''(9[0-9]{2}|666)-\d{2}-\d{4}''',
|
||||||
|
]
|
||||||
|
paths = [
|
||||||
|
'''gitleaks.toml''',
|
||||||
|
'''(.*?)(jpg|gif|doc|pdf|bin|svg|socket)$''',
|
||||||
|
'''(go.mod|go.sum)$'''
|
||||||
|
]
|
||||||
|
|
||||||
|
{{ range $i, $rule := .Rules }}[[rules]]
|
||||||
|
{{ if and $rule.SecretGroup $rule.Entropy $rule.Allowlist.StopWords }}description = "{{$rule.Description}}"
|
||||||
|
id = "{{$rule.RuleID}}"
|
||||||
|
regex = '''{{$rule.Regex}}'''
|
||||||
|
secretGroup = {{ $rule.SecretGroup }}
|
||||||
|
entropy = {{ $rule.Entropy}}
|
||||||
|
keywords = [
|
||||||
|
{{ range $j, $keyword := $rule.Keywords }}"{{$keyword}}",{{end}}
|
||||||
|
]
|
||||||
|
[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}}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Contentful() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Contentful delivery API token",
|
||||||
|
RuleID: "contentful-delivery-api-token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"contentful"},
|
||||||
|
alphaNumericExtended("43")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"contentful"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("contentful", secrets.NewSecret(alphaNumeric("43"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Databricks() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Databricks API token",
|
||||||
|
RuleID: "databricks-api-token",
|
||||||
|
Regex: generateUniqueTokenRegex(`dapi[a-h0-9]{32}`),
|
||||||
|
Keywords: []string{"dapi"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("databricks", "dapi"+secrets.NewSecret(hex("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func DiscordAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Discord API key",
|
||||||
|
RuleID: "discord-api-token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"discord"}, hex("64")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"discord"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("discord", secrets.NewSecret(hex("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func DiscordClientID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Discord client ID",
|
||||||
|
RuleID: "discord-client-id",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"discord"}, numeric("18")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"discord"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("discord", secrets.NewSecret(numeric("18"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func DiscordClientSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Discord client secret",
|
||||||
|
RuleID: "discord-client-secret",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"discord"}, alphaNumericExtended("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"discord"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("discord", secrets.NewSecret(numeric("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Doppler() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Doppler API token",
|
||||||
|
RuleID: "doppler-api-token",
|
||||||
|
Regex: regexp.MustCompile(`(dp\.pt\.)(?i)[a-z0-9]{43}`),
|
||||||
|
Keywords: []string{"doppler"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("doppler", "dp.pt."+secrets.NewSecret(alphaNumeric("43"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO add additional doppler formats:
|
||||||
|
// https://docs.doppler.com/reference/auth-token-formats
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func DropBoxAPISecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Dropbox API secret",
|
||||||
|
RuleID: "doppler-api-token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"dropbox"}, alphaNumeric("15")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"dropbox"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("dropbox", secrets.NewSecret(alphaNumeric("15"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func DropBoxShortLivedAPIToken() *config.Rule {
|
||||||
|
// define 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}`),
|
||||||
|
Keywords: []string{"dropbox"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate TODO
|
||||||
|
return &r
|
||||||
|
}
|
||||||
|
|
||||||
|
func DropBoxLongLivedAPIToken() *config.Rule {
|
||||||
|
// define 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}`),
|
||||||
|
Keywords: []string{"dropbox"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate TODO
|
||||||
|
return &r
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Duffel() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "duffel-api-token",
|
||||||
|
Description: "Duffel API token",
|
||||||
|
Regex: regexp.MustCompile(`duffel_(test|live)_(?i)[a-z0-9_\-=]{43}`),
|
||||||
|
Keywords: []string{"duffel"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("duffel", "duffel_test_"+secrets.NewSecret(alphaNumericExtended("43"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Dynatrace() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Dynatrace API token",
|
||||||
|
RuleID: "dynatrace-api-token",
|
||||||
|
Regex: regexp.MustCompile(`dt0c01\.(?i)[a-z0-9]{24}\.[a-z0-9]{64}`),
|
||||||
|
Keywords: []string{"dynatrace"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("dynatrace", "dt0c01."+secrets.NewSecret(alphaNumeric("24"))+"."+secrets.NewSecret(alphaNumeric("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func EasyPost() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "EasyPost API token",
|
||||||
|
RuleID: "easypost-api-token",
|
||||||
|
Regex: regexp.MustCompile(`EZAK(?i)[a-z0-9]{54}`),
|
||||||
|
Keywords: []string{"EZAK"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("EZAK", "EZAK"+secrets.NewSecret(alphaNumeric("54"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func EasyPostTestAPI() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "EasyPost test API token",
|
||||||
|
RuleID: "easypost-test-api-token",
|
||||||
|
Regex: regexp.MustCompile(`EZTK(?i)[a-z0-9]{54}`),
|
||||||
|
Keywords: []string{"EZTK"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("EZTK", "EZTK"+secrets.NewSecret(alphaNumeric("54"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Facebook() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "facebook",
|
||||||
|
RuleID: "facebook",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"facebook"}, hex("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"facebook"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("facebook", secrets.NewSecret(hex("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func FastlyAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Fastly API key",
|
||||||
|
RuleID: "fastly-api-token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"fastly"}, alphaNumericExtended("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"fastly"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("fastly", secrets.NewSecret(alphaNumericExtended("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func FinicityClientSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Finicity Client Secret",
|
||||||
|
RuleID: "finicity-client-secret",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"finicity"}, alphaNumeric("20")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"finicity"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("finicity", secrets.NewSecret(alphaNumeric("20"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func FinicityAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Finicity API token",
|
||||||
|
RuleID: "finicity-api-token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"finicity"}, hex("32")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"finicity"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("finicity", secrets.NewSecret(hex("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func FlutterwavePublicKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Finicity Public Key",
|
||||||
|
RuleID: "flutterwave-public-key",
|
||||||
|
Regex: regexp.MustCompile(`FLWPUBK_TEST-(?i)[a-h0-9]{32}-X`),
|
||||||
|
Keywords: []string{"FLWPUBK_TEST"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("flutterwavePubKey", "FLWPUBK_TEST-"+secrets.NewSecret(hex("32"))+"-X"),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func FlutterwaveSecretKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Finicity Secret Key",
|
||||||
|
RuleID: "flutterwave-public-key",
|
||||||
|
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{32}-X`),
|
||||||
|
Keywords: []string{"FLWSECK_TEST"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("flutterwavePubKey", "FLWSECK_TEST-"+secrets.NewSecret(hex("32"))+"-X"),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func FlutterwaveEncKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Finicity Secret Key",
|
||||||
|
RuleID: "flutterwave-public-key",
|
||||||
|
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{12}`),
|
||||||
|
Keywords: []string{"FLWSECK_TEST"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("flutterwavePubKey", "FLWSECK_TEST-"+secrets.NewSecret(hex("12"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func FrameIO() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Frame.io API token",
|
||||||
|
RuleID: "frameio-api-token",
|
||||||
|
Regex: regexp.MustCompile(`fio-u-(?i)[a-z0-9\-_=]{64}`),
|
||||||
|
Keywords: []string{"fio-u-"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("frameio", "fio-u-"+secrets.NewSecret(alphaNumericExtended("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TODO this one could probably use some work
|
||||||
|
func GCPServiceAccount() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Google (GCP) Service-account",
|
||||||
|
RuleID: "gcp-service-account",
|
||||||
|
Regex: regexp.MustCompile(`\"type\": \"service_account\"`),
|
||||||
|
Keywords: []string{`\"type\": \"service_account\"`},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
`"type": "service_account"`,
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GenericCredential() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "generic-api-key",
|
||||||
|
Description: "Generic API Key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"key",
|
||||||
|
"api[^Version]",
|
||||||
|
"token",
|
||||||
|
"pat",
|
||||||
|
"secret",
|
||||||
|
"client",
|
||||||
|
"password",
|
||||||
|
"auth",
|
||||||
|
}, `[0-9a-z\-_.=]{10,150}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"key",
|
||||||
|
"api",
|
||||||
|
"token",
|
||||||
|
"secret",
|
||||||
|
"client",
|
||||||
|
"pat",
|
||||||
|
"password",
|
||||||
|
"auth",
|
||||||
|
},
|
||||||
|
Entropy: 3.5,
|
||||||
|
Allowlist: config.Allowlist{
|
||||||
|
StopWords: DefaultStopWords,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("generic", "CLOJARS_34bf0e88955ff5a1c328d6a7491acc4f48e865a7b8dd4d70a70749037443"),
|
||||||
|
generateSampleSecret("generic", "Zf3D0LXCM3EIMbgJpUNnkRtOfOueHznB"),
|
||||||
|
`"client_id" : "0afae57f3ccfd9d7f5767067bc48b30f719e271ba470488056e37ab35d4b6506"`,
|
||||||
|
`"client_secret" : "6da89121079f83b2eb6acccf8219ea982c3d79bccc3e9c6a85856480661f8fde",`,
|
||||||
|
}
|
||||||
|
fps := []string{
|
||||||
|
`client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.client-vpn-endpoint.id`,
|
||||||
|
}
|
||||||
|
return validate(r, tps, fps)
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GitHubPat() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "GitHub Personal Access Token",
|
||||||
|
RuleID: "github-pat",
|
||||||
|
Regex: regexp.MustCompile(`ghp_[0-9a-zA-Z]{36}`),
|
||||||
|
Keywords: []string{"ghp_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("github", "ghp_"+secrets.NewSecret(alphaNumeric("36"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GitHubOauth() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "GitHub OAuth Access Token",
|
||||||
|
RuleID: "github-oauth",
|
||||||
|
Regex: regexp.MustCompile(`gho_[0-9a-zA-Z]{36}`),
|
||||||
|
Keywords: []string{"gho_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("github", "gho_"+secrets.NewSecret(alphaNumeric("36"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GitHubApp() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "GitHub App Token",
|
||||||
|
RuleID: "github-app-token",
|
||||||
|
Regex: regexp.MustCompile(`(ghu|ghs)_[0-9a-zA-Z]{36}`),
|
||||||
|
Keywords: []string{"ghu_", "ghs_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("github", "ghu_"+secrets.NewSecret(alphaNumeric("36"))),
|
||||||
|
generateSampleSecret("github", "ghs_"+secrets.NewSecret(alphaNumeric("36"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GitHubRefresh() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "GitHub Refresh Token",
|
||||||
|
RuleID: "github-refresh-token",
|
||||||
|
Regex: regexp.MustCompile(`ghr_[0-9a-zA-Z]{36}`),
|
||||||
|
Keywords: []string{"ghr_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("github", "ghr_"+secrets.NewSecret(alphaNumeric("36"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Gitlab() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Gitlab Personal Access Token",
|
||||||
|
RuleID: "gitlab-pat",
|
||||||
|
Regex: regexp.MustCompile(`glpat-[0-9a-zA-Z\-\_]{20}`),
|
||||||
|
Keywords: []string{"glpat-"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("gitlab", "glpat-"+secrets.NewSecret(alphaNumeric("20"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GoCardless() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "gocardless-api-token",
|
||||||
|
Description: "GoCardless API token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"gocardless"}, `live_(?i)[a-z0-9\-_=]{40}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"live_",
|
||||||
|
"gocardless",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("gocardless", "live_"+secrets.NewSecret(alphaNumericExtended("40"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Hashicorp() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "HashiCorp Terraform user/org API token",
|
||||||
|
RuleID: "hashicorp-tf-api-token",
|
||||||
|
Regex: regexp.MustCompile(`(?i)[a-z0-9]{14}\.atlasv1\.[a-z0-9\-_=]{60,70}`),
|
||||||
|
Keywords: []string{"atlasv1"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("hashicorpToken", secrets.NewSecret(hex("14"))+".atlasv1."+secrets.NewSecret(alphaNumericExtended("60,70"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Heroku() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Heroku API Key",
|
||||||
|
RuleID: "heroku-api-key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"heroku"},
|
||||||
|
`[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"heroku"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
`const HEROKU_KEY = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func HubSpot() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := 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"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
`const hubspotKey = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Intercom() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Intercom API Token",
|
||||||
|
RuleID: "intercom-api-key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"intercom"}, alphaNumericExtended("60")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"intercom"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("intercom", secrets.NewSecret(alphaNumericExtended("60"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func LinearAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Linear API Token",
|
||||||
|
RuleID: "linear-api-key",
|
||||||
|
Regex: regexp.MustCompile(`lin_api_(?i)[a-z0-9]{40}`),
|
||||||
|
Keywords: []string{"lin_api_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("linear", "lin_api_"+secrets.NewSecret(alphaNumeric("40"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LinearClientSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Linear Client Secret",
|
||||||
|
RuleID: "linear-client-secret",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"linear"}, hex("32")),
|
||||||
|
Keywords: []string{"linear"},
|
||||||
|
SecretGroup: 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("linear", secrets.NewSecret(hex("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func LinkedinClientSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "linkedin-client-secret",
|
||||||
|
Description: "LinkedIn Client secret",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"linkedin",
|
||||||
|
"linked-in",
|
||||||
|
}, alphaNumeric("16")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"linkedin",
|
||||||
|
"linked-in",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("linkedin", secrets.NewSecret(alphaNumeric("16"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LinkedinClientID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "linkedin-client-id",
|
||||||
|
Description: "LinkedIn Client ID",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"linkedin",
|
||||||
|
"linked-in",
|
||||||
|
}, alphaNumeric("14")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"linkedin",
|
||||||
|
"linked-in",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("linkedin", secrets.NewSecret(alphaNumeric("14"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func LobPubAPIToken() *config.Rule {
|
||||||
|
// define 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,
|
||||||
|
Keywords: []string{
|
||||||
|
"test_pub",
|
||||||
|
"live_pub",
|
||||||
|
"_pub",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("lob", "test_pub_"+secrets.NewSecret(hex("31"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LobAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Lob API Key",
|
||||||
|
RuleID: "lob-api-key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"lob"}, `(live|test)_[a-f0-9]{35}`),
|
||||||
|
Keywords: []string{
|
||||||
|
"test_",
|
||||||
|
"live_",
|
||||||
|
},
|
||||||
|
SecretGroup: 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("lob", "test_"+secrets.NewSecret(hex("35"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func MailChimp() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "mailchimp-api-key",
|
||||||
|
Description: "Mailchimp API key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"mailchimp"}, `[a-f0-9]{32}-us20`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"mailchimp",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("mailchimp", secrets.NewSecret(hex("32"))+"-us20"),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func MailGunPrivateAPIToken() *config.Rule {
|
||||||
|
// define 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,
|
||||||
|
Keywords: []string{
|
||||||
|
"mailgun",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("mailgun", "key-"+secrets.NewSecret(hex("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func MailGunPubAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "mailgun-pub-key",
|
||||||
|
Description: "Mailgun public validation key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"mailgun"}, `pubkey-[a-f0-9]{32}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"mailgun",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("mailgun", "pubkey-"+secrets.NewSecret(hex("32"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func MailGunSigningKey() *config.Rule {
|
||||||
|
// define 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,
|
||||||
|
Keywords: []string{
|
||||||
|
"mailgun",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("mailgun", secrets.NewSecret(hex("32"))+"-00001111-22223333"),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func MapBox() *config.Rule {
|
||||||
|
// define 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"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("mapbox", "pk."+secrets.NewSecret(alphaNumeric("60"))+"."+secrets.NewSecret(alphaNumeric("22"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func MessageBirdAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "MessageBird API token",
|
||||||
|
RuleID: "messagebird-api-token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"messagebird",
|
||||||
|
"message-bird",
|
||||||
|
"message_bird",
|
||||||
|
}, alphaNumeric("25")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"messagebird",
|
||||||
|
"message-bird",
|
||||||
|
"message_bird",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("messagebird", secrets.NewSecret(alphaNumeric("25"))),
|
||||||
|
generateSampleSecret("message-bird", secrets.NewSecret(alphaNumeric("25"))),
|
||||||
|
generateSampleSecret("message_bird", secrets.NewSecret(alphaNumeric("25"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func MessageBirdClientID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "MessageBird client ID",
|
||||||
|
RuleID: "messagebird-client-id",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"messagebird",
|
||||||
|
"message-bird",
|
||||||
|
"message_bird",
|
||||||
|
}, `[a-h0-9]{8}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{4}-[a-h0-9]{12}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"messagebird",
|
||||||
|
"message-bird",
|
||||||
|
"message_bird",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
`const MessageBirdClientID = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewRelicUserID() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "new-relic-user-api-key",
|
||||||
|
Description: "New Relic user API Key",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"new-relic",
|
||||||
|
"newrelic",
|
||||||
|
"new_relic",
|
||||||
|
}, `NRAK-[a-z0-9]{27}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"NRAK",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("new-relic", "NRAK-"+secrets.NewSecret(alphaNumeric("27"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRelicUserKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "new-relic-user-api-id",
|
||||||
|
Description: "New Relic user API ID",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"new-relic",
|
||||||
|
"newrelic",
|
||||||
|
"new_relic",
|
||||||
|
}, alphaNumeric("64")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"new-relic",
|
||||||
|
"newrelic",
|
||||||
|
"new_relic",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("new-relic", secrets.NewSecret(alphaNumeric("64"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRelicBrowserAPIKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "new-relic-browser-api-token",
|
||||||
|
Description: "New Relic ingest browser API token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{
|
||||||
|
"new-relic",
|
||||||
|
"newrelic",
|
||||||
|
"new_relic",
|
||||||
|
}, `NRJS-[a-f0-9]{19}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"NRJS-",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("new-relic", "NRJS-"+secrets.NewSecret(hex("19"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NPM() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "npm-access-token",
|
||||||
|
Description: "npm access token",
|
||||||
|
Regex: generateUniqueTokenRegex(`npm_[a-z0-9]{36}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"npm_",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("npmAccessToken", "npm_"+secrets.NewSecret(alphaNumeric("36"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func PlanetScalePassword() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "planetscale-password",
|
||||||
|
Description: "PlanetScale password",
|
||||||
|
Regex: generateUniqueTokenRegex(`pscale_pw_(?i)[a-z0-9=\-_\.]{43}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"pscale_pw_",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("planetScalePassword", "pscale_pw_"+secrets.NewSecret(alphaNumericExtended("43"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func PlanetScaleToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "planetscale-api-token",
|
||||||
|
Description: "PlanetScale API token",
|
||||||
|
Regex: generateUniqueTokenRegex(`pscale_tkn_(?i)[a-z0-9=\-_\.]{43}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"pscale_tkn_",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("planetScalePassword", "pscale_tkn_"+secrets.NewSecret(alphaNumericExtended("43"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func PostManAPI() *config.Rule {
|
||||||
|
// define 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,
|
||||||
|
Keywords: []string{
|
||||||
|
"PMAK-",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("postmanAPItoken", "PMAK-"+secrets.NewSecret(hex("24"))+"-"+secrets.NewSecret(hex("34"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func PrivateKey() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Private Key",
|
||||||
|
RuleID: "private-key",
|
||||||
|
Regex: regexp.MustCompile(`(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY-----[\s\S-]*KEY----`),
|
||||||
|
Keywords: []string{"-----BEGIN PRIVATE"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{`-----BEGIN PRIVATE KEY-----
|
||||||
|
anything
|
||||||
|
-----END PRIVATE KEY-----`} // gitleaks:allow
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func PulumiAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "pulumi-api-token",
|
||||||
|
Description: "Pulumi API token",
|
||||||
|
Regex: generateUniqueTokenRegex(`pul-[a-f0-9]{40}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"pul-",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("pulumi-api-token", "pul-"+secrets.NewSecret(hex("40"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func PyPiUploadToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "PyPI upload token",
|
||||||
|
RuleID: "pypi-upload-token",
|
||||||
|
Regex: regexp.MustCompile(
|
||||||
|
`pypi-AgEIcHlwaS5vcmc[A-Za-z0-9\-_]{50,1000}`),
|
||||||
|
Keywords: []string{
|
||||||
|
"pypi-AgEIcHlwaS5vcmc",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{"pypiToken := \"pypi-AgEIcHlwaS5vcmc" + secrets.NewSecret(hex("32")) +
|
||||||
|
secrets.NewSecret(hex("32")) + "\""}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func RubyGemsAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "rubygems-api-token",
|
||||||
|
Description: "Rubygem API token",
|
||||||
|
Regex: generateUniqueTokenRegex(`rubygems_[a-f0-9]{48}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"rubygems_",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("rubygemsAPIToken", "rubygems_"+secrets.NewSecret(hex("48"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/detect"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// case insensitive prefix
|
||||||
|
caseInsensitive = `(?i)`
|
||||||
|
|
||||||
|
// identifier prefix (just an ignore group)
|
||||||
|
identifierPrefix = `(?:`
|
||||||
|
identifierSuffix = `)(?:[0-9a-z\-_\s.]{0,20})(?:[\s|']|[\s|"]){0,3}`
|
||||||
|
|
||||||
|
// commonly used assignment operators or function call
|
||||||
|
operator = `(?:=|>|:=|\|\|:|<=|=>|:)`
|
||||||
|
|
||||||
|
// boundaries for the secret
|
||||||
|
// \x60 = `
|
||||||
|
secretPrefixUnique = `\b(`
|
||||||
|
secretPrefix = `(?:'|\"|\s|=|\x60){0,5}(`
|
||||||
|
secretSuffix = `)(?:['|\"|\n|\r|\s|\x60]|$)`
|
||||||
|
)
|
||||||
|
|
||||||
|
func generateSemiGenericRegex(identifiers []string, secretRegex string) *regexp.Regexp {
|
||||||
|
var sb strings.Builder
|
||||||
|
sb.WriteString(caseInsensitive)
|
||||||
|
sb.WriteString(identifierPrefix)
|
||||||
|
sb.WriteString(strings.Join(identifiers, "|"))
|
||||||
|
sb.WriteString(identifierSuffix)
|
||||||
|
sb.WriteString(operator)
|
||||||
|
sb.WriteString(secretPrefix)
|
||||||
|
sb.WriteString(secretRegex)
|
||||||
|
sb.WriteString(secretSuffix)
|
||||||
|
return regexp.MustCompile(sb.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
func generateUniqueTokenRegex(secretRegex string) *regexp.Regexp {
|
||||||
|
var sb strings.Builder
|
||||||
|
sb.WriteString(caseInsensitive)
|
||||||
|
sb.WriteString(secretPrefixUnique)
|
||||||
|
sb.WriteString(secretRegex)
|
||||||
|
sb.WriteString(secretSuffix)
|
||||||
|
return regexp.MustCompile(sb.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
func generateSampleSecret(identifier string, secret string) string {
|
||||||
|
return fmt.Sprintf("%s_api_token = \"%s\"", identifier, secret)
|
||||||
|
}
|
||||||
|
|
||||||
|
func validate(r config.Rule, truePositives []string, falsePositives []string) *config.Rule {
|
||||||
|
// normalize keywords like in the config package
|
||||||
|
var keywords []string
|
||||||
|
for _, k := range r.Keywords {
|
||||||
|
keywords = append(keywords, strings.ToLower(k))
|
||||||
|
}
|
||||||
|
r.Keywords = keywords
|
||||||
|
|
||||||
|
d := detect.NewDetector(config.Config{
|
||||||
|
Rules: []*config.Rule{&r},
|
||||||
|
Keywords: keywords,
|
||||||
|
})
|
||||||
|
for _, tp := range truePositives {
|
||||||
|
if len(d.DetectString(tp)) != 1 {
|
||||||
|
log.Fatal().Msgf("Failed to validate (tp) %s %s", r.RuleID, tp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, fp := range falsePositives {
|
||||||
|
if len(d.DetectString(fp)) != 0 {
|
||||||
|
log.Fatal().Msgf("Failed to validate (fp) %s", r.RuleID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return &r
|
||||||
|
}
|
||||||
|
|
||||||
|
func numeric(size string) string {
|
||||||
|
return fmt.Sprintf(`[0-9]{%s}`, size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func hex(size string) string {
|
||||||
|
return fmt.Sprintf(`[a-f0-9]{%s}`, size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func alphaNumeric(size string) string {
|
||||||
|
return fmt.Sprintf(`[a-z0-9]{%s}`, size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func alphaNumericExtended(size string) string {
|
||||||
|
return fmt.Sprintf(`[a-z0-9=_\-]{%s}`, size)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SendGridAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "sendgrid-api-token",
|
||||||
|
Description: "SendGrid API token",
|
||||||
|
Regex: generateUniqueTokenRegex(`SG\.(?i)[a-z0-9=_\-\.]{66}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"SG.",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("sengridAPIToken", "SG."+secrets.NewSecret(alphaNumericExtended("66"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SendInBlueAPIToken() *config.Rule {
|
||||||
|
// define 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,
|
||||||
|
Keywords: []string{
|
||||||
|
"xkeysib-",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("sendinblue", "xkeysib-"+secrets.NewSecret(hex("64"))+"-"+secrets.NewSecret(alphaNumeric("16"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ShippoAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "shippo-api-token",
|
||||||
|
Description: "Shippo API token",
|
||||||
|
Regex: generateUniqueTokenRegex(`shippo_(live|test)_[a-f0-9]{40}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"shippo_",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("shippo", "shippo_live_"+secrets.NewSecret(hex("40"))),
|
||||||
|
generateSampleSecret("shippo", "shippo_test_"+secrets.NewSecret(hex("40"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ShopifySharedSecret() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Shopify shared secret",
|
||||||
|
RuleID: "shopify-shared-secret",
|
||||||
|
Regex: regexp.MustCompile(`shpss_[a-fA-F0-9]{32}`),
|
||||||
|
Keywords: []string{"shpss_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{"shopifySecret := \"shpss_" + secrets.NewSecret(hex("32")) + "\""}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ShopifyAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Shopify access token",
|
||||||
|
RuleID: "shopify-access-token",
|
||||||
|
Regex: regexp.MustCompile(`shpat_[a-fA-F0-9]{32}`),
|
||||||
|
Keywords: []string{"shpat_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{"shopifyToken := \"shpat_" + secrets.NewSecret(hex("32")) + "\""}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ShopifyCustomAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Shopify custom access token",
|
||||||
|
RuleID: "shopify-custom-access-token",
|
||||||
|
Regex: regexp.MustCompile(`shpca_[a-fA-F0-9]{32}`),
|
||||||
|
Keywords: []string{"shpca_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{"shopifyToken := \"shpca_" + secrets.NewSecret(hex("32")) + "\""}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ShopifyPrivateAppAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Shopify private app access token",
|
||||||
|
RuleID: "shopify-private-app-access-token",
|
||||||
|
Regex: regexp.MustCompile(`shppa_[a-fA-F0-9]{32}`),
|
||||||
|
Keywords: []string{"shppa_"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{"shopifyToken := \"shppa_" + secrets.NewSecret(hex("32")) + "\""}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SlackAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Slack token",
|
||||||
|
RuleID: "slack-access-token",
|
||||||
|
Regex: regexp.MustCompile(
|
||||||
|
"xox[baprs]-([0-9a-zA-Z]{10,48})"),
|
||||||
|
Keywords: []string{
|
||||||
|
"xoxb",
|
||||||
|
"xoxa",
|
||||||
|
"xoxp",
|
||||||
|
"xoxr",
|
||||||
|
"xoxs",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
"\"slackToken\": \"xoxb-" + secrets.NewSecret(alphaNumeric("30")) + "\"",
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func SlackWebHook() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Slack Webhook",
|
||||||
|
RuleID: "slack-web-hook",
|
||||||
|
Regex: regexp.MustCompile(
|
||||||
|
`https:\/\/hooks.slack.com\/services\/[A-Za-z0-9+\/]{44,46}`),
|
||||||
|
Keywords: []string{
|
||||||
|
"hooks.slack.com",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
"https://hooks.slack.com/services/" + secrets.NewSecret(alphaNumeric("44")), // gitleaks:allow
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,27 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func StripeAccessToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Stripe",
|
||||||
|
RuleID: "stripe-access-token",
|
||||||
|
Regex: regexp.MustCompile(`(?i)(sk|pk)_(test|live)_[0-9a-z]{10,32}`),
|
||||||
|
Keywords: []string{
|
||||||
|
"sk_test",
|
||||||
|
"pk_test",
|
||||||
|
"sk_live",
|
||||||
|
"pk_live",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{"stripeToken := \"sk_test_" + secrets.NewSecret(alphaNumeric("30")) + "\""}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Twilio() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "Twilio API Key",
|
||||||
|
RuleID: "twilio-api-key",
|
||||||
|
Regex: regexp.MustCompile(`SK[0-9a-fA-F]{32}`),
|
||||||
|
Keywords: []string{"twilio"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
"twilioAPIKey := \"SK" + secrets.NewSecret(hex("32")) + "\"",
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TwitchAPIToken() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "twitch-api-token",
|
||||||
|
Description: "Twitch API token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"twitch"}, alphaNumeric("30")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"twitch",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("twitch", secrets.NewSecret(alphaNumeric("30"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Twitter() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
Description: "twitter",
|
||||||
|
RuleID: "twitter",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"twitter"}, hex("35,44")),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{"twitter"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
"twitterToken := \"" + secrets.NewSecret(hex("36")) + "aaaa\"",
|
||||||
|
"twitterToken := `" + secrets.NewSecret(hex("36")) + "aaaa`",
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package rules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||||
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Typeform() *config.Rule {
|
||||||
|
// define rule
|
||||||
|
r := config.Rule{
|
||||||
|
RuleID: "typeform-api-token",
|
||||||
|
Description: "Typeform API token",
|
||||||
|
Regex: generateSemiGenericRegex([]string{"typeform"},
|
||||||
|
`tfp_[a-z0-9\-_\.=]{59}`),
|
||||||
|
SecretGroup: 1,
|
||||||
|
Keywords: []string{
|
||||||
|
"tfp_",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
tps := []string{
|
||||||
|
generateSampleSecret("typeformAPIToken", "tfp_"+secrets.NewSecret(alphaNumericExtended("59"))),
|
||||||
|
}
|
||||||
|
return validate(r, tps, nil)
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// Package reggen generates text based on regex definitions
|
||||||
|
// This is a slightly altered version of https://github.com/lucasjones/reggen
|
||||||
|
package secrets
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/lucasjones/reggen"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewSecret(regex string) string {
|
||||||
|
g, err := reggen.NewGenerator(regex)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return g.Generate(1)
|
||||||
|
}
|
||||||
+19
-1
@@ -1,6 +1,9 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
import "regexp"
|
import (
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
// Allowlist allows a rule to be ignored for specific
|
// Allowlist allows a rule to be ignored for specific
|
||||||
// regexes, paths, and/or commits
|
// regexes, paths, and/or commits
|
||||||
@@ -16,6 +19,11 @@ type Allowlist struct {
|
|||||||
|
|
||||||
// Commits is a slice of commit SHAs that are allowed to be ignored.
|
// Commits is a slice of commit SHAs that are allowed to be ignored.
|
||||||
Commits []string
|
Commits []string
|
||||||
|
|
||||||
|
// StopWords is a slice of stop words that are allowed to be ignored.
|
||||||
|
// This targets the _secret_, not the content of the regex match like the
|
||||||
|
// Regexes slice.
|
||||||
|
StopWords []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// CommitAllowed returns true if the commit is allowed to be ignored.
|
// CommitAllowed returns true if the commit is allowed to be ignored.
|
||||||
@@ -40,3 +48,13 @@ func (a *Allowlist) PathAllowed(path string) bool {
|
|||||||
func (a *Allowlist) RegexAllowed(s string) bool {
|
func (a *Allowlist) RegexAllowed(s string) bool {
|
||||||
return anyRegexMatch(s, a.Regexes)
|
return anyRegexMatch(s, a.Regexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *Allowlist) ContainsStopWord(s string) bool {
|
||||||
|
s = strings.ToLower(s)
|
||||||
|
for _, stopWord := range a.StopWords {
|
||||||
|
if strings.Contains(s, strings.ToLower(stopWord)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
+33
-14
@@ -4,6 +4,7 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed gitleaks.toml
|
//go:embed gitleaks.toml
|
||||||
@@ -20,19 +21,22 @@ type ViperConfig struct {
|
|||||||
Entropy float64
|
Entropy float64
|
||||||
SecretGroup int
|
SecretGroup int
|
||||||
Regex string
|
Regex string
|
||||||
|
Keywords []string
|
||||||
Path string
|
Path string
|
||||||
Tags []string
|
Tags []string
|
||||||
|
|
||||||
Allowlist struct {
|
Allowlist struct {
|
||||||
Regexes []string
|
Regexes []string
|
||||||
Paths []string
|
Paths []string
|
||||||
Commits []string
|
Commits []string
|
||||||
|
StopWords []string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Allowlist struct {
|
Allowlist struct {
|
||||||
Regexes []string
|
Regexes []string
|
||||||
Paths []string
|
Paths []string
|
||||||
Commits []string
|
Commits []string
|
||||||
|
StopWords []string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,10 +46,14 @@ type Config struct {
|
|||||||
Description string
|
Description string
|
||||||
Rules []*Rule
|
Rules []*Rule
|
||||||
Allowlist Allowlist
|
Allowlist Allowlist
|
||||||
|
Keywords []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (vc *ViperConfig) Translate() (Config, error) {
|
func (vc *ViperConfig) Translate() (Config, error) {
|
||||||
var rules []*Rule
|
var (
|
||||||
|
rules []*Rule
|
||||||
|
keywords []string
|
||||||
|
)
|
||||||
for _, r := range vc.Rules {
|
for _, r := range vc.Rules {
|
||||||
var allowlistRegexes []*regexp.Regexp
|
var allowlistRegexes []*regexp.Regexp
|
||||||
for _, a := range r.Allowlist.Regexes {
|
for _, a := range r.Allowlist.Regexes {
|
||||||
@@ -56,6 +64,14 @@ func (vc *ViperConfig) Translate() (Config, error) {
|
|||||||
allowlistPaths = append(allowlistPaths, regexp.MustCompile(a))
|
allowlistPaths = append(allowlistPaths, regexp.MustCompile(a))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if r.Keywords == nil {
|
||||||
|
r.Keywords = []string{}
|
||||||
|
} else {
|
||||||
|
for _, k := range r.Keywords {
|
||||||
|
keywords = append(keywords, strings.ToLower(k))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if r.Tags == nil {
|
if r.Tags == nil {
|
||||||
r.Tags = []string{}
|
r.Tags = []string{}
|
||||||
}
|
}
|
||||||
@@ -80,17 +96,18 @@ func (vc *ViperConfig) Translate() (Config, error) {
|
|||||||
SecretGroup: r.SecretGroup,
|
SecretGroup: r.SecretGroup,
|
||||||
Entropy: r.Entropy,
|
Entropy: r.Entropy,
|
||||||
Tags: r.Tags,
|
Tags: r.Tags,
|
||||||
|
Keywords: r.Keywords,
|
||||||
Allowlist: Allowlist{
|
Allowlist: Allowlist{
|
||||||
Regexes: allowlistRegexes,
|
Regexes: allowlistRegexes,
|
||||||
Paths: allowlistPaths,
|
Paths: allowlistPaths,
|
||||||
Commits: r.Allowlist.Commits,
|
Commits: r.Allowlist.Commits,
|
||||||
|
StopWords: r.Allowlist.StopWords,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if r.Regex != nil && r.SecretGroup > r.Regex.NumSubexp() {
|
if r.Regex != nil && r.SecretGroup > 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())
|
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)
|
||||||
|
|
||||||
}
|
}
|
||||||
var allowlistRegexes []*regexp.Regexp
|
var allowlistRegexes []*regexp.Regexp
|
||||||
for _, a := range vc.Allowlist.Regexes {
|
for _, a := range vc.Allowlist.Regexes {
|
||||||
@@ -104,9 +121,11 @@ func (vc *ViperConfig) Translate() (Config, error) {
|
|||||||
Description: vc.Description,
|
Description: vc.Description,
|
||||||
Rules: rules,
|
Rules: rules,
|
||||||
Allowlist: Allowlist{
|
Allowlist: Allowlist{
|
||||||
Regexes: allowlistRegexes,
|
Regexes: allowlistRegexes,
|
||||||
Paths: allowlistPaths,
|
Paths: allowlistPaths,
|
||||||
Commits: vc.Allowlist.Commits,
|
Commits: vc.Allowlist.Commits,
|
||||||
|
StopWords: vc.Allowlist.StopWords,
|
||||||
},
|
},
|
||||||
|
Keywords: keywords,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,7 @@ func TestTranslate(t *testing.T) {
|
|||||||
Description: "AWS Access Key",
|
Description: "AWS Access Key",
|
||||||
Regex: regexp.MustCompile("(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
Regex: regexp.MustCompile("(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
||||||
Tags: []string{"key", "AWS"},
|
Tags: []string{"key", "AWS"},
|
||||||
|
Keywords: []string{},
|
||||||
RuleID: "aws-access-key",
|
RuleID: "aws-access-key",
|
||||||
Allowlist: Allowlist{
|
Allowlist: Allowlist{
|
||||||
Regexes: []*regexp.Regexp{
|
Regexes: []*regexp.Regexp{
|
||||||
@@ -43,6 +44,7 @@ func TestTranslate(t *testing.T) {
|
|||||||
Description: "AWS Access Key",
|
Description: "AWS Access Key",
|
||||||
Regex: regexp.MustCompile("(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
Regex: regexp.MustCompile("(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
||||||
Tags: []string{"key", "AWS"},
|
Tags: []string{"key", "AWS"},
|
||||||
|
Keywords: []string{},
|
||||||
RuleID: "aws-access-key",
|
RuleID: "aws-access-key",
|
||||||
Allowlist: Allowlist{
|
Allowlist: Allowlist{
|
||||||
Commits: []string{"allowthiscommit"},
|
Commits: []string{"allowthiscommit"},
|
||||||
@@ -59,6 +61,7 @@ func TestTranslate(t *testing.T) {
|
|||||||
Description: "AWS Access Key",
|
Description: "AWS Access Key",
|
||||||
Regex: regexp.MustCompile("(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
Regex: regexp.MustCompile("(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
|
||||||
Tags: []string{"key", "AWS"},
|
Tags: []string{"key", "AWS"},
|
||||||
|
Keywords: []string{},
|
||||||
RuleID: "aws-access-key",
|
RuleID: "aws-access-key",
|
||||||
Allowlist: Allowlist{
|
Allowlist: Allowlist{
|
||||||
Paths: []*regexp.Regexp{
|
Paths: []*regexp.Regexp{
|
||||||
@@ -81,6 +84,7 @@ func TestTranslate(t *testing.T) {
|
|||||||
Entropy: 3.5,
|
Entropy: 3.5,
|
||||||
SecretGroup: 3,
|
SecretGroup: 3,
|
||||||
Tags: []string{},
|
Tags: []string{},
|
||||||
|
Keywords: []string{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
+2195
-549
File diff suppressed because it is too large.
Load diff
@@ -32,6 +32,11 @@ type Rule struct {
|
|||||||
// and reporting purposes.
|
// and reporting purposes.
|
||||||
Tags []string
|
Tags []string
|
||||||
|
|
||||||
|
// Keywords are used for pre-regex check filtering. Rules that contain
|
||||||
|
// keywords will perform a quick string compare check to make sure the
|
||||||
|
// keyword(s) are in the content being scanned.
|
||||||
|
Keywords []string
|
||||||
|
|
||||||
// Allowlist allows a rule to be ignored for specific
|
// Allowlist allows a rule to be ignored for specific
|
||||||
// regexes, paths, and/or commits
|
// regexes, paths, and/or commits
|
||||||
Allowlist Allowlist
|
Allowlist Allowlist
|
||||||
|
|||||||
+59
-6
@@ -16,6 +16,7 @@ import (
|
|||||||
"github.com/fatih/semgroup"
|
"github.com/fatih/semgroup"
|
||||||
"github.com/gitleaks/go-gitdiff/gitdiff"
|
"github.com/gitleaks/go-gitdiff/gitdiff"
|
||||||
"github.com/h2non/filetype"
|
"github.com/h2non/filetype"
|
||||||
|
ahocorasick "github.com/petar-dambovaliev/aho-corasick"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
@@ -59,6 +60,10 @@ type Detector struct {
|
|||||||
// of the detector's scan which can then be used to generate a
|
// of the detector's scan which can then be used to generate a
|
||||||
// report.
|
// report.
|
||||||
findings []report.Finding
|
findings []report.Finding
|
||||||
|
|
||||||
|
// prefilter is a ahocorasick struct used for doing efficient string
|
||||||
|
// matching given a set of words (keywords from the rules in the config)
|
||||||
|
prefilter ahocorasick.AhoCorasick
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fragment contains the data to be scanned
|
// Fragment contains the data to be scanned
|
||||||
@@ -75,15 +80,27 @@ type Fragment struct {
|
|||||||
// newlineIndices is a list of indices of newlines in the raw content.
|
// newlineIndices is a list of indices of newlines in the raw content.
|
||||||
// This is used to calculate the line location of a finding
|
// This is used to calculate the line location of a finding
|
||||||
newlineIndices [][]int
|
newlineIndices [][]int
|
||||||
|
|
||||||
|
// keywords is a map of all the keywords contain within the contents
|
||||||
|
// of this fragment
|
||||||
|
keywords map[string]bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDetector creates a new detector with the given config
|
// NewDetector creates a new detector with the given config
|
||||||
func NewDetector(cfg config.Config) *Detector {
|
func NewDetector(cfg config.Config) *Detector {
|
||||||
|
builder := ahocorasick.NewAhoCorasickBuilder(ahocorasick.Opts{
|
||||||
|
AsciiCaseInsensitive: true,
|
||||||
|
MatchOnlyWholeWords: false,
|
||||||
|
MatchKind: ahocorasick.LeftMostLongestMatch,
|
||||||
|
DFA: true,
|
||||||
|
})
|
||||||
|
|
||||||
return &Detector{
|
return &Detector{
|
||||||
commitMap: make(map[string]bool),
|
commitMap: make(map[string]bool),
|
||||||
findingMutex: &sync.Mutex{},
|
findingMutex: &sync.Mutex{},
|
||||||
findings: make([]report.Finding, 0),
|
findings: make([]report.Finding, 0),
|
||||||
Config: cfg,
|
Config: cfg,
|
||||||
|
prefilter: builder.Build(cfg.Keywords),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,6 +166,11 @@ func (d *Detector) detectRule(fragment Fragment, rule *config.Rule) []report.Fin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if path only rule, skip content checks
|
||||||
|
if rule.Regex == nil {
|
||||||
|
return findings
|
||||||
|
}
|
||||||
|
|
||||||
matchIndices := rule.Regex.FindAllStringIndex(fragment.Raw, -1)
|
matchIndices := rule.Regex.FindAllStringIndex(fragment.Raw, -1)
|
||||||
for _, matchIndex := range matchIndices {
|
for _, matchIndex := range matchIndices {
|
||||||
// extract secret from match
|
// extract secret from match
|
||||||
@@ -178,6 +200,12 @@ func (d *Detector) detectRule(fragment Fragment, rule *config.Rule) []report.Fin
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if the secret is in the allowlist
|
||||||
|
if rule.Allowlist.RegexAllowed(finding.Secret) ||
|
||||||
|
d.Config.Allowlist.RegexAllowed(finding.Secret) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// extract secret from secret group if set
|
// extract secret from secret group if set
|
||||||
if rule.SecretGroup != 0 {
|
if rule.SecretGroup != 0 {
|
||||||
groups := rule.Regex.FindStringSubmatch(secret)
|
groups := rule.Regex.FindStringSubmatch(secret)
|
||||||
@@ -189,9 +217,9 @@ func (d *Detector) detectRule(fragment Fragment, rule *config.Rule) []report.Fin
|
|||||||
finding.Secret = secret
|
finding.Secret = secret
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if the secret is in the allowlist
|
// check if the secret is in the list of stopwords
|
||||||
if rule.Allowlist.RegexAllowed(finding.Secret) ||
|
if rule.Allowlist.ContainsStopWord(finding.Secret) ||
|
||||||
d.Config.Allowlist.RegexAllowed(finding.Secret) {
|
d.Config.Allowlist.ContainsStopWord(finding.Secret) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,17 +386,42 @@ func (d *Detector) DetectFiles(source string) ([]report.Finding, error) {
|
|||||||
func (d *Detector) Detect(fragment Fragment) []report.Finding {
|
func (d *Detector) Detect(fragment Fragment) []report.Finding {
|
||||||
var findings []report.Finding
|
var findings []report.Finding
|
||||||
|
|
||||||
|
// initiate fragment keywords
|
||||||
|
fragment.keywords = make(map[string]bool)
|
||||||
|
|
||||||
// check if filepath is allowed
|
// check if filepath is allowed
|
||||||
if d.Config.Allowlist.PathAllowed(fragment.FilePath) ||
|
if fragment.FilePath != "" && (d.Config.Allowlist.PathAllowed(fragment.FilePath) ||
|
||||||
fragment.FilePath == d.Config.Path {
|
fragment.FilePath == d.Config.Path) {
|
||||||
return findings
|
return findings
|
||||||
}
|
}
|
||||||
|
|
||||||
// add newline indices for location calculation in detectRule
|
// add newline indices for location calculation in detectRule
|
||||||
fragment.newlineIndices = regexp.MustCompile("\n").FindAllStringIndex(fragment.Raw, -1)
|
fragment.newlineIndices = regexp.MustCompile("\n").FindAllStringIndex(fragment.Raw, -1)
|
||||||
|
|
||||||
|
// build keyword map for prefiltering rules
|
||||||
|
normalizedRaw := strings.ToLower(fragment.Raw)
|
||||||
|
matches := d.prefilter.FindAll(normalizedRaw)
|
||||||
|
for _, m := range matches {
|
||||||
|
fragment.keywords[normalizedRaw[m.Start():m.End()]] = true
|
||||||
|
}
|
||||||
|
|
||||||
for _, rule := range d.Config.Rules {
|
for _, rule := range d.Config.Rules {
|
||||||
findings = append(findings, d.detectRule(fragment, rule)...)
|
if len(rule.Keywords) == 0 {
|
||||||
|
// if not keywords are associated with the rule always scan the
|
||||||
|
// fragment using the rule
|
||||||
|
findings = append(findings, d.detectRule(fragment, rule)...)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
fragmentContainsKeyword := false
|
||||||
|
// check if keywords are in the fragment
|
||||||
|
for _, k := range rule.Keywords {
|
||||||
|
if _, ok := fragment.keywords[strings.ToLower(k)]; ok {
|
||||||
|
fragmentContainsKeyword = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if fragmentContainsKeyword {
|
||||||
|
findings = append(findings, d.detectRule(fragment, rule)...)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return filter(findings, d.Redact)
|
return filter(findings, d.Redact)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ func location(fragment Fragment, matchIndex []int) Location {
|
|||||||
end := matchIndex[1]
|
end := matchIndex[1]
|
||||||
|
|
||||||
for lineNum, pair := range fragment.newlineIndices {
|
for lineNum, pair := range fragment.newlineIndices {
|
||||||
|
_lineNum = lineNum
|
||||||
newLineByteIndex := pair[0]
|
newLineByteIndex := pair[0]
|
||||||
if prevNewLine <= start && start < newLineByteIndex {
|
if prevNewLine <= start && start < newLineByteIndex {
|
||||||
lineSet = true
|
lineSet = true
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ go 1.17
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/fatih/semgroup v1.2.0
|
github.com/fatih/semgroup v1.2.0
|
||||||
github.com/gitleaks/go-gitdiff v0.7.4
|
github.com/gitleaks/go-gitdiff v0.7.6
|
||||||
github.com/rs/zerolog v1.26.1
|
github.com/rs/zerolog v1.26.1
|
||||||
github.com/spf13/cobra v1.2.1
|
github.com/spf13/cobra v1.2.1
|
||||||
github.com/spf13/viper v1.8.1
|
github.com/spf13/viper v1.8.1
|
||||||
@@ -14,12 +14,14 @@ require (
|
|||||||
require (
|
require (
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/fsnotify/fsnotify v1.4.9 // indirect
|
github.com/fsnotify/fsnotify v1.4.9 // indirect
|
||||||
github.com/h2non/filetype v1.1.3 // indirect
|
github.com/h2non/filetype v1.1.3
|
||||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||||
|
github.com/lucasjones/reggen v0.0.0-20200904144131-37ba4fa293bb
|
||||||
github.com/magiconair/properties v1.8.5 // indirect
|
github.com/magiconair/properties v1.8.5 // indirect
|
||||||
github.com/mitchellh/mapstructure v1.4.1 // indirect
|
github.com/mitchellh/mapstructure v1.4.1 // indirect
|
||||||
github.com/pelletier/go-toml v1.9.3 // indirect
|
github.com/pelletier/go-toml v1.9.3 // indirect
|
||||||
|
github.com/petar-dambovaliev/aho-corasick v0.0.0-20211021192214-5ab2d9280aa9
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/spf13/afero v1.6.0 // indirect
|
github.com/spf13/afero v1.6.0 // indirect
|
||||||
github.com/spf13/cast v1.3.1 // indirect
|
github.com/spf13/cast v1.3.1 // indirect
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ github.com/fatih/semgroup v1.2.0/go.mod h1:1KAD4iIYfXjE4U13B48VM4z9QUwV5Tt8O4rS8
|
|||||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
github.com/gitleaks/go-gitdiff v0.7.4 h1:8vICc4moyRR2poklblThdQ0ckMet22mEvFJSxPsiDlk=
|
github.com/gitleaks/go-gitdiff v0.7.6 h1:atcfoNPD9erzPs9C89a+i2Y+EUmR2QKB5QHJTfB4n60=
|
||||||
github.com/gitleaks/go-gitdiff v0.7.4/go.mod h1:pKz0X4YzCKZs30BL+weqBIG7mx0jl4tF1uXV9ZyNvrA=
|
github.com/gitleaks/go-gitdiff v0.7.6/go.mod h1:pKz0X4YzCKZs30BL+weqBIG7mx0jl4tF1uXV9ZyNvrA=
|
||||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||||
@@ -183,6 +183,8 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
|
|||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/lucasjones/reggen v0.0.0-20200904144131-37ba4fa293bb h1:w1g9wNDIE/pHSTmAaUhv4TZQuPBS6GV3mMz5hkgziIU=
|
||||||
|
github.com/lucasjones/reggen v0.0.0-20200904144131-37ba4fa293bb/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4=
|
||||||
github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls=
|
github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls=
|
||||||
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
|
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
|
||||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||||
@@ -203,6 +205,8 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
|
|||||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||||
github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ=
|
github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ=
|
||||||
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
|
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
|
||||||
|
github.com/petar-dambovaliev/aho-corasick v0.0.0-20211021192214-5ab2d9280aa9 h1:lL+y4Xv20pVlCGyLzNHRC0I0rIHhIL1lTvHizoS/dU8=
|
||||||
|
github.com/petar-dambovaliev/aho-corasick v0.0.0-20211021192214-5ab2d9280aa9/go.mod h1:EHPiTAKtiFmrMldLUNswFwfZ2eJIYBHktdaUTZxYWRw=
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
|
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
|
||||||
|
|||||||
Reference in new issue
Block a user