mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-27 19:54:24 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
906085fba6 | ||
|
|
d0ba52e2be | ||
|
|
8a8306288e | ||
|
|
a9e6d8c9a7 | ||
|
|
2f73a3e3cf | ||
|
|
f6966057f5 | ||
|
|
0bf13fc25a | ||
|
|
83e99bacf1 | ||
|
|
e393d299bc | ||
|
|
263ce82365 | ||
|
|
3c0e068b69 | ||
|
|
f3adda07ca | ||
|
|
ed205a5f63 | ||
|
|
6018012b7e | ||
|
|
7f77987d91 | ||
|
|
48a2e0e318 | ||
|
|
4e303d0284 | ||
|
|
c1add1d268 | ||
|
|
202106a190 | ||
|
|
8e94f98e92 | ||
|
|
dbb42a727d | ||
|
|
259946000b | ||
|
|
8ffb980ee5 | ||
|
|
4181ad647a | ||
|
|
48ea14bd47 | ||
|
|
81f0002845 | ||
|
|
c11adc91ad | ||
|
|
d1d9054ef0 | ||
|
|
5fe58bf0b0 | ||
|
|
5c2e8132f2 |
No files matched your search
@@ -1,16 +1,16 @@
|
||||
- id: gitleaks
|
||||
name: Detect hardcoded secrets
|
||||
description: Detect hardcoded secrets using Gitleaks
|
||||
entry: gitleaks protect --verbose --redact --staged
|
||||
entry: gitleaks git --pre-commit --redact --staged --verbose
|
||||
language: golang
|
||||
pass_filenames: false
|
||||
- id: gitleaks-docker
|
||||
name: Detect hardcoded secrets
|
||||
description: Detect hardcoded secrets using Gitleaks
|
||||
entry: zricethezav/gitleaks protect --verbose --redact --staged
|
||||
entry: zricethezav/gitleaks git --pre-commit --redact --staged --verbose
|
||||
language: docker_image
|
||||
- id: gitleaks-system
|
||||
name: Detect hardcoded secrets
|
||||
description: Detect hardcoded secrets using Gitleaks
|
||||
entry: gitleaks protect --verbose --redact --staged
|
||||
entry: gitleaks git --pre-commit --redact --staged --verbose
|
||||
language: system
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.22 AS build
|
||||
FROM golang:1.23 AS build
|
||||
WORKDIR /go/src/github.com/zricethezav/gitleaks
|
||||
COPY . .
|
||||
RUN VERSION=$(git describe --tags --abbrev=0) && \
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
### Join our Discord! [](https://discord.gg/8Hzbrnkr7E)
|
||||
|
||||
Gitleaks is a SAST tool for **detecting** and **preventing** hardcoded secrets like passwords, API keys, and tokens in git repos. Gitleaks is an **easy-to-use, all-in-one solution** for detecting secrets, past or present, in your code.
|
||||
Gitleaks is a tool for **detecting** secrets like passwords, API keys, and tokens in git repos, files, and whatever else you wanna throw at it via `stdin`.
|
||||
|
||||
```
|
||||
➜ ~/code(master) gitleaks git -v
|
||||
@@ -164,6 +164,7 @@ Flags:
|
||||
--redact uint[=100] redact secrets from logs and stdout. To redact only parts of the secret just apply a percent value from 0..100. For example --redact=20 (default 100%)
|
||||
-f, --report-format string output format (json, csv, junit, sarif) (default "json")
|
||||
-r, --report-path string report file
|
||||
--report-template string template file used to generate the report (implies --report-format=template)
|
||||
-v, --verbose show verbose output from scan
|
||||
--version version for gitleaks
|
||||
|
||||
@@ -278,7 +279,7 @@ keywords = [
|
||||
tags = ["tag","another tag"]
|
||||
|
||||
# ⚠️ In v8.21.0 `[rules.allowlist]` was replaced with `[[rules.allowlists]]`.
|
||||
# This change was backwards-compatible: instances of `[rules.allowlist]` still work.
|
||||
# This change was backwards-compatible: instances of `[rules.allowlist]` still work.
|
||||
#
|
||||
# You can define multiple allowlists for a rule to reduce false positives.
|
||||
# A finding will be ignored if _ANY_ `[[rules.allowlists]]` matches.
|
||||
@@ -393,6 +394,47 @@ Currently supported encodings:
|
||||
|
||||
- `base64` (both standard and base64url)
|
||||
|
||||
#### Reporting
|
||||
|
||||
Gitleaks has built-in support for several report formats: [`json`](https://github.com/gitleaks/gitleaks/blob/master/testdata/expected/report/json_simple.json), [`csv`](https://github.com/gitleaks/gitleaks/blob/master/testdata/expected/report/csv_simple.csv?plain=1), [`junit`](https://github.com/gitleaks/gitleaks/blob/master/testdata/expected/report/junit_simple.xml), and [`sarif`](https://github.com/gitleaks/gitleaks/blob/master/testdata/expected/report/sarif_simple.sarif).
|
||||
|
||||
If none of these formats fit your need, you can create your own report format with a [Go `text/template` .tmpl file](https://www.digitalocean.com/community/tutorials/how-to-use-templates-in-go#step-4-writing-a-template) and the `--report-template` flag. The template can use [extended functionality from the `Masterminds/sprig` template library](https://masterminds.github.io/sprig/).
|
||||
|
||||
For example, the following template provides a custom JSON output:
|
||||
```gotemplate
|
||||
# jsonextra.tmpl
|
||||
[{{ $lastFinding := (sub (len . ) 1) }}
|
||||
{{- range $i, $finding := . }}{{with $finding}}
|
||||
{
|
||||
"Description": {{ quote .Description }},
|
||||
"StartLine": {{ .StartLine }},
|
||||
"EndLine": {{ .EndLine }},
|
||||
"StartColumn": {{ .StartColumn }},
|
||||
"EndColumn": {{ .EndColumn }},
|
||||
"Line": {{ quote .Line }},
|
||||
"Match": {{ quote .Match }},
|
||||
"Secret": {{ quote .Secret }},
|
||||
"File": "{{ .File }}",
|
||||
"SymlinkFile": {{ quote .SymlinkFile }},
|
||||
"Commit": {{ quote .Commit }},
|
||||
"Entropy": {{ .Entropy }},
|
||||
"Author": {{ quote .Author }},
|
||||
"Email": {{ quote .Email }},
|
||||
"Date": {{ quote .Date }},
|
||||
"Message": {{ quote .Message }},
|
||||
"Tags": [{{ $lastTag := (sub (len .Tags ) 1) }}{{ range $j, $tag := .Tags }}{{ quote . }}{{ if ne $j $lastTag }},{{ end }}{{ end }}],
|
||||
"RuleID": {{ quote .RuleID }},
|
||||
"Fingerprint": {{ quote .Fingerprint }}
|
||||
}{{ if ne $i $lastFinding }},{{ end }}
|
||||
{{- end}}{{ end }}
|
||||
]
|
||||
```
|
||||
|
||||
Usage:
|
||||
```sh
|
||||
$ gitleaks dir ~/leaky-repo/ --report-path "report.json" --report-format template --report-template testdata/report/jsonextra.tmpl
|
||||
```
|
||||
|
||||
## Sponsorships
|
||||
|
||||
<p align="left">
|
||||
|
||||
+11
-7
@@ -62,6 +62,10 @@ func runDetect(cmd *cobra.Command, args []string) {
|
||||
|
||||
detector := Detector(cmd, cfg, source)
|
||||
|
||||
// set follow symlinks flag
|
||||
if detector.FollowSymlinks, err = cmd.Flags().GetBool("follow-symlinks"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
// set exit code
|
||||
exitCode, err := cmd.Flags().GetInt("exit-code")
|
||||
if err != nil {
|
||||
@@ -83,7 +87,12 @@ func runDetect(cmd *cobra.Command, args []string) {
|
||||
// start the detector scan
|
||||
if noGit {
|
||||
var paths <-chan sources.ScanTarget
|
||||
paths, err = sources.DirectoryTargets(source, detector.Sema, detector.FollowSymlinks)
|
||||
paths, err = sources.DirectoryTargets(
|
||||
source,
|
||||
detector.Sema,
|
||||
detector.FollowSymlinks,
|
||||
detector.Config.Allowlist.PathAllowed,
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal().Err(err)
|
||||
}
|
||||
@@ -120,10 +129,5 @@ func runDetect(cmd *cobra.Command, args []string) {
|
||||
}
|
||||
}
|
||||
|
||||
// set follow symlinks flag
|
||||
if detector.FollowSymlinks, err = cmd.Flags().GetBool("follow-symlinks"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
|
||||
findingSummaryAndExit(findings, cmd, cfg, exitCode, start, err)
|
||||
findingSummaryAndExit(detector, findings, exitCode, start, err)
|
||||
}
|
||||
+11
-2
@@ -45,6 +45,10 @@ func runDirectory(cmd *cobra.Command, args []string) {
|
||||
|
||||
detector := Detector(cmd, cfg, source)
|
||||
|
||||
// set follow symlinks flag
|
||||
if detector.FollowSymlinks, err = cmd.Flags().GetBool("follow-symlinks"); err != nil {
|
||||
log.Fatal().Err(err).Msg("")
|
||||
}
|
||||
// set exit code
|
||||
exitCode, err := cmd.Flags().GetInt("exit-code")
|
||||
if err != nil {
|
||||
@@ -52,7 +56,12 @@ func runDirectory(cmd *cobra.Command, args []string) {
|
||||
}
|
||||
|
||||
var paths <-chan sources.ScanTarget
|
||||
paths, err = sources.DirectoryTargets(source, detector.Sema, detector.FollowSymlinks)
|
||||
paths, err = sources.DirectoryTargets(
|
||||
source,
|
||||
detector.Sema,
|
||||
detector.FollowSymlinks,
|
||||
detector.Config.Allowlist.PathAllowed,
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal().Err(err)
|
||||
}
|
||||
@@ -63,5 +72,5 @@ func runDirectory(cmd *cobra.Command, args []string) {
|
||||
log.Error().Err(err).Msg("failed scan directory")
|
||||
}
|
||||
|
||||
findingSummaryAndExit(findings, cmd, cfg, exitCode, start, err)
|
||||
findingSummaryAndExit(detector, findings, exitCode, start, err)
|
||||
}
|
||||
@@ -2,9 +2,10 @@ package base
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
func CreateGlobalConfig() config.Config {
|
||||
@@ -64,7 +65,7 @@ func CreateGlobalConfig() config.Config {
|
||||
// ----------- Golang files -----------
|
||||
regexp.MustCompile(`go\.(mod|sum|work(\.sum)?)$`),
|
||||
regexp.MustCompile(`(^|/)vendor/modules\.txt$`),
|
||||
regexp.MustCompile(`(^|/)vendor/(github\.com|golang\.org/x|google\.golang\.org|gopkg\.in|istio\.io|k8s\.io|sigs\.k8s\.io)/.*$`),
|
||||
regexp.MustCompile(`(^|/)vendor/(github\.com|golang\.org/x|google\.golang\.org|gopkg\.in|istio\.io|k8s\.io|sigs\.k8s\.io)(/.*)?$`),
|
||||
|
||||
// ----------- Java files -----------
|
||||
// Gradle
|
||||
@@ -75,30 +76,27 @@ func CreateGlobalConfig() config.Config {
|
||||
|
||||
// ----------- JavaScript files -----------
|
||||
// Dependencies and lock files.
|
||||
regexp.MustCompile(`(^|/)node_modules/.*?$`),
|
||||
regexp.MustCompile(`(^|/)package-lock\.json$`),
|
||||
regexp.MustCompile(`(^|/)yarn\.lock$`),
|
||||
regexp.MustCompile(`(^|/)pnpm-lock\.yaml$`),
|
||||
regexp.MustCompile(`(^|/)npm-shrinkwrap\.json$`),
|
||||
regexp.MustCompile(`(^|/)bower_components/.*?$`),
|
||||
regexp.MustCompile(`(^|/)node_modules(/.*)?$`),
|
||||
regexp.MustCompile(`(^|/)(npm-shrinkwrap\.json|package-lock\.json|pnpm-lock\.yaml|yarn\.lock)$`),
|
||||
regexp.MustCompile(`(^|/)bower_components(/.*)?$`),
|
||||
// TODO: Add more common static assets, such as swagger-ui.
|
||||
regexp.MustCompile(`(^|/)(jquery(-?ui)?|swagger-?ui)[a-zA-Z0-9.-]+\.js(\.map)?$`),
|
||||
regexp.MustCompile(`(^|/)(angular|jquery(-?ui)?|plotly|swagger-?ui)[a-zA-Z0-9.-]*(\.min)?\.js(\.map)?$`),
|
||||
|
||||
// ----------- Python files -----------
|
||||
// Dependencies and lock files.
|
||||
regexp.MustCompile(`(^|/)(Pipfile|poetry)\.lock$`),
|
||||
// Virtual environments
|
||||
regexp.MustCompile(`(?i)/?(v?env|virtualenv)/lib(64)?/.+$`),
|
||||
regexp.MustCompile(`(?i)(^|/)(lib(64)?/python[23](\.\d{1,2})+/|python/[23](\.\d{1,2})+/lib(64)?/).+$`),
|
||||
regexp.MustCompile(`(?i)/?(v?env|virtualenv)/lib(64)?(/.*)?$`),
|
||||
regexp.MustCompile(`(?i)(^|/)(lib(64)?/python[23](\.\d{1,2})+|python/[23](\.\d{1,2})+/lib(64)?)(/.*)?$`),
|
||||
// dist-info directory (https://py-pkgs.org/04-package-structure.html#building-sdists-and-wheels)
|
||||
regexp.MustCompile(`(?i)(^|/)[a-z0-9_.]+-[0-9.]+\.dist-info/.+$`),
|
||||
regexp.MustCompile(`(?i)(^|/)[a-z0-9_.]+-[0-9.]+\.dist-info(/.+)?$`),
|
||||
|
||||
// ----------- Ruby files -----------
|
||||
regexp.MustCompile(`(^|/)vendor/(bundle|ruby)/.*?$`),
|
||||
regexp.MustCompile(`(^|/)vendor/(bundle|ruby)(/.*?)?$`),
|
||||
regexp.MustCompile(`\.gem$`), // tar archive
|
||||
|
||||
// Misc
|
||||
regexp.MustCompile(`verification-metadata.xml`),
|
||||
regexp.MustCompile(`verification-metadata\.xml`),
|
||||
regexp.MustCompile(`Database.refactorlog`),
|
||||
//regexp.MustCompile(`vendor`),
|
||||
},
|
||||
|
||||
@@ -91,11 +91,14 @@ func TestConfigAllowlistPaths(t *testing.T) {
|
||||
}{
|
||||
"javascript - common static assets": {
|
||||
invalid: []string{
|
||||
`src/main/static/lib/angular.1.2.16.min.js`,
|
||||
`src/main/resources/static/jquery-ui-1.12.1/jquery-ui-min.js`,
|
||||
`src/main/resources/static/js/jquery-ui-1.10.4.min.js`,
|
||||
`src-static/js/plotly.min.js`,
|
||||
`swagger/swaggerui/swagger-ui-bundle.js.map`,
|
||||
`swagger/swaggerui/swagger-ui-es-bundle.js.map`,
|
||||
`src/main/static/swagger-ui.min.js`,
|
||||
`swagger/swaggerui/swagger-ui.js`,
|
||||
},
|
||||
},
|
||||
"python": {
|
||||
|
||||
@@ -4,10 +4,9 @@ import (
|
||||
"os"
|
||||
"text/template"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/base"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/base"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/rules"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
@@ -90,6 +89,7 @@ func main() {
|
||||
rules.FlutterwaveEncKey(),
|
||||
rules.FlyIOAccessToken(),
|
||||
rules.FrameIO(),
|
||||
rules.Freemius(),
|
||||
rules.FreshbooksAccessToken(),
|
||||
rules.GoCardless(),
|
||||
// TODO figure out what makes sense for GCP
|
||||
@@ -108,6 +108,7 @@ func main() {
|
||||
rules.GitlabKubernetesAgentToken(),
|
||||
rules.GitlabOauthAppSecret(),
|
||||
rules.GitlabPat(),
|
||||
rules.GitlabPatRoutable(),
|
||||
rules.GitlabPipelineTriggerToken(),
|
||||
rules.GitlabRunnerRegistrationToken(),
|
||||
rules.GitlabRunnerAuthenticationToken(),
|
||||
@@ -182,6 +183,11 @@ func main() {
|
||||
rules.SendGridAPIToken(),
|
||||
rules.SendInBlueAPIToken(),
|
||||
rules.SentryAccessToken(),
|
||||
rules.SentryOrgToken(),
|
||||
rules.SentryUserToken(),
|
||||
rules.SettlemintApplicationAccessToken(),
|
||||
rules.SettlemintPersonalAccessToken(),
|
||||
rules.SettlemintServiceAccessToken(),
|
||||
rules.ShippoAPIToken(),
|
||||
rules.ShopifyAccessToken(),
|
||||
rules.ShopifyCustomAccessToken(),
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// https://developer.1password.com/docs/service-accounts/security/?token-example=encoded
|
||||
|
||||
@@ -16,8 +16,6 @@ func AdafruitAPIKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("adafruit", secrets.NewSecret(utils.AlphaNumericExtendedShort("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("adafruit", secrets.NewSecret(utils.AlphaNumericExtendedShort("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -17,9 +17,7 @@ func AdobeClientID() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("adobe", secrets.NewSecret(utils.Hex("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("adobe", secrets.NewSecret(utils.Hex("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
@@ -17,8 +17,6 @@ func AgeSecretKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
`apiKey := "AGE-SECRET-KEY-1QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ`, // gitleaks:allow
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("age", `AGE-SECRET-KEY-1QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ`) // gitleaks:allow
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -16,8 +16,6 @@ func Airtable() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("airtable", secrets.NewSecret(utils.AlphaNumeric("17"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("airtable", secrets.NewSecret(utils.AlphaNumeric("17")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -16,8 +16,6 @@ func AlgoliaApiKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
"algolia_key := " + secrets.NewSecret(utils.Hex("32")),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("algolia", secrets.NewSecret(utils.Hex("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -35,8 +35,6 @@ func AlibabaSecretKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("alibaba", secrets.NewSecret(utils.AlphaNumeric("30"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("alibaba", secrets.NewSecret(utils.AlphaNumeric("30")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -16,9 +16,7 @@ func AsanaClientID() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("asana", secrets.NewSecret(utils.Numeric("16"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("asana", secrets.NewSecret(utils.Numeric("16")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -33,8 +31,6 @@ func AsanaClientSecret() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("asana", secrets.NewSecret(utils.AlphaNumeric("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("asana", secrets.NewSecret(utils.AlphaNumeric("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -11,15 +11,23 @@ func Atlassian() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Detected an Atlassian API token, posing a threat to project management and collaboration tool security and data confidentiality.",
|
||||
RuleID: "atlassian-api-token",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{
|
||||
"atlassian", "confluence", "jira"}, utils.AlphaNumeric("24"), true),
|
||||
Keywords: []string{"atlassian", "confluence", "jira"},
|
||||
Regex: utils.MergeRegexps(
|
||||
utils.GenerateSemiGenericRegex(
|
||||
[]string{"atlassian", "confluence", "jira"},
|
||||
`[a-zA-Z0-9]{24}`,
|
||||
false,
|
||||
),
|
||||
utils.GenerateUniqueTokenRegex(`ATATT3[A-Za-z0-9_\-=]{186}`, false),
|
||||
),
|
||||
Entropy: 3.5,
|
||||
Keywords: []string{"atlassian", "confluence", "jira", "atatt3"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("atlassian", secrets.NewSecret(utils.AlphaNumeric("24"))),
|
||||
utils.GenerateSampleSecret("confluence", secrets.NewSecret(utils.AlphaNumeric("24"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("atlassian", secrets.NewSecret(utils.AlphaNumeric("24")))
|
||||
tps = append(tps, utils.GenerateSampleSecrets("confluence", secrets.NewSecret(utils.AlphaNumeric("24")))...)
|
||||
tps = append(tps, utils.GenerateSampleSecrets("jira", secrets.NewSecret(utils.AlphaNumeric("24")))...)
|
||||
tps = append(tps, utils.GenerateSampleSecrets("jira", "ATATT3xFfGF0K3irG5tKKi-6u-wwaXQFeGwZ-IHR-hQ3CulkKtMSuteRQFfLZ6jihHThzZCg_UjnDt-4Wl_gIRf4zrZJs5JqaeuBhsfJ4W5GD6yGg3W7903gbvaxZPBjxIQQ7BgFDSkPS8oPispw4KLz56mdK-G6CIvLO6hHRrZHY0Q3tvJ6JxE=C63992E6")...)
|
||||
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -2,8 +2,8 @@ package rules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
@@ -26,8 +26,6 @@ func Authress() *config.Rule {
|
||||
account_id := "acc_" + utils.AlphaNumeric("10")
|
||||
signature_key := utils.AlphaNumericExtendedShort("40")
|
||||
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("authress", secrets.NewSecret(fmt.Sprintf(`%s\.%s\.%s\.%s`, service_client_id, access_key_id, account_id, signature_key))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("authress", secrets.NewSecret(fmt.Sprintf(`%s\.%s\.%s\.%s`, service_client_id, access_key_id, account_id, signature_key)))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
func AWS() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
Description: "Identified a pattern that may indicate AWS credentials, risking unauthorized cloud resource access and data breaches on AWS platforms.",
|
||||
RuleID: "aws-access-token",
|
||||
Regex: utils.GenerateUniqueTokenRegex("(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}", false),
|
||||
Description: "Identified a pattern that may indicate AWS credentials, risking unauthorized cloud resource access and data breaches on AWS platforms.",
|
||||
Regex: regexp.MustCompile(`\b((?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16})\b`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{
|
||||
// https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-unique-ids
|
||||
@@ -33,14 +33,12 @@ func AWS() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("AWS", "AKIALALEMEL33243OLIB"), // gitleaks:allow
|
||||
// current AWS tokens cannot contain [0,1,8,9], so their entropy is slightly lower than expected.
|
||||
utils.GenerateSampleSecret("AWS", "AKIA"+secrets.NewSecret("[A-Z2-7]{16}")),
|
||||
utils.GenerateSampleSecret("AWS", "ASIA"+secrets.NewSecret("[A-Z2-7]{16}")),
|
||||
utils.GenerateSampleSecret("AWS", "ABIA"+secrets.NewSecret("[A-Z2-7]{16}")),
|
||||
utils.GenerateSampleSecret("AWS", "ACCA"+secrets.NewSecret("[A-Z2-7]{16}")),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("AWS", "AKIALALEMEL33243OLIB") // gitleaks:allow
|
||||
// current AWS tokens cannot contain [0,1,8,9], so their entropy is slightly lower than expected.
|
||||
tps = append(tps, utils.GenerateSampleSecrets("AWS", "AKIA"+secrets.NewSecret("[A-Z2-7]{16}"))...)
|
||||
tps = append(tps, utils.GenerateSampleSecrets("AWS", "ASIA"+secrets.NewSecret("[A-Z2-7]{16}"))...)
|
||||
tps = append(tps, utils.GenerateSampleSecrets("AWS", "ABIA"+secrets.NewSecret("[A-Z2-7]{16}"))...)
|
||||
tps = append(tps, utils.GenerateSampleSecrets("AWS", "ACCA"+secrets.NewSecret("[A-Z2-7]{16}"))...)
|
||||
fps := []string{
|
||||
`key = AKIAXXXXXXXXXXXXXXXX`, // Low entropy
|
||||
`aws_access_key: AKIAIOSFODNN7EXAMPLE`, // Placeholder
|
||||
|
||||
@@ -2,11 +2,12 @@ package rules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
)
|
||||
|
||||
// References:
|
||||
|
||||
@@ -17,8 +17,6 @@ func Beamer() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("beamer", "b_"+secrets.NewSecret(utils.AlphaNumericExtended("44"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("beamer", "b_"+secrets.NewSecret(utils.AlphaNumericExtended("44")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -16,9 +16,7 @@ func BitBucketClientID() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("bitbucket", secrets.NewSecret(utils.AlphaNumeric("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("bitbucket", secrets.NewSecret(utils.AlphaNumeric("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -33,8 +31,6 @@ func BitBucketClientSecret() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("bitbucket", secrets.NewSecret(utils.AlphaNumeric("64"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("bitbucket", secrets.NewSecret(utils.AlphaNumeric("64")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -16,9 +16,7 @@ func BittrexAccessKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("bittrex", secrets.NewSecret(utils.AlphaNumeric("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("bittrex", secrets.NewSecret(utils.AlphaNumeric("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -33,8 +31,6 @@ func BittrexSecretKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("bittrex", secrets.NewSecret(utils.AlphaNumeric("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("bittrex", secrets.NewSecret(utils.AlphaNumeric("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
)
|
||||
|
||||
func Clojars() *config.Rule {
|
||||
@@ -19,8 +20,6 @@ func Clojars() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("clojars", "CLOJARS_"+secrets.NewSecret(utils.AlphaNumeric("60"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("clojars", "CLOJARS_"+secrets.NewSecret(utils.AlphaNumeric("60")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
@@ -35,7 +36,8 @@ func CloudflareGlobalAPIKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := global_keys
|
||||
tps := utils.GenerateSampleSecrets("cloudflare", secrets.NewSecret(utils.Hex("37")))
|
||||
tps = append(tps, global_keys...)
|
||||
fps := append(api_keys, origin_ca_keys...)
|
||||
|
||||
return utils.Validate(r, tps, fps)
|
||||
@@ -52,7 +54,8 @@ func CloudflareAPIKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := api_keys
|
||||
tps := utils.GenerateSampleSecrets("cloudflare", secrets.NewSecret(utils.AlphaNumericExtendedShort("40")))
|
||||
tps = append(tps, api_keys...)
|
||||
fps := append(global_keys, origin_ca_keys...)
|
||||
|
||||
return utils.Validate(r, tps, fps)
|
||||
@@ -70,7 +73,8 @@ func CloudflareOriginCAKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := origin_ca_keys
|
||||
tps := utils.GenerateSampleSecrets("cloudflare", "v1.0-aaa334dc886f30631ba0a610-0d98ef66290d7e50aac7c27b5986c99e6f3f1084c881d8ac0eae5de1d1aa0644076ff57022069b3237d19afe60ad045f207ef2b16387ee37b749441b2ae2e9ebe5b4606e846475d4a5")
|
||||
tps = append(tps, origin_ca_keys...)
|
||||
fps := append(global_keys, api_keys...)
|
||||
|
||||
return utils.Validate(r, tps, fps)
|
||||
|
||||
@@ -18,8 +18,6 @@ func CodecovAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("codecov", secrets.NewSecret(utils.AlphaNumeric("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("codecov", secrets.NewSecret(utils.AlphaNumeric("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -19,9 +19,6 @@ func CoinbaseAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("coinbase",
|
||||
secrets.NewSecret(utils.AlphaNumericExtendedShort("64"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("coinbase", secrets.NewSecret(utils.AlphaNumericExtendedShort("64")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -18,9 +18,7 @@ func ConfluentSecretKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("confluent", secrets.NewSecret(utils.AlphaNumeric("64"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("confluent", secrets.NewSecret(utils.AlphaNumeric("64")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -37,8 +35,6 @@ func ConfluentAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("confluent", secrets.NewSecret(utils.AlphaNumeric("16"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("confluent", secrets.NewSecret(utils.AlphaNumeric("16")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -17,8 +17,6 @@ func Contentful() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("contentful", secrets.NewSecret(utils.AlphaNumeric("43"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("contentful", secrets.NewSecret(utils.AlphaNumeric("43")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -2,20 +2,20 @@ package rules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
// https://curl.se/docs/manpage.html#-u
|
||||
func CurlBasicAuth() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "curl-auth-user",
|
||||
// TODO: Description: "",
|
||||
Regex: regexp.MustCompile(`\bcurl\b(?:.*|.*(?:[\r\n]{1,2}.*){1,5})[ \t\n\r](?:-u|--user)(?:=|[ \t]{0,5})(?:"([^:"]{3,}:[^"]{3,})"|'([^:']{3,}:[^']{3,})'|((?:"[^"]{3,}"|'[^']{3,}'|[\w$@.-]+):(?:"[^"]{3,}"|'[^']{3,}'|[\w${}@.-]+)))(?:\s|\z)`),
|
||||
Keywords: []string{"curl"},
|
||||
Entropy: 2,
|
||||
RuleID: "curl-auth-user",
|
||||
Description: "Discovered a potential basic authorization token provided in a curl command, which could compromise the curl accessed resource.",
|
||||
Regex: regexp.MustCompile(`\bcurl\b(?:.*|.*(?:[\r\n]{1,2}.*){1,5})[ \t\n\r](?:-u|--user)(?:=|[ \t]{0,5})(?:"([^:"]{3,}:[^"]{3,})"|'([^:']{3,}:[^']{3,})'|((?:"[^"]{3,}"|'[^']{3,}'|[\w$@.-]+):(?:"[^"]{3,}"|'[^']{3,}'|[\w${}@.-]+)))(?:\s|\z)`),
|
||||
Keywords: []string{"curl"},
|
||||
Entropy: 2,
|
||||
Allowlists: []config.Allowlist{
|
||||
{
|
||||
Regexes: []*regexp.Regexp{
|
||||
@@ -99,8 +99,8 @@ func CurlHeaderAuth() *config.Rule {
|
||||
// language=regexp
|
||||
authPat := `(?i)(?:Authorization:[ \t]{0,5}(?:Basic[ \t]([a-z0-9+/]{8,}={0,3})|(?:Bearer|(?:Api-)?Token)[ \t]([\w=~@.+/-]{8,})|([\w=~@.+/-]{8,}))|(?:(?:X-(?:[a-z]+-)?)?(?:Api-?)?(?:Key|Token)):[ \t]{0,5}([\w=~@.+/-]{8,}))`
|
||||
r := config.Rule{
|
||||
RuleID: "curl-auth-header",
|
||||
// TODO: Description: "",
|
||||
RuleID: "curl-auth-header",
|
||||
Description: "Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.",
|
||||
Regex: regexp.MustCompile(
|
||||
// language=regexp
|
||||
fmt.Sprintf(`\bcurl\b(?:.*?|.*?(?:[\r\n]{1,2}.*?){1,5})[ \t\n\r](?:-H|--header)(?:=|[ \t]{0,5})(?:"%s"|'%s')(?:\B|\s|\z)`, authPat, authPat)),
|
||||
|
||||
@@ -17,10 +17,8 @@ func Databricks() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("databricks", "dapi"+secrets.NewSecret(utils.Hex("32"))),
|
||||
`token = dapif13ac4b49d1cb31f69f678e39602e381-2`, // gitleaks:ignore
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("databricks", "dapi"+secrets.NewSecret(utils.Hex("32")))
|
||||
tps = append(tps, `token = dapif13ac4b49d1cb31f69f678e39602e381-2`) // gitleaks:ignore
|
||||
fps := []string{
|
||||
`DATABRICKS_TOKEN=dapi123456789012345678a9bc01234defg5`,
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ func DatadogtokenAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("datadog", secrets.NewSecret(utils.AlphaNumeric("40"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("datadog", secrets.NewSecret(utils.AlphaNumeric("40")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -23,8 +23,6 @@ func DefinedNetworkingAPIToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("dnkey", "dnkey-"+secrets.NewSecret(utils.AlphaNumericExtended("26"))+"-"+secrets.NewSecret(utils.AlphaNumericExtended("52"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("dnkey", "dnkey-"+secrets.NewSecret(utils.AlphaNumericExtended("26"))+"-"+secrets.NewSecret(utils.AlphaNumericExtended("52")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -15,9 +15,7 @@ func DigitalOceanPAT() *config.Rule {
|
||||
Keywords: []string{"dop_v1_"},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("do", "dop_v1_"+secrets.NewSecret(utils.Hex("64"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("do", "dop_v1_"+secrets.NewSecret(utils.Hex("64")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -30,9 +28,7 @@ func DigitalOceanOAuthToken() *config.Rule {
|
||||
Keywords: []string{"doo_v1_"},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("do", "doo_v1_"+secrets.NewSecret(utils.Hex("64"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("do", "doo_v1_"+secrets.NewSecret(utils.Hex("64")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -45,8 +41,6 @@ func DigitalOceanRefreshToken() *config.Rule {
|
||||
Keywords: []string{"dor_v1_"},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("do", "dor_v1_"+secrets.NewSecret(utils.Hex("64"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("do", "dor_v1_"+secrets.NewSecret(utils.Hex("64")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -16,9 +16,7 @@ func DiscordAPIToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("discord", secrets.NewSecret(utils.Hex("64"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("discord", secrets.NewSecret(utils.Hex("64")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -33,9 +31,7 @@ func DiscordClientID() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("discord", secrets.NewSecret(utils.Numeric("18"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("discord", secrets.NewSecret(utils.Numeric("18")))
|
||||
fps := []string{
|
||||
// Low entropy
|
||||
`discord=000000000000000000`,
|
||||
@@ -54,9 +50,7 @@ func DiscordClientSecret() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("discord", secrets.NewSecret(utils.Numeric("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("discord", secrets.NewSecret(utils.Numeric("32")))
|
||||
fps := []string{
|
||||
// Low entropy
|
||||
`discord=00000000000000000000000000000000`,
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
)
|
||||
|
||||
func Doppler() *config.Rule {
|
||||
@@ -19,9 +20,7 @@ func Doppler() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("doppler", "dp.pt."+secrets.NewSecret(utils.AlphaNumeric("43"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("doppler", "dp.pt."+secrets.NewSecret(utils.AlphaNumeric("43")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,6 @@ func DroneciAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("droneci", secrets.NewSecret(utils.AlphaNumeric("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("droneci", secrets.NewSecret(utils.AlphaNumeric("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -17,9 +17,7 @@ func DropBoxAPISecret() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("dropbox", secrets.NewSecret(utils.AlphaNumeric("15"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("dropbox", secrets.NewSecret(utils.AlphaNumeric("15")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
)
|
||||
|
||||
func Duffel() *config.Rule {
|
||||
@@ -19,8 +20,6 @@ func Duffel() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("duffel", "duffel_test_"+secrets.NewSecret(utils.AlphaNumericExtended("43"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("duffel", "duffel_test_"+secrets.NewSecret(utils.AlphaNumericExtended("43")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
)
|
||||
|
||||
func Dynatrace() *config.Rule {
|
||||
@@ -19,8 +20,6 @@ func Dynatrace() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("dynatrace", "dt0c01."+secrets.NewSecret(utils.AlphaNumeric("24"))+"."+secrets.NewSecret(utils.AlphaNumeric("64"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("dynatrace", "dt0c01."+secrets.NewSecret(utils.AlphaNumeric("24"))+"."+secrets.NewSecret(utils.AlphaNumeric("64")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
)
|
||||
|
||||
func EasyPost() *config.Rule {
|
||||
@@ -13,16 +14,22 @@ func EasyPost() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "easypost-api-token",
|
||||
Description: "Identified an EasyPost API token, which could lead to unauthorized postal and shipment service access and data exposure.",
|
||||
Regex: regexp.MustCompile(`\bEZAK(?i)[a-z0-9]{54}`),
|
||||
Regex: regexp.MustCompile(`\bEZAK(?i)[a-z0-9]{54}\b`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"EZAK"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("EZAK", "EZAK"+secrets.NewSecret(utils.AlphaNumeric("54"))),
|
||||
tps := utils.GenerateSampleSecrets("EZAK", "EZAK"+secrets.NewSecret(`[a-zA-Z0-9]{54}`))
|
||||
tps = append(tps,
|
||||
"EZAK"+secrets.NewSecret(`[a-zA-Z0-9]{54}`),
|
||||
"example.com?t=EZAK"+secrets.NewSecret(`[a-zA-Z0-9]{54}`)+"&q=1",
|
||||
)
|
||||
fps := []string{
|
||||
// random base64 encoded string
|
||||
`...6wqX6fNUXA/rYqRvfQ+EZAKGqQRiRyqAFRQshGPWOIAwNWGORfKHSBnVNFtVmWYoW6PH23lkqbbDWep95C/3VmWq/edti6...`, // gitleaks:allow
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
|
||||
func EasyPostTestAPI() *config.Rule {
|
||||
@@ -30,14 +37,21 @@ func EasyPostTestAPI() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "easypost-test-api-token",
|
||||
Description: "Detected an EasyPost test API token, risking exposure of test environments and potentially sensitive shipment data.",
|
||||
Regex: regexp.MustCompile(`\bEZTK(?i)[a-z0-9]{54}`),
|
||||
Regex: regexp.MustCompile(`\bEZTK(?i)[a-z0-9]{54}\b`),
|
||||
Entropy: 2,
|
||||
Keywords: []string{"EZTK"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("EZTK", "EZTK"+secrets.NewSecret(utils.AlphaNumeric("54"))),
|
||||
tps := utils.GenerateSampleSecrets("EZTK", secrets.NewSecret(`EZTK[a-zA-Z0-9]{54}`))
|
||||
tps = append(tps, secrets.NewSecret(`EZTK[a-zA-Z0-9]{54}`))
|
||||
tps = append(tps,
|
||||
"EZTK"+secrets.NewSecret(`[a-zA-Z0-9]{54}`),
|
||||
"example.com?t=EZTK"+secrets.NewSecret(`[a-zA-Z0-9]{54}`)+"&q=1",
|
||||
)
|
||||
fps := []string{
|
||||
// random base64 encoded string
|
||||
`...6wqX6fNUXA/rYqRvfQ+EZTKGqQRiRyqAFRQshGPWOIAwNWGORfKHSBnVNFtVmWYoW6PH23lkqbbDWep95C/3VmWq/edti6...`, // gitleaks:allow
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package rules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
@@ -20,11 +21,9 @@ func EtsyAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("ETSY", secrets.NewSecret(utils.AlphaNumeric("24"))),
|
||||
utils.GenerateSampleSecret("etsy", secrets.NewSecret(utils.AlphaNumeric("24"))),
|
||||
utils.GenerateSampleSecret("Etsy", secrets.NewSecret(utils.AlphaNumeric("24"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("ETSY", secrets.NewSecret(utils.AlphaNumeric("24")))
|
||||
tps = append(tps, utils.GenerateSampleSecrets("etsy", secrets.NewSecret(utils.AlphaNumeric("24")))...)
|
||||
tps = append(tps, utils.GenerateSampleSecrets("Etsy", secrets.NewSecret(utils.AlphaNumeric("24")))...)
|
||||
fps := []string{
|
||||
fmt.Sprintf(`SetSysctl = "%s"`, secrets.NewSecret(utils.AlphaNumeric("24"))),
|
||||
` if err := sysctl.SetSysctl(sysctlBridgeCallIPTables); err != nil {`,
|
||||
|
||||
@@ -19,11 +19,11 @@ func FacebookSecret() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("facebook", secrets.NewSecret(utils.Hex("32"))),
|
||||
tps := utils.GenerateSampleSecrets("facebook", secrets.NewSecret(utils.Hex("32")))
|
||||
tps = append(tps,
|
||||
`facebook_app_secret = "6dca6432e45d933e13650d1882bd5e69"`, // gitleaks:allow
|
||||
`facebook_client_access_token: 26f5fd13099f2c1331aafb86f6489692`, // gitleaks:allow
|
||||
}
|
||||
)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ func FacebookPageAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "facebook-page-access-token",
|
||||
Description: "Discovered a Facebook Page Access Token, posing a risk of unauthorized access to Facebook accounts and personal data exposure.",
|
||||
Regex: utils.GenerateUniqueTokenRegex("EAA[MC](?i)"+utils.AlphaNumeric("20,"), false),
|
||||
Entropy: 3,
|
||||
Regex: utils.GenerateUniqueTokenRegex("EAA[MC](?i)[a-z0-9]{100,}", false),
|
||||
Entropy: 4,
|
||||
Keywords: []string{"EAAM", "EAAC"},
|
||||
}
|
||||
|
||||
@@ -62,10 +62,16 @@ func FacebookPageAccessToken() *config.Rule {
|
||||
`EAAM9GOnCB9kBO2frzOAWGN2zMnZClQshlWydZCrBNdodesbwimx1mfVJgqZBP5RSpMfUzWhtjTTXHG5I1UlvlwRZCgjm3ZBVGeTYiqAAoxyED6HaUdhpGVNoPUwAuAWWFsi9OvyYBQt22DGLqMIgD7VktuCTTZCWKasz81Q822FPhMTB9VFFyClNzQ0NLZClt9zxpsMMrUZCo1VU1rL3CKavir5QTfBjfCEzHNlWAUDUV2YZD`, // gitleaks:allow
|
||||
`EAAM9GOnCB9kBO2zXpAtRBmCrsPPjdA3KeBl4tqsEpcYd09cpjm9MZCBIklZBjIQBKGIJgFwm8IE17G5pipsfRBRBEHMWxvJsL7iHLUouiprxKRQfAagw8BEEDucceqxTiDhVW2IZAQNNbf0d1JhcapAGntx5S1Csm4j0GgZB3DuUfI2HJ9aViTtdfH2vjBy0wtpXm2iamevohGfoF4NgyRHusDLjqy91uYMkfrkc`, // gitleaks:allow
|
||||
`- name: FACEBOOK_TOKEN
|
||||
value: "EAACEdEose0cBA1bad3afsf2aew"`, // gitleaks:allow
|
||||
value: "EAACEdEose0cBA1bad3afsf286JZCOV1XmV4NobAXqUXZA7U9F1UaaOdQZABvz73030MJoC3gGoQrE8IEoMl4gFA6MmQadlJQBqtRsgIcIhtelIJOJaew"`, // gitleaks:allow
|
||||
}
|
||||
fps := []string{
|
||||
`eaaaC0b75a9329fded2ffa9a02b47e0117831b82`,
|
||||
`"strict-uri-encode@npm:^2.0.0":
|
||||
version: 2.0.0
|
||||
resolution: "strict-uri-encode@npm:2.0.0"
|
||||
checksum: eaac4cf978b6fbd480f1092cab8b233c9b949bcabfc9b598dd79a758f7243c28765ef7639c876fa72940dac687181b35486ea01ff7df3e65ce3848c64822c581
|
||||
languageName: node
|
||||
linkType: hard`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -17,8 +17,6 @@ func FastlyAPIToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("fastly", secrets.NewSecret(utils.AlphaNumericExtended("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("fastly", secrets.NewSecret(utils.AlphaNumericExtended("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -17,9 +17,7 @@ func FinicityClientSecret() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("finicity", secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("finicity", secrets.NewSecret(utils.AlphaNumeric("20")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -34,8 +32,6 @@ func FinicityAPIToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("finicity", secrets.NewSecret(utils.Hex("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("finicity", secrets.NewSecret(utils.Hex("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -19,8 +19,6 @@ func FinnhubAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("finnhub", secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("finnhub", secrets.NewSecret(utils.AlphaNumeric("20")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -19,8 +19,6 @@ func FlickrAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("flickr", secrets.NewSecret(utils.AlphaNumeric("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("flickr", secrets.NewSecret(utils.AlphaNumeric("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
)
|
||||
|
||||
func FlutterwavePublicKey() *config.Rule {
|
||||
@@ -19,9 +20,7 @@ func FlutterwavePublicKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("flutterwavePubKey", "FLWPUBK_TEST-"+secrets.NewSecret(utils.Hex("32"))+"-X"),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("flutterwavePubKey", "FLWPUBK_TEST-"+secrets.NewSecret(utils.Hex("32"))+"-X")
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -36,9 +35,7 @@ func FlutterwaveSecretKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("flutterwavePubKey", "FLWSECK_TEST-"+secrets.NewSecret(utils.Hex("32"))+"-X"),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("flutterwavePubKey", "FLWSECK_TEST-"+secrets.NewSecret(utils.Hex("32"))+"-X")
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -53,8 +50,6 @@ func FlutterwaveEncKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("flutterwavePubKey", "FLWSECK_TEST-"+secrets.NewSecret(utils.Hex("12"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("flutterwavePubKey", "FLWSECK_TEST-"+secrets.NewSecret(utils.Hex("12")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -20,23 +20,26 @@ func FlyIOAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
// fo1_
|
||||
utils.GenerateSampleSecret("fly", secrets.NewSecret(`fo1_[\w-]{43}`)),
|
||||
// fo1_
|
||||
tps := utils.GenerateSampleSecrets("fly", secrets.NewSecret(`fo1_[\w-]{43}`))
|
||||
tps = append(tps,
|
||||
`Fly access token: fo1_8rz-j7r2eqJ2U7affEOO3HJN0j63DInyog3eV-glQSc
|
||||
`,
|
||||
`=============================================================================================================
|
||||
|
||||
fo1_BtKlzvfztw0M2hlLgTdsfPgDFiwM2jJjQXXy6I2pjuQ
|
||||
fly deploy`,
|
||||
// fm1
|
||||
utils.GenerateSampleSecret("fly", secrets.NewSecret(`fm1[ar]_[a-zA-Z0-9+\/]{100,}={0,3}`)),
|
||||
fly deploy`)
|
||||
// fm1
|
||||
tps = append(tps, utils.GenerateSampleSecrets("fly", secrets.NewSecret(`fm1[ar]_[a-zA-Z0-9+\/]{100,}={0,3}`))...)
|
||||
tps = append(tps,
|
||||
`ENV FLY_API_TOKEN="FlyV1 fm1r_lJPECAAAAAAAAMqcxBBLMJKXYKJiT0CI58XmukX/wrVodHlwczovL2FwaS5mbHkuaW8vdjGWAJLOAAFmXh8Lk7lodHRwczovL2FwaS5mbHkuaW8vYWFhL3YxxDy5OfA2M6K6aLEoEDKxehojbj+8ZT9IrXCF5sL/r8m6/1gylwySsNxpD40wnpd/G2ZdjwVaQev1kEuFUgzERxPbtWHDNa+NYIZwbKN6b7/JxdbUprq0M10HI4fwtlxhqhdA/mMaMw70EC4TsfJyghIL98KP4ry5AaXiroRdjrSsFExc/xRCDZKUA5GBzgATuNsfBZGCp2J1aWxkZXIfondnHwHEIMa6NWc4b52S+UY7vjPdwKrz00Uzrc1830mOHzQNLun7,fm1a_lJPERxPbtWHDNa+NYIZwbKN6b7/JxdbUprq0M10HI4fwtlxhqhdA/mMaMw70EC4TsfJyghIL98KP4ry4AaXiroRdjrSsFExc/xRCxBCVlAoRzKV/+qYkxuipIbIcw7lodHRwczovL2FwaS5mbHkuaW8vYWFhL3YxlgSSzmS4Y7nPAAAAASCwgdcKkc4AAUktDMQQURck2h+upbiOrW66Nf5SA8QgrD03xlWju1WQi0AUhlk7YYFzOLDfhRyJ6nEziO37NUE="`,
|
||||
// fm2
|
||||
utils.GenerateSampleSecret("fly", secrets.NewSecret(`fm2_[a-zA-Z0-9+\/]{100,}={0,3}`)),
|
||||
)
|
||||
// fm2
|
||||
tps = append(tps, utils.GenerateSampleSecrets("fly", secrets.NewSecret(`fm2_[a-zA-Z0-9+\/]{100,}={0,3}`))...)
|
||||
tps = append(tps,
|
||||
`# FLY_API_TOKEN: FlyV1 fm2_lJPECAAAAAAAAyZtxBD1hSZ7L5leXsj64ZbDlkm/wrVodHRwczovL2FwaS5mbHkuaW8vdjGWAJLOAAwMDB8Lk7lodHRwczovL2FwaS5mbHkuaW8vYWFhL3YxxDwDnhgJj/ML/nRKMiAYgnvXfNacrGWffj5TdfgGY2LU0ZetT7WzTLQQMO8cN2nRTztl/xLjnnZg5pBwFonETmhNA6Yl0X1tatt8ezA0UjVQiJr93VQ7qAmD5GG2Ce5txhbQv3tmIGsvaC7BOkIqAiR273bhZkO44AYsrCPr2XF8W6Twk7NyU+3UUeDwjw2SlAORgc4APu7vHwWRgqdidWlsZGVyH6J3Zx8BxCAlmLbu1HQDg8ZAGKKmEt4Mbnbqli6lbzBDHsawhcUF4A==,fm2_lJPETmhNA6Yl0X1tatt8ezA0UjVQiJr93VQ7qAmD5GG2Ce5txhbQv3tmIGsvaC7BOkIqAij273bhZkO44AYsrCPr2XF8W6Twk7NyU+3UUeDwj8QQbn07DOV+7SmoLj/uT+dbr8O5aHR0cHM6Ly9hcGkuZmx5LmlvL2FhYS92MZgEks5mqfbvzwAAAAE9PYz9F84AC7QACpHOAAu0AAzEEFfW3B+SzffV/KrAYa8qqpnEIIlD6DqZMZQ9Kt7fEenCCOLA+tUSJ+kmEFIUcc83npOI`,
|
||||
`"BindToParentToken": "FlyV1 fm2_lJPEEKnzKy0lkwV3B+WIlmrdwejEEFv5qmevHU4fMs+2Gr6oOiPC2SAyOTc0NWI4ZmJlNjBlNjJmZTgzNTkxOThhZWE4MjY0M5IMxAMBAgPEIH7VG8u74KwO62hmx8SZO8WaU5o1g3W2IVc7QN6T1VTr",`,
|
||||
}
|
||||
)
|
||||
fps := []string{
|
||||
// fo1_
|
||||
`resource "doppler_integration_flyio" "prod" {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
)
|
||||
|
||||
func FrameIO() *config.Rule {
|
||||
@@ -18,8 +19,6 @@ func FrameIO() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("frameio", "fio-u-"+secrets.NewSecret(utils.AlphaNumericExtended("64"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("frameio", "fio-u-"+secrets.NewSecret(utils.AlphaNumericExtended("64")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
func Freemius() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
RuleID: "freemius-secret-key",
|
||||
Description: "Detected a Freemius secret key, potentially exposing sensitive information.",
|
||||
Regex: regexp.MustCompile(`(?i)["']secret_key["']\s*=>\s*["'](sk_[\S]{29})["']`),
|
||||
Keywords: []string{"secret_key"},
|
||||
Path: regexp.MustCompile(`(?i)\.php$`),
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := map[string]string{
|
||||
"file.php": `$config = array(
|
||||
"secret_key" => "sk_ubb4yN3mzqGR2x8#P7r5&@*xC$utE",
|
||||
);`,
|
||||
}
|
||||
// It's only used in PHP SDK snippet.
|
||||
// see https://freemius.com/help/documentation/wordpress-sdk/integrating-freemius-sdk/
|
||||
fps := map[string]string{
|
||||
// Invalid format: missing quotes around `secret_key`.
|
||||
"foo.php": `$config = array(
|
||||
secret_key => "sk_abcdefghijklmnopqrstuvwxyz123",
|
||||
);`,
|
||||
// Invalid format: missing quotes around the key value.
|
||||
"bar.php": `$config = array(
|
||||
"secret_key" => sk_abcdefghijklmnopqrstuvwxyz123,
|
||||
);`,
|
||||
// Invalid: different key name.
|
||||
"baz.php": `$config = array(
|
||||
"other_key" => "sk_abcdefghijklmnopqrstuvwxyz123",
|
||||
);`,
|
||||
// Invalid: file extension, should validate only .php files.
|
||||
"foo.html": `$config = array(
|
||||
"secret_key" => "sk_ubb4yN3mzqGR2x8#P7r5&@*xC$utE",
|
||||
);`,
|
||||
}
|
||||
|
||||
return utils.ValidateWithPaths(r, tps, fps)
|
||||
}
|
||||
@@ -19,8 +19,6 @@ func FreshbooksAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("freshbooks", secrets.NewSecret(utils.AlphaNumeric("64"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("freshbooks", secrets.NewSecret(utils.AlphaNumeric("64")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
)
|
||||
|
||||
// TODO this one could probably use some work
|
||||
@@ -38,11 +39,11 @@ func GCPAPIKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gcp", secrets.NewSecret(`AIza[\w-]{35}`)),
|
||||
tps := utils.GenerateSampleSecrets("gcp", secrets.NewSecret(`AIza[\w-]{35}`))
|
||||
tps = append(tps,
|
||||
// non-word character at end
|
||||
`AIzaSyNHxIf32IQ1a1yjl3ZJIqKZqzLAK1XhDk-`, // gitleaks:allow
|
||||
}
|
||||
)
|
||||
fps := []string{
|
||||
`GWw4hjABFzZCGiRpmlDyDdo87Jn9BN9THUA47muVRNunLxsa82tMAdvmrhOqNkRKiYMEAFbTJAIzaTesb6Tscfcni8vIpWZqNCXFDFslJtVSvFDq`, // text boundary start
|
||||
`AIzaTesb6Tscfcni8vIpWZqNCXFDFslJtVSvFDqabcd123`, // text boundary end
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func GenericCredential() *config.Rule {
|
||||
@@ -41,68 +42,80 @@ func GenericCredential() *config.Rule {
|
||||
{
|
||||
Description: "Allowlist for Generic API Keys",
|
||||
MatchCondition: config.AllowlistMatchOr,
|
||||
RegexTarget: "match",
|
||||
Regexes: []*regexp.Regexp{
|
||||
regexp.MustCompile(`(?i)(` +
|
||||
// Access
|
||||
`accessor` +
|
||||
`|access[_.-]?id` +
|
||||
// API
|
||||
`|api[_.-]?(version|id)` + // version/id -> not a secret
|
||||
`|rapid|capital` + // common words containing "api"
|
||||
`|[a-z0-9-]*?api[a-z0-9-]*?:jar:` + // Maven META-INF dependencies that contain "api" in the name.
|
||||
// Auth
|
||||
`|author` +
|
||||
`|X-MS-Exchange-Organization-Auth` + // email header
|
||||
`|Authentication-Results` + // email header
|
||||
// Credentials
|
||||
`|(?-i:(?:c|jobC)redentials?Id|withCredentials)` + // Jenkins plugins
|
||||
`|(credentials?[_.-]?id|withCredentials)` + // Jenkins plugins
|
||||
// Key
|
||||
`|key[_.-]?(alias|board|code|ring|stone|storetype|word|up|down|left|right)` +
|
||||
`|(bucket|foreign|hot|natural|primary|schema|sequence)[_.-]?key` +
|
||||
`|key[_.-]?(alias|board|code|ring|selector|size|stone|storetype|word|up|down|left|right)` +
|
||||
`|key(store|tab)[_.-]?(file|path)` +
|
||||
`|issuerkeyhash` + // part of ssl cert
|
||||
`|(bucket|primary|foreign|natural|hot)[_.-]?key` +
|
||||
`|(?-i:[DdMm]onkey|[DM]ONKEY)|keying` + // common words containing "key"
|
||||
// Secret
|
||||
`|(secret)[_.-]?name` + // name of e.g. env variable
|
||||
`|UserSecretsId` + // https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-8.0&tabs=linux
|
||||
|
||||
// Token
|
||||
|
||||
// General
|
||||
`|(api|credentials|token)[_.-]?(endpoint|ur[il])` +
|
||||
`|public[_.-]?(key|token)` + // public key -> not a secret
|
||||
`|(key|token)[_.-]?file` +
|
||||
`)`),
|
||||
},
|
||||
RegexTarget: "match",
|
||||
StopWords: DefaultStopWords,
|
||||
StopWords: DefaultStopWords,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
tps := utils.GenerateSampleSecrets("generic", "CLOJARS_34bf0e88955ff5a1c328d6a7491acc4f48e865a7b8dd4d70a70749037443") //gitleaks:allow
|
||||
tps = append(tps, utils.GenerateSampleSecrets("generic", "Zf3D0LXCM3EIMbgJpUNnkRtOfOueHznB")...)
|
||||
tps = append(tps,
|
||||
// Access
|
||||
`'access_token': 'eyJ0eXAioiJKV1slS3oASx=='`,
|
||||
|
||||
// API
|
||||
`some_api_token_123 = "` + newPlausibleSecret(`[a-zA-Z0-9]{60}`) + `"`,
|
||||
`some_api_token_123 = "`+newPlausibleSecret(`[a-zA-Z0-9]{60}`)+`"`,
|
||||
|
||||
// Auth
|
||||
// Credentials
|
||||
`"credentials" : "0afae57f3ccfd9d7f5767067bc48b30f719e271ba470488056e37ab35d4b6506"`,
|
||||
`creds = ` + newPlausibleSecret(`[a-zA-Z0-9]{30}`),
|
||||
`creds = `+newPlausibleSecret(`[a-zA-Z0-9]{30}`),
|
||||
|
||||
// Key
|
||||
`private-key: ` + newPlausibleSecret(`[a-zA-Z0-9\-_.=]{100}`),
|
||||
`private-key: `+newPlausibleSecret(`[a-zA-Z0-9\-_.=]{100}`),
|
||||
|
||||
// Password
|
||||
`passwd = ` + newPlausibleSecret(`[a-zA-Z0-9\-_.=]{30}`),
|
||||
`passwd = `+newPlausibleSecret(`[a-zA-Z0-9\-_.=]{30}`),
|
||||
// TODO: `ID=dbuser;password=` + newPlausibleSecret(`[a-zA-Z0-9+/]{30}={0,3}`) + `;"`,
|
||||
|
||||
// Secret
|
||||
`"client_secret" : "6da89121079f83b2eb6acccf8219ea982c3d79bccc3e9c6a85856480661f8fde",`,
|
||||
`mySecretString=` + newPlausibleSecret(`[a-zA-Z0-9]{30}`),
|
||||
`todo_secret_do_not_commit = ` + newPlausibleSecret(`[a-zA-Z0-9]{30}`),
|
||||
`mySecretString=`+newPlausibleSecret(`[a-zA-Z0-9]{30}`),
|
||||
`todo_secret_do_not_commit = `+newPlausibleSecret(`[a-zA-Z0-9]{30}`),
|
||||
|
||||
// Token
|
||||
utils.GenerateSampleSecret("generic", "CLOJARS_34bf0e88955ff5a1c328d6a7491acc4f48e865a7b8dd4d70a70749037443"), //gitleaks:allow
|
||||
utils.GenerateSampleSecret("generic", "Zf3D0LXCM3EIMbgJpUNnkRtOfOueHznB"),
|
||||
}
|
||||
)
|
||||
fps := []string{
|
||||
// Access
|
||||
`"accessor":"rA1wk0Y45YCufyfq",`,
|
||||
`report_access_id: e8e4df51-2054-49b0-ab1c-516ac95c691d`,
|
||||
|
||||
// API
|
||||
`this.ultraPictureBox1.Name = "ultraPictureBox1";`,
|
||||
@@ -110,15 +123,26 @@ func GenericCredential() *config.Rule {
|
||||
`event-bus-message-api:rc0.15.0_20231217_1420-SNAPSHOT'`,
|
||||
`COMMUNICATION_API_VERSION=rc0.13.0_20230412_0712-SNAPSHOT`,
|
||||
`MantleAPI_version=9a038989604e8da62ecddbe2094b16ce1b778be1`,
|
||||
`[DEBUG] org.slf4j.slf4j-api:jar:1.7.8.:compile (version managed from default)`,
|
||||
`[DEBUG] org.neo4j.neo4j-graphdb-api:jar:3.5.12:test`,
|
||||
`apiUrl=apigee.corpint.com`,
|
||||
// TODO: Jetbrains IML files (requires line-level allowlist).
|
||||
//`<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.directory.api:api-asn1-api:1.0.0-M20" level="projcet" />`
|
||||
|
||||
// Auth
|
||||
`author = "james.fake@ymail.com",`,
|
||||
`X-MS-Exchange-Organization-AuthSource: sm02915.int.contoso.com`,
|
||||
`Authentication-Results: 5h.ca.iphmx.com`,
|
||||
|
||||
// Credentials
|
||||
`withCredentials([usernamePassword(credentialsId: '29f63271-dc2f-4734-8221-5b31b5169bac', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {`,
|
||||
`credentialsId: 'ff083f76-7804-4ef1-80e4-fe975bb9141b'`,
|
||||
`jobCredentialsId: 'f4aeb6bc-2a25-458a-8111-9be9e502c0e7'`,
|
||||
` "credentialId": "B9mTcFSck2LzJO2S3ols63",`,
|
||||
`environment {
|
||||
CREDENTIALS_ID = "K8S_CRED"
|
||||
}`,
|
||||
`dev.credentials.url=dev-lb1.api.f4ke.com:5215`,
|
||||
|
||||
// Key
|
||||
`keyword: "Befaehigung_P2"`,
|
||||
@@ -135,6 +159,22 @@ func GenericCredential() *config.Rule {
|
||||
//`<TAR key="REF_ID_923.properties" value="/opts/config/alias/"/>`,
|
||||
`<key tag="SecurityIdentifier" name="SecurityIdentifier" type="STRING" />`,
|
||||
//`packageKey":` + newPlausibleSecret(`[a-zA-Z0-9\-_.=]{30}`),
|
||||
`schemaKey = 'DOC_Vector_5_32'`,
|
||||
`sequenceKey = "18"`,
|
||||
`app.keystore.file=env/cert.p12`,
|
||||
`-DKEYTAB_FILE=/tmp/app.keytab`,
|
||||
` doc.Security.KeySize = PdfEncryptionKeySize.Key128Bit;`,
|
||||
`o.keySelector=n,o.haKey=!1,`,
|
||||
// TODO: Requires line-level allowlists.
|
||||
//`<add key="SchemaTable" value="G:\SchemaTable.xml" />`,
|
||||
// `secret:
|
||||
//secretName: app-decryption-secret
|
||||
//items:
|
||||
// - key: app-k8s.yml
|
||||
// path: app-k8s.yml`,
|
||||
|
||||
// TODO: https://learn.microsoft.com/en-us/windows/apps/design/style/xaml-theme-resources
|
||||
//`<Color x:Key="NormalBrushGradient1">#FFBAE4FF</Color>`,
|
||||
|
||||
// Password
|
||||
`password combination.
|
||||
@@ -144,10 +184,13 @@ R5: Regulatory--21`,
|
||||
|
||||
// Secret
|
||||
`LLM_SECRET_NAME = "NEXUS-GPT4-API-KEY"`,
|
||||
` <UserSecretsId>79a3edd0-2092-40a2-a04d-dcb46d5ca9ed</UserSecretsId>`,
|
||||
|
||||
// Token
|
||||
` access_token_url='https://github.com/login/oauth/access_token',`,
|
||||
`publicToken = "9Cnzj4p4WGeKLs1Pt8QuKUpRKfFLfRYC9AIKjbJTWit"`,
|
||||
`<SourceFile SourceLocation="F:\Extracts\" TokenFile="RTL_INST_CODE.cer">`,
|
||||
// TODO: `TOKEN_AUDIENCE = "25872395-ed3a-4703-b647-22ec53f3683c"`,
|
||||
|
||||
// General
|
||||
`clientId = "73082700-1f09-405b-80d0-3131bfd6272d"`,
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
)
|
||||
|
||||
var githubAllowlist = []config.Allowlist{
|
||||
@@ -29,9 +30,7 @@ func GitHubPat() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("github", "ghp_"+secrets.NewSecret(utils.AlphaNumeric("36"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("github", "ghp_"+secrets.NewSecret(utils.AlphaNumeric("36")))
|
||||
fps := []string{
|
||||
"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
}
|
||||
@@ -49,9 +48,7 @@ func GitHubFineGrainedPat() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("github", "github_pat_"+secrets.NewSecret(utils.AlphaNumeric("82"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("github", "github_pat_"+secrets.NewSecret(utils.AlphaNumeric("82")))
|
||||
fps := []string{
|
||||
"github_pat_xxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
}
|
||||
@@ -69,9 +66,7 @@ func GitHubOauth() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("github", "gho_"+secrets.NewSecret(utils.AlphaNumeric("36"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("github", "gho_"+secrets.NewSecret(utils.AlphaNumeric("36")))
|
||||
fps := []string{
|
||||
"gho_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
}
|
||||
@@ -90,10 +85,8 @@ func GitHubApp() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("github", "ghu_"+secrets.NewSecret(utils.AlphaNumeric("36"))),
|
||||
utils.GenerateSampleSecret("github", "ghs_"+secrets.NewSecret(utils.AlphaNumeric("36"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("github", "ghs_"+secrets.NewSecret(utils.AlphaNumeric("36")))
|
||||
tps = append(tps, utils.GenerateSampleSecrets("github", "ghu_"+secrets.NewSecret(utils.AlphaNumeric("36")))...)
|
||||
fps := []string{
|
||||
"ghu_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
"ghs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
@@ -112,9 +105,7 @@ func GitHubRefresh() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("github", "ghr_"+secrets.NewSecret(utils.AlphaNumeric("36"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("github", "ghr_"+secrets.NewSecret(utils.AlphaNumeric("36")))
|
||||
fps := []string{
|
||||
"ghr_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
// overview with all GitLab tokens:
|
||||
@@ -14,15 +14,13 @@ import (
|
||||
|
||||
func GitlabCiCdJobToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitLab CI/CD Job Token, potential access to projects and some APIs on behalf of a user while the CI job is running.",
|
||||
RuleID: "gitlab-cicd-job-token",
|
||||
Description: "Identified a GitLab CI/CD Job Token, potential access to projects and some APIs on behalf of a user while the CI job is running.",
|
||||
Regex: regexp.MustCompile(`glcbt-[0-9a-zA-Z]{1,5}_[0-9a-zA-Z_-]{20}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glcbt-"},
|
||||
}
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glcbt-"+secrets.NewSecret(utils.AlphaNumeric("5"))+"_"+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("gitlab", "glcbt-"+secrets.NewSecret(utils.AlphaNumeric("5"))+"_"+secrets.NewSecret(utils.AlphaNumeric("20")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -42,71 +40,61 @@ func GitlabDeployToken() *config.Rule {
|
||||
|
||||
func GitlabFeatureFlagClientToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitLab feature flag client token, risks exposing user lists and features flags used by an application.",
|
||||
RuleID: "gitlab-feature-flag-client-token",
|
||||
Description: "Identified a GitLab feature flag client token, risks exposing user lists and features flags used by an application.",
|
||||
Regex: regexp.MustCompile(`glffct-[0-9a-zA-Z_\-]{20}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glffct-"},
|
||||
}
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glffct-"+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("gitlab", "glffct-"+secrets.NewSecret(utils.AlphaNumeric("20")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func GitlabFeedToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitLab feed token, risking exposure of user data.",
|
||||
RuleID: "gitlab-feed-token",
|
||||
Description: "Identified a GitLab feed token, risking exposure of user data.",
|
||||
Regex: regexp.MustCompile(`glft-[0-9a-zA-Z_\-]{20}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glft-"},
|
||||
}
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glft-"+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("gitlab", "glft-"+secrets.NewSecret(utils.AlphaNumeric("20")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func GitlabIncomingMailToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitLab incoming mail token, risking manipulation of data sent by mail.",
|
||||
RuleID: "gitlab-incoming-mail-token",
|
||||
Description: "Identified a GitLab incoming mail token, risking manipulation of data sent by mail.",
|
||||
Regex: regexp.MustCompile(`glimt-[0-9a-zA-Z_\-]{25}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glimt-"},
|
||||
}
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glimt-"+secrets.NewSecret(utils.AlphaNumeric("25"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("gitlab", "glimt-"+secrets.NewSecret(utils.AlphaNumeric("25")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func GitlabKubernetesAgentToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitLab Kubernetes Agent token, risking access to repos and registry of projects connected via agent.",
|
||||
RuleID: "gitlab-kubernetes-agent-token",
|
||||
Description: "Identified a GitLab Kubernetes Agent token, risking access to repos and registry of projects connected via agent.",
|
||||
Regex: regexp.MustCompile(`glagent-[0-9a-zA-Z_\-]{50}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glagent-"},
|
||||
}
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glagent-"+secrets.NewSecret(utils.AlphaNumeric("50"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("gitlab", "glagent-"+secrets.NewSecret(utils.AlphaNumeric("50")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func GitlabOauthAppSecret() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Identified a GitLab OIDC Application Secret, risking access to apps using GitLab as authentication provider.",
|
||||
RuleID: "gitlab-oauth-app-secret",
|
||||
Description: "Identified a GitLab OIDC Application Secret, risking access to apps using GitLab as authentication provider.",
|
||||
Regex: regexp.MustCompile(`gloas-[0-9a-zA-Z_\-]{64}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"gloas-"},
|
||||
}
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "gloas-"+secrets.NewSecret(utils.AlphaNumeric("64"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("gitlab", "gloas-"+secrets.NewSecret(utils.AlphaNumeric("64")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -119,15 +107,31 @@ func GitlabPat() *config.Rule {
|
||||
Keywords: []string{"glpat-"},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glpat-"+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
// validate
|
||||
tps := utils.GenerateSampleSecrets("gitlab", "glpat-"+secrets.NewSecret(utils.AlphaNumeric("20")))
|
||||
fps := []string{
|
||||
"glpat-XXXXXXXXXXX-XXXXXXXX",
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
|
||||
func GitlabPatRoutable() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "gitlab-pat-routable",
|
||||
Description: "Identified a GitLab Personal Access Token (routable), risking unauthorized access to GitLab repositories and codebase exposure.",
|
||||
Regex: regexp.MustCompile(`\bglpat-[0-9a-zA-Z_-]{27,300}\.[0-9a-z]{2}[0-9a-z]{7}\b`),
|
||||
Entropy: 4,
|
||||
Keywords: []string{"glpat-"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := utils.GenerateSampleSecrets("gitlab", "glpat-"+secrets.NewSecret(utils.AlphaNumeric("27"))+"."+secrets.NewSecret(utils.AlphaNumeric("2"))+secrets.NewSecret(utils.AlphaNumeric("7")))
|
||||
fps := []string{
|
||||
"glpat-xxxxxxxx-xxxxxxxxxxxxxxxxxx.xxxxxxxxx",
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
|
||||
func GitlabPipelineTriggerToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "gitlab-ptt",
|
||||
@@ -137,9 +141,8 @@ func GitlabPipelineTriggerToken() *config.Rule {
|
||||
Keywords: []string{"glptt-"},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glptt-"+secrets.NewSecret(utils.Hex("40"))),
|
||||
}
|
||||
// validate
|
||||
tps := utils.GenerateSampleSecrets("gitlab", "glptt-"+secrets.NewSecret(utils.Hex("40")))
|
||||
fps := []string{
|
||||
"glptt-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
}
|
||||
@@ -155,9 +158,7 @@ func GitlabRunnerRegistrationToken() *config.Rule {
|
||||
Keywords: []string{"GR1348941"},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "GR1348941"+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("gitlab", "GR1348941"+secrets.NewSecret(utils.AlphaNumeric("20")))
|
||||
fps := []string{
|
||||
"GR134894112312312312312312312",
|
||||
"GR1348941XXXXXXXXXXXXXXXXXXXX",
|
||||
@@ -167,45 +168,40 @@ func GitlabRunnerRegistrationToken() *config.Rule {
|
||||
|
||||
func GitlabRunnerAuthenticationToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discovered a GitLab Runner Authentication Token, posing a risk to CI/CD pipeline integrity and unauthorized access.",
|
||||
RuleID: "gitlab-runner-authentication-token",
|
||||
Description: "Discovered a GitLab Runner Authentication Token, posing a risk to CI/CD pipeline integrity and unauthorized access.",
|
||||
Regex: regexp.MustCompile(`glrt-[0-9a-zA-Z_\-]{20}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glrt-"},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glrt-"+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("gitlab", "glrt-"+secrets.NewSecret(utils.AlphaNumeric("20")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func GitlabScimToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discovered a GitLab SCIM Token, posing a risk to unauthorized access for a organization or instance.",
|
||||
RuleID: "gitlab-scim-token",
|
||||
Description: "Discovered a GitLab SCIM Token, posing a risk to unauthorized access for a organization or instance.",
|
||||
Regex: regexp.MustCompile(`glsoat-[0-9a-zA-Z_\-]{20}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"glsoat-"},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "glsoat-"+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("gitlab", "glsoat-"+secrets.NewSecret(utils.AlphaNumeric("20")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func GitlabSessionCookie() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discovered a GitLab Session Cookie, posing a risk to unauthorized access to a user account.",
|
||||
RuleID: "gitlab-session-cookie",
|
||||
Description: "Discovered a GitLab Session Cookie, posing a risk to unauthorized access to a user account.",
|
||||
Regex: regexp.MustCompile(`_gitlab_session=[0-9a-z]{32}`),
|
||||
Entropy: 3,
|
||||
Keywords: []string{"_gitlab_session="},
|
||||
}
|
||||
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitlab", "_gitlab_session="+secrets.NewSecret(utils.AlphaNumeric("32"))),
|
||||
}
|
||||
// validate
|
||||
tps := utils.GenerateSampleSecrets("gitlab", "_gitlab_session="+secrets.NewSecret(utils.AlphaNumeric("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -20,9 +20,6 @@ func GitterAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gitter",
|
||||
secrets.NewSecret(utils.AlphaNumericExtendedShort("40"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("gitter", secrets.NewSecret(utils.AlphaNumericExtendedShort("40")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -20,8 +20,6 @@ func GoCardless() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("gocardless", "live_"+secrets.NewSecret(utils.AlphaNumericExtended("40"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("gocardless", "live_"+secrets.NewSecret(utils.AlphaNumericExtended("40")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -17,9 +17,7 @@ func GrafanaApiKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("grafana-api-key", "eyJrIjoi"+secrets.NewSecret(utils.AlphaNumeric("70"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("grafana-api-key", "eyJrIjoi"+secrets.NewSecret(utils.AlphaNumeric("70")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -34,7 +32,8 @@ func GrafanaCloudApiToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
tps := utils.GenerateSampleSecrets("grafana-cloud-api-token", "glc_"+secrets.NewSecret(utils.AlphaNumeric("32")))
|
||||
tps = append(tps,
|
||||
utils.GenerateSampleSecret("grafana-cloud-api-token",
|
||||
"glc_"+
|
||||
secrets.NewSecret(utils.AlphaNumeric("32"))),
|
||||
@@ -42,7 +41,7 @@ func GrafanaCloudApiToken() *config.Rule {
|
||||
// TODO:
|
||||
//` loki:
|
||||
//endpoint: https://322137:glc_eyJvIjoiNzQ0NTg3IiwibiI7InN0YWlrLTQ3NTgzMC1obC13cml0ZS1oYW5kc29uJG9raSIsImsiOiI4M2w3cmdYUlBoMTUyMW1lMU023nl5UDUiLCJtIjp7IOIiOiJ1cyJ9fQ==@logs-prod4.grafana.net/loki/api/v1/push`,
|
||||
}
|
||||
)
|
||||
fps := []string{
|
||||
// Low entropy.
|
||||
`glc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,
|
||||
@@ -70,14 +69,10 @@ func GrafanaServiceAccountToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("grafana-service-account-token",
|
||||
"glsa_"+
|
||||
secrets.NewSecret(utils.AlphaNumeric("32"))+
|
||||
"_"+
|
||||
secrets.NewSecret((utils.Hex("8")))),
|
||||
tps := utils.GenerateSampleSecrets("grafana-service-account-token", "glsa_"+secrets.NewSecret(utils.AlphaNumeric("32"))+"_"+secrets.NewSecret(utils.Hex("8")))
|
||||
tps = append(tps,
|
||||
`'Authorization': 'Bearer glsa_pITqMOBIfNH2KL4PkXJqmTyQl0D9QGxF_486f63e1'`,
|
||||
}
|
||||
)
|
||||
fps := []string{
|
||||
"glsa_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_AAAAAAAA",
|
||||
}
|
||||
|
||||
@@ -3,10 +3,11 @@ package rules
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
func HarnessApiKey() *config.Rule {
|
||||
@@ -19,10 +20,8 @@ func HarnessApiKey() *config.Rule {
|
||||
}
|
||||
|
||||
// Generate a sample secret for validation
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("harness", "pat."+secrets.NewSecret(utils.AlphaNumeric("22"))+"."+secrets.NewSecret(utils.AlphaNumeric("24"))+"."+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
utils.GenerateSampleSecret("harness", "sat."+secrets.NewSecret(utils.AlphaNumeric("22"))+"."+secrets.NewSecret(utils.AlphaNumeric("24"))+"."+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("harness", "pat."+secrets.NewSecret(utils.AlphaNumeric("22"))+"."+secrets.NewSecret(utils.AlphaNumeric("24"))+"."+secrets.NewSecret(utils.AlphaNumeric("20")))
|
||||
tps = append(tps, utils.GenerateSampleSecrets("harness", "sat."+secrets.NewSecret(utils.AlphaNumeric("22"))+"."+secrets.NewSecret(utils.AlphaNumeric("24"))+"."+secrets.NewSecret(utils.AlphaNumeric("20")))...)
|
||||
|
||||
// validate the rule
|
||||
return utils.Validate(r, tps, nil)
|
||||
|
||||
@@ -2,11 +2,12 @@ package rules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
)
|
||||
|
||||
func HashiCorpTerraform() *config.Rule {
|
||||
@@ -20,10 +21,10 @@ func HashiCorpTerraform() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("hashicorpToken", secrets.NewSecret(utils.Hex("14"))+".atlasv1."+secrets.NewSecret(utils.AlphaNumericExtended("60,70"))),
|
||||
tps := utils.GenerateSampleSecrets("hashicorpToken", secrets.NewSecret(utils.Hex("14"))+".atlasv1."+secrets.NewSecret(utils.AlphaNumericExtended("60,70")))
|
||||
tps = append(tps,
|
||||
`#token = "hE1hlYILrSqpqh.atlasv1.ARjZuyzl33F71WR55s6ln5GQ1HWIwTDDH3MiRjz7OnpCfaCb1RCF5zGaSncCWmJdcYA"`,
|
||||
}
|
||||
)
|
||||
fps := []string{
|
||||
`token = "xxxxxxxxxxxxxx.atlasv1.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"`, // low entropy
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func VaultServiceToken() *config.Rule {
|
||||
@@ -28,12 +30,13 @@ func VaultServiceToken() *config.Rule {
|
||||
// validate
|
||||
tps := []string{
|
||||
// Old
|
||||
utils.GenerateSampleSecret("vault", "s."+secrets.NewSecret(utils.AlphaNumeric("24"))),
|
||||
utils.GenerateSampleSecret("vault", secrets.NewSecret(`s\.[0-9][a-zA-Z0-9]{23}`)),
|
||||
`token: s.ZC9Ecf4M5g9o34Q6RkzGsj0z`,
|
||||
// New
|
||||
utils.GenerateSampleSecret("vault", "hvs."+secrets.NewSecret(utils.AlphaNumericExtendedShort("90"))),
|
||||
utils.GenerateSampleSecret("vault", secrets.NewSecret(`hvs\.[0-9][\w\-]{89}`)),
|
||||
`-vaultToken hvs.CAESIP2jTxc9S2K7Z6CtcFWQv7-044m_oSsxnPE1H3nF89l3GiYKHGh2cy5sQmlIZVNyTWJNcDRsYWJpQjlhYjVlb1cQh6PL8wEYAg"`, // longer than 100 chars
|
||||
}
|
||||
|
||||
fps := []string{
|
||||
// Old
|
||||
` credentials: new AWS.SharedIniFileCredentials({ profile: '<YOUR_PROFILE>' })`, // word boundary start
|
||||
@@ -60,9 +63,7 @@ func VaultBatchToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("vault", "hvb."+secrets.NewSecret(utils.AlphaNumericExtendedShort("138"))),
|
||||
`hvb.AAAAAQJgxDgqsGNorpoOR7hPZ5SU-ynBvCl764jyRP_fnX7WvkdkDzGjbLNGdPdtlY33Als2P36yDZueqzfdGw9RsaTeaYXSH7E4RYSWuRoQ9YRKIw8o7mDDY2ZcT3KOB7RwtW1w1FN2eDqcy_sbCjXPaM1iBVH-mqMSYRmRd2nb5D1SJPeBzIYRqSglLc31wUGN7xEzyrKUczqOKsIcybQA`, // gitleaks:allow
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("vault", "hvb."+secrets.NewSecret(utils.AlphaNumericExtendedShort("138")))
|
||||
tps = append(tps, `hvb.AAAAAQJgxDgqsGNorpoOR7hPZ5SU-ynBvCl764jyRP_fnX7WvkdkDzGjbLNGdPdtlY33Als2P36yDZueqzfdGw9RsaTeaYXSH7E4RYSWuRoQ9YRKIw8o7mDDY2ZcT3KOB7RwtW1w1FN2eDqcy_sbCjXPaM1iBVH-mqMSYRmRd2nb5D1SJPeBzIYRqSglLc31wUGN7xEzyrKUczqOKsIcybQA`) // gitleaks:allow
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
@@ -16,9 +17,10 @@ func Heroku() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
tps := utils.GenerateSampleSecrets("heroku", secrets.NewSecret(utils.Hex8_4_4_4_12()))
|
||||
tps = append(tps,
|
||||
`const HEROKU_KEY = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
`heroku_api_key = "832d2129-a846-4e27-99f4-7004b6ad53ef"`, // gitleaks:allow
|
||||
}
|
||||
)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
@@ -17,8 +18,9 @@ func HubSpot() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
tps := utils.GenerateSampleSecrets("hubspot", secrets.NewSecret(utils.Hex8_4_4_4_12()))
|
||||
tps = append(tps,
|
||||
`const hubspotKey = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
}
|
||||
)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -2,9 +2,8 @@ package rules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
@@ -18,7 +17,7 @@ func HuggingFaceAccessToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "huggingface-access-token",
|
||||
Description: "Discovered a Hugging Face Access token, which could lead to unauthorized access to AI models and sensitive data.",
|
||||
Regex: regexp.MustCompile(`(?:^|[\\'"` + "`" + ` >=:])(hf_[a-zA-Z]{34})(?:$|[\\'"` + "`" + ` <])`),
|
||||
Regex: utils.GenerateUniqueTokenRegex("hf_(?i:[a-z]{34})", false),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"hf_",
|
||||
@@ -26,7 +25,8 @@ func HuggingFaceAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
tps := utils.GenerateSampleSecrets("huggingface", "hf_"+secrets.NewSecret("[a-zA-Z]{34}"))
|
||||
tps = append(tps,
|
||||
`huggingface-cli login --token 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`,
|
||||
`huggingface-cli login --token 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`,
|
||||
`huggingface-cli login --token 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`,
|
||||
@@ -40,11 +40,11 @@ func HuggingFaceAccessToken() *config.Rule {
|
||||
`use_auth_token='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')`,
|
||||
`CI_HUB_USER_TOKEN = "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"`,
|
||||
`- Change line 5 and add your Hugging Face token, that is, instead of 'hf_token = "ADD_YOUR_HUGGING_FACE_TOKEN_HERE"', you will need to change it to something like'hf_token = "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"'`,
|
||||
` " hf_token = \"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\"\n",`,
|
||||
//TODO: ` " hf_token = \"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\"\n",`,
|
||||
`# Not critical, only usable on the sandboxed CI instance.
|
||||
TOKEN = "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"`,
|
||||
` parser.add_argument("--hf_token", type=str, default='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', help="Hugging Face Access Token to access PyAnnote gated models")`,
|
||||
}
|
||||
)
|
||||
fps := []string{
|
||||
`- (id)hf_requiredCharacteristicTypesForDisplayMetadata;`,
|
||||
`amazon.de#@#div[data-cel-widget="desktop-rhf_SponsoredProductsRemoteRHFSearchEXPSubsK2ClickPagination"]`,
|
||||
@@ -72,7 +72,7 @@ func HuggingFaceOrganizationApiToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
RuleID: "huggingface-organization-api-token",
|
||||
Description: "Uncovered a Hugging Face Organization API token, potentially compromising AI organization accounts and associated data.",
|
||||
Regex: regexp.MustCompile(`(?:^|[\\'"` + "`" + ` >=:\(,)])(api_org_[a-zA-Z]{34})(?:$|[\\'"` + "`" + ` <\),])`),
|
||||
Regex: utils.GenerateUniqueTokenRegex("api_org_(?i:[a-z]{34})", false),
|
||||
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
@@ -81,14 +81,15 @@ func HuggingFaceOrganizationApiToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
tps := utils.GenerateSampleSecrets("huggingface", "api_org_"+secrets.NewSecret("[a-zA-Z]{34}"))
|
||||
tps = append(tps,
|
||||
`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`,
|
||||
"`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`",
|
||||
`\'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'\`,
|
||||
`\"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\"`,
|
||||
`,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,`,
|
||||
`(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)`,
|
||||
`<foo>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</foo>`,
|
||||
//TODO: `\"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\"`,
|
||||
//TODO: `,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,`,
|
||||
//TODO: `(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)`,
|
||||
//TODO: `<foo>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</foo>`,
|
||||
`def test_private_space(self):
|
||||
hf_token = "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" # Intentionally revealing this key for testing purposes
|
||||
io = gr.load(`,
|
||||
@@ -96,7 +97,7 @@ func HuggingFaceOrganizationApiToken() *config.Rule {
|
||||
`"news_train_dataset = datasets.load_dataset('nlpHakdang/aihub-news30k', data_files = \"train_news_text.csv\", use_auth_token='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')\n",`,
|
||||
`os.environ['HUGGINGFACEHUB_API_TOKEN'] = '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'`,
|
||||
fmt.Sprintf("api_org_%s", secrets.NewSecret(`[a-zA-Z]{34}`)),
|
||||
}
|
||||
)
|
||||
fps := []string{
|
||||
`public static final String API_ORG_EXIST = "APIOrganizationExist";`,
|
||||
`const api_org_controller = require('../../controllers/api/index').organizations;`,
|
||||
|
||||
@@ -17,8 +17,8 @@ func InfracostAPIToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("ico", "ico-"+secrets.NewSecret("[A-Za-z0-9]{32}")),
|
||||
tps := utils.GenerateSampleSecrets("ico", "ico-"+secrets.NewSecret("[A-Za-z0-9]{32}"))
|
||||
tps = append(tps,
|
||||
` variable {
|
||||
name = "INFRACOST_API_KEY"
|
||||
secret_value = "ico-mlCr1Mn3SRcRiZMObUZOTHLcgtH2Lpgt"
|
||||
@@ -29,7 +29,7 @@ func InfracostAPIToken() *config.Rule {
|
||||
//'X-Api-Key': 'ico-EeDdSfctrmjD14f45f45te5gJ7l6lw4o6M36sXT62a6',
|
||||
//'Content-Type': 'application/json',
|
||||
//}`,
|
||||
}
|
||||
)
|
||||
fps := []string{
|
||||
// Low entropy
|
||||
`ico-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`,
|
||||
|
||||
@@ -17,8 +17,6 @@ func Intercom() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("intercom", secrets.NewSecret(utils.AlphaNumericExtended("60"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("intercom", secrets.NewSecret(utils.AlphaNumericExtended("60")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -2,8 +2,8 @@ package rules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
@@ -55,11 +55,9 @@ func JFrogIdentityToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("jfrog", secrets.NewSecret(utils.AlphaNumeric("64"))),
|
||||
utils.GenerateSampleSecret("artifactory", secrets.NewSecret(utils.AlphaNumeric("64"))),
|
||||
utils.GenerateSampleSecret("bintray", secrets.NewSecret(utils.AlphaNumeric("64"))),
|
||||
utils.GenerateSampleSecret("xray", secrets.NewSecret(utils.AlphaNumeric("64"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("jfrog", secrets.NewSecret(utils.AlphaNumeric("64")))
|
||||
tps = append(tps, utils.GenerateSampleSecrets("artifactory", secrets.NewSecret(utils.AlphaNumeric("64")))...)
|
||||
tps = append(tps, utils.GenerateSampleSecrets("bintray", secrets.NewSecret(utils.AlphaNumeric("64")))...)
|
||||
tps = append(tps, utils.GenerateSampleSecrets("xray", secrets.NewSecret(utils.AlphaNumeric("64")))...)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -3,9 +3,10 @@ package rules
|
||||
import (
|
||||
b64 "encoding/base64"
|
||||
"fmt"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
@@ -20,7 +21,9 @@ func JWT() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{`eyJhbGciOieeeiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwic3ViZSI6IjEyMzQ1Njc4OTAiLCJuYW1lZWEiOiJKb2huIERvZSIsInN1ZmV3YWZiIjoiMTIzNDU2Nzg5MCIsIm5hbWVmZWF3ZnciOiJKb2huIERvZSIsIm5hbWVhZmV3ZmEiOiJKb2huIERvZSIsInN1ZndhZndlYWIiOiIxMjM0NTY3ODkwIiwibmFtZWZ3YWYiOiJKb2huIERvZSIsInN1YmZ3YWYiOiIxMjM0NTY3ODkwIiwibmFtZndhZSI6IkpvaG4gRG9lIiwiaWZ3YWZhYXQiOjE1MTYyMzkwMjJ9.a_5icKBDo-8EjUlrfvz2k2k-FYaindQ0DEYNrlsnRG0==`, // gitleaks:allow
|
||||
tps := utils.GenerateSampleSecrets("jwt", secrets.NewSecret(`ey[a-zA-Z0-9]{17,}\.ey[a-zA-Z0-9\/\\_-]{17,}\.(?:[a-zA-Z0-9\/\\_-]{10,}={0,2})?`))
|
||||
tps = append(tps,
|
||||
`eyJhbGciOieeeiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwic3ViZSI6IjEyMzQ1Njc4OTAiLCJuYW1lZWEiOiJKb2huIERvZSIsInN1ZmV3YWZiIjoiMTIzNDU2Nzg5MCIsIm5hbWVmZWF3ZnciOiJKb2huIERvZSIsIm5hbWVhZmV3ZmEiOiJKb2huIERvZSIsInN1ZndhZndlYWIiOiIxMjM0NTY3ODkwIiwibmFtZWZ3YWYiOiJKb2huIERvZSIsInN1YmZ3YWYiOiIxMjM0NTY3ODkwIiwibmFtZndhZSI6IkpvaG4gRG9lIiwiaWZ3YWZhYXQiOjE1MTYyMzkwMjJ9.a_5icKBDo-8EjUlrfvz2k2k-FYaindQ0DEYNrlsnRG0==`, // gitleaks:allow
|
||||
`JWT := eyJhbGciOieeeiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwic3ViZSI6IjEyMzQ1Njc4OTAiLCJuYW1lZWEiOiJKb2huIERvZSIsInN1ZmV3YWZiIjoiMTIzNDU2Nzg5MCIsIm5hbWVmZWF3ZnciOiJKb2huIERvZSIsIm5hbWVhZmV3ZmEiOiJKb2huIERvZSIsInN1ZndhZndlYWIiOiIxMjM0NTY3ODkwIiwibmFtZWZ3YWYiOiJKb2huIERvZSIsInN1YmZ3YWYiOiIxMjM0NTY3ODkwIiwibmFtZndhZSI6IkpvaG4gRG9lIiwiaWZ3YWZhYXQiOjE1MTYyMzkwMjJ9.a_5icKBDo-8EjUlrfvz2k2k-FYaindQ0DEYNrlsnRG0`, // gitleaks:allow
|
||||
`"access_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NLZXkiOiJRMzFDVlMxUFNDSjRPVEsyWVZFTSIsImF0X2hhc2giOiI4amItZFE2OXRtZEVueUZaMUttNWhnIiwiYXVkIjoiZXhhbXBsZS1hcHAiLCJlbWFpbCI6ImFkbWluQGV4YW1wbGUuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImV4cCI6IjE1OTQ2MDAxODIiLCJpYXQiOjE1OTQ1ODkzODQsImlzcyI6Imh0dHA6Ly8xMjcuMC4wLjE6NTU1Ni9kZXgiLCJuYW1lIjoiYWRtaW4iLCJzdWIiOiJDaVF3T0dFNE5qZzBZaTFrWWpnNExUUmlOek10T1RCaE9TMHpZMlF4TmpZeFpqVTBOallTQld4dlkyRnMifQ.nrbzIJz99Om7TvJ04jnSTmhvlM7aR9hMM1Aqjp2ONJ1UKYCvegBLrTu6cYR968_OpmnAGJ8vkd7sIjUjtR4zbw"`, // gitleaks:allow
|
||||
`https://dai2-playlistserver.aws.syncbak.com/cpl/20980038/dai2v5/1.0/7b2264657669636554797065223a387d/master.m3u8?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkdyYXkyMDE2MDgyOSJ9.eyJtaWQiOiIyMDk4MDAzOCIsImNpZCI6MjE5MDMsInNpZCI6MTU4LCJtZDUiOiIwN2QxMmRjNjAwOTM2MGI0MmY3NjNkNTRiMWIwZjI1NCIsImlhdCI6MTY2MDkxMzU2MCwiZXhwIjoxNjkyNDQ5NTYwLCJpc3MiOiJTeW5jYmFrIChURykifQ.JrWVgwzIn_RcNuWhkzIjr1i4qjXU1v4n0KFrSzoTQvQ`, // gitleaks:allow `
|
||||
@@ -61,7 +64,7 @@ func JWT() *config.Rule {
|
||||
// `eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImVwayI6eyJrdHkiOiJFQyIsImNydiI6IlAtMzg0Iiwia2V5X29wcyI6W10sImV4dCI6dHJ1ZSwieCI6IllUcEY3bGtTc3JvZVVUVFdCb21LNzBTN0FhVTJyc0ptMURpZ1ZzbjRMY2F5eUxFNFBabldkYmFVcE9jQVV5a1ciLCJ5IjoiLU5pS3loUktjSk52Nm02Z0ZJUWc4cy1Xd1VXUW9uT3A5dkQ4cHpoa2tUU3U2RzFlU2FUTVlhZGltQ2Q4V0ExMSJ9LCJhcHUiOiIiLCJhcHYiOiIifQ`,
|
||||
`String tokenWithNoneAlg = "eyJhbGciOiJub25lIn0.eyJzdWIiOiJ0ZXN0LXVzZXIifQ.";`, // gitleaks:allow
|
||||
`# Req: Invoke-RestMethod -Uri 'http://localhost:8085/users' -Headers @{ 'X-API-KEY' = 'eyJhbGciOiJub25lIn0.eyJ1c2VybmFtZSI6Im1vcnR5Iiwic3ViIjoiMTIzIn0.' }`, // gitleaks:allow
|
||||
}
|
||||
)
|
||||
fps := []string{}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
|
||||
@@ -20,9 +20,6 @@ func KrakenAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("kraken",
|
||||
secrets.NewSecret(utils.AlphaNumericExtendedLong("80,90"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("kraken", secrets.NewSecret(utils.AlphaNumericExtendedLong("80,90")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -4,15 +4,16 @@ import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
)
|
||||
|
||||
// KubernetesSecret validates if we detected a kubernetes secret which contains data!
|
||||
func KubernetesSecret() *config.Rule {
|
||||
// Only match basic variations of `kind: secret`, we don't want things like `kind: ExternalSecret`.
|
||||
//language=regexp
|
||||
kindPat := `\bkind:[ \t]*["']?secret["']?`
|
||||
kindPat := `\bkind:[ \t]*["']?\bsecret\b["']?`
|
||||
// Only matches values (`key: value`) under `data:` that are:
|
||||
// - valid base64 characters
|
||||
// - longer than 10 characters (no "YmFyCg==")
|
||||
@@ -39,6 +40,9 @@ func KubernetesSecret() *config.Rule {
|
||||
// variable: ""
|
||||
// variable: ''
|
||||
regexp.MustCompile(`[\w.-]+:(?:[ \t]*(?:\||>[-+]?)\s+)?[ \t]*(?:\{\{[ \t\w"|$:=,.-]+}}|""|'')`),
|
||||
// TODO: Requires multiple allowlists to target match.
|
||||
// Avoid overreach between directives.
|
||||
//regexp.MustCompile(`(kind:(.|\s)+\n---\n(.|\s)+\bdata:|data:(.|\s)+\n---\n(.|\s)+\bkind:)`),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -239,6 +243,43 @@ metadata:
|
||||
name: kubernetes-dashboard-key-holder
|
||||
namespace: kubernetes-dashboard
|
||||
type: Opaque
|
||||
`,
|
||||
// TODO: Requires multiple allowlists.
|
||||
// "overly-permissive3.yaml": ` kind: Secret
|
||||
// target:
|
||||
// name: mysecret
|
||||
// creationPolicy: Owner
|
||||
//
|
||||
//---
|
||||
//
|
||||
//kind: ConfigMap
|
||||
// data:
|
||||
// conversionStrategy: Default
|
||||
// decodingStrategy: None
|
||||
// key: secret/mysecret
|
||||
// property: foo
|
||||
// secretKey: foo`,
|
||||
// https://github.com/gitleaks/gitleaks/issues/1644
|
||||
"wrong-kind.yaml": `apiVersion: external-secrets.io/v1beta1
|
||||
kind: ExternalSecret
|
||||
metadata:
|
||||
name: example
|
||||
namespace: example-ns
|
||||
spec:
|
||||
refreshInterval: 15s
|
||||
secretStoreRef:
|
||||
name: example
|
||||
kind: SecretStore
|
||||
target:
|
||||
name: mysecret
|
||||
creationPolicy: Owner
|
||||
data:
|
||||
- remoteRef:
|
||||
conversionStrategy: Default
|
||||
decodingStrategy: None
|
||||
key: secret/mysecret
|
||||
property: foo
|
||||
secretKey: foo
|
||||
`,
|
||||
"sopssecret.yaml": `apiVersion: isindir.github.com/v1alpha3
|
||||
kind: SopsSecret
|
||||
|
||||
@@ -19,9 +19,7 @@ func KucoinAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("kucoin", secrets.NewSecret(utils.Hex("24"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("kucoin", secrets.NewSecret(utils.Hex("24")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -38,8 +36,6 @@ func KucoinSecretKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("kucoin", secrets.NewSecret(utils.Hex8_4_4_4_12())),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("kucoin", secrets.NewSecret(utils.Hex8_4_4_4_12()))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -19,8 +19,6 @@ func LaunchDarklyAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("launchdarkly", secrets.NewSecret(utils.AlphaNumericExtended("40"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("launchdarkly", secrets.NewSecret(utils.AlphaNumericExtended("40")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
)
|
||||
|
||||
func LinearAPIToken() *config.Rule {
|
||||
@@ -19,9 +20,7 @@ func LinearAPIToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("linear", "lin_api_"+secrets.NewSecret(utils.AlphaNumeric("40"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("linear", "lin_api_"+secrets.NewSecret(utils.AlphaNumeric("40")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -36,8 +35,6 @@ func LinearClientSecret() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("linear", secrets.NewSecret(utils.Hex("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("linear", secrets.NewSecret(utils.Hex("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -6,48 +6,42 @@ import (
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
func LinkedinClientID() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
RuleID: "linkedin-client-id",
|
||||
Description: "Found a LinkedIn Client ID, risking unauthorized access to LinkedIn integrations and professional data exposure.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"linked[_-]?in"}, utils.AlphaNumeric("14"), true),
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"linkedin",
|
||||
"linked_in",
|
||||
"linked-in",
|
||||
},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := utils.GenerateSampleSecrets("linkedin", secrets.NewSecret(utils.AlphaNumeric("14")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func LinkedinClientSecret() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
RuleID: "linkedin-client-secret",
|
||||
Description: "Discovered a LinkedIn Client secret, potentially compromising LinkedIn application integrations and user data.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{
|
||||
"linkedin",
|
||||
"linked-in",
|
||||
"linked[_-]?in",
|
||||
}, utils.AlphaNumeric("16"), true),
|
||||
|
||||
Entropy: 2,
|
||||
Keywords: []string{
|
||||
"linkedin",
|
||||
"linked_in",
|
||||
"linked-in",
|
||||
},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("linkedin", secrets.NewSecret(utils.AlphaNumeric("16"))),
|
||||
}
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
func LinkedinClientID() *config.Rule {
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
RuleID: "linkedin-client-id",
|
||||
Description: "Found a LinkedIn Client ID, risking unauthorized access to LinkedIn integrations and professional data exposure.",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{
|
||||
"linkedin",
|
||||
"linked-in",
|
||||
}, utils.AlphaNumeric("14"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"linkedin",
|
||||
"linked-in",
|
||||
},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("linkedin", secrets.NewSecret(utils.AlphaNumeric("14"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("linkedin", secrets.NewSecret(utils.AlphaNumeric("16")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -21,9 +21,7 @@ func LobPubAPIToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("lob", "test_pub_"+secrets.NewSecret(utils.Hex("31"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("lob", "test_pub_"+secrets.NewSecret(utils.Hex("31")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -40,8 +38,6 @@ func LobAPIToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("lob", "test_"+secrets.NewSecret(utils.Hex("35"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("lob", "test_"+secrets.NewSecret(utils.Hex("35")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -19,11 +19,11 @@ func MailChimp() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("mailchimp", secrets.NewSecret(utils.Hex("32"))+"-us20"),
|
||||
tps := utils.GenerateSampleSecrets("mailchimp", secrets.NewSecret(utils.Hex("32"))+"-us20")
|
||||
tps = append(tps,
|
||||
`mailchimp_api_key: cefa780880ba5f5696192a34f6292c35-us18`, // gitleaks:allow
|
||||
`MAILCHIMPE_KEY = "b5b9f8e50c640da28993e8b6a48e3e53-us18"`, // gitleaks:allow
|
||||
}
|
||||
)
|
||||
fps := []string{
|
||||
// False Negative
|
||||
`MailchimpSDK.initialize(token: 3012a5754bbd716926f99c028f7ea428-us18)`, // gitleaks:allow
|
||||
|
||||
@@ -19,9 +19,7 @@ func MailGunPrivateAPIToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("mailgun", "key-"+secrets.NewSecret(utils.Hex("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("mailgun", "key-"+secrets.NewSecret(utils.Hex("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -38,9 +36,7 @@ func MailGunPubAPIToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("mailgun", "pubkey-"+secrets.NewSecret(utils.Hex("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("mailgun", "pubkey-"+secrets.NewSecret(utils.Hex("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -57,8 +53,6 @@ func MailGunSigningKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("mailgun", secrets.NewSecret(utils.Hex("32"))+"-00001111-22223333"),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("mailgun", secrets.NewSecret(utils.Hex("32"))+"-00001111-22223333")
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -17,8 +17,6 @@ func MapBox() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("mapbox", "pk."+secrets.NewSecret(utils.AlphaNumeric("60"))+"."+secrets.NewSecret(utils.AlphaNumeric("22"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("mapbox", "pk."+secrets.NewSecret(utils.AlphaNumeric("60"))+"."+secrets.NewSecret(utils.AlphaNumeric("22")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -19,8 +19,6 @@ func MattermostAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("mattermost", secrets.NewSecret(utils.AlphaNumeric("26"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("mattermost", secrets.NewSecret(utils.AlphaNumeric("26")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -11,11 +11,7 @@ func MessageBirdAPIToken() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Found a MessageBird API token, risking unauthorized access to communication platforms and message data.",
|
||||
RuleID: "messagebird-api-token",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{
|
||||
"messagebird",
|
||||
"message-bird",
|
||||
"message_bird",
|
||||
}, utils.AlphaNumeric("25"), true),
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"message[_-]?bird"}, utils.AlphaNumeric("25"), true),
|
||||
|
||||
Keywords: []string{
|
||||
"messagebird",
|
||||
@@ -25,11 +21,9 @@ func MessageBirdAPIToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("messagebird", secrets.NewSecret(utils.AlphaNumeric("25"))),
|
||||
utils.GenerateSampleSecret("message-bird", secrets.NewSecret(utils.AlphaNumeric("25"))),
|
||||
utils.GenerateSampleSecret("message_bird", secrets.NewSecret(utils.AlphaNumeric("25"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("messagebird", secrets.NewSecret(utils.AlphaNumeric("25")))
|
||||
tps = append(tps, utils.GenerateSampleSecrets("message-bird", secrets.NewSecret(utils.AlphaNumeric("25")))...)
|
||||
tps = append(tps, utils.GenerateSampleSecrets("message_bird", secrets.NewSecret(utils.AlphaNumeric("25")))...)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -38,11 +32,7 @@ func MessageBirdClientID() *config.Rule {
|
||||
r := config.Rule{
|
||||
Description: "Discovered a MessageBird client ID, potentially compromising API integrations and sensitive communication data.",
|
||||
RuleID: "messagebird-client-id",
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{
|
||||
"messagebird",
|
||||
"message-bird",
|
||||
"message_bird",
|
||||
}, utils.Hex8_4_4_4_12(), true),
|
||||
Regex: utils.GenerateSemiGenericRegex([]string{"message[_-]?bird"}, utils.Hex8_4_4_4_12(), true),
|
||||
|
||||
Keywords: []string{
|
||||
"messagebird",
|
||||
@@ -52,8 +42,9 @@ func MessageBirdClientID() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
tps := utils.GenerateSampleSecrets("MessageBird", "12345678-ABCD-ABCD-ABCD-1234567890AB") // gitleaks:allow
|
||||
tps = append(tps,
|
||||
`const MessageBirdClientID = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
|
||||
}
|
||||
)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -20,8 +20,6 @@ func NetlifyAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("netlify", secrets.NewSecret(utils.AlphaNumericExtended("40,46"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("netlify", secrets.NewSecret(utils.AlphaNumericExtended("40,46")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -23,9 +23,7 @@ func NewRelicUserID() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("new-relic", "NRAK-"+secrets.NewSecret(utils.AlphaNumeric("27"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("new-relic", "NRAK-"+secrets.NewSecret(utils.AlphaNumeric("27")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -48,9 +46,7 @@ func NewRelicUserKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("new-relic", secrets.NewSecret(utils.AlphaNumeric("64"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("new-relic", secrets.NewSecret(utils.AlphaNumeric("64")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -71,9 +67,7 @@ func NewRelicBrowserAPIKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("new-relic", "NRJS-"+secrets.NewSecret(utils.Hex("19"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("new-relic", "NRJS-"+secrets.NewSecret(utils.Hex("19")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -94,8 +88,6 @@ func NewRelicInsertKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("new-relic", "NRII-"+secrets.NewSecret(utils.Hex("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("new-relic", "NRII-"+secrets.NewSecret(utils.Hex("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -19,8 +19,6 @@ func NPM() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("npmAccessToken", "npm_"+secrets.NewSecret(utils.AlphaNumeric("36"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("npmAccessToken", "npm_"+secrets.NewSecret(utils.AlphaNumeric("36")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -3,9 +3,9 @@ package rules
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
)
|
||||
|
||||
func NugetConfigPassword() *config.Rule {
|
||||
|
||||
@@ -23,8 +23,6 @@ func NytimesAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("nytimes", secrets.NewSecret(utils.AlphaNumeric("32"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("nytimes", secrets.NewSecret(utils.AlphaNumeric("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -19,11 +19,11 @@ func OktaAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("okta", secrets.NewSecret(`00[\w=\-]{40}`)),
|
||||
tps := utils.GenerateSampleSecrets("okta", secrets.NewSecret(`00[\w=\-]{40}`))
|
||||
tps = append(tps,
|
||||
`"oktaApiToken": "00ebObu4zSNkyc6dimLvUwq4KpTEop-PCEnnfSTpD3",`, // gitleaks:allow
|
||||
` var OktaApiToken = "00fWkOjwwL9xiFd-Vfgm_ePATIRxVj852Iblbb1DS_";`, // gitleaks:allow
|
||||
}
|
||||
)
|
||||
fps := []string{
|
||||
`oktaKey = 00000000000000000000000000000000000TUVWXYZ`, // low entropy
|
||||
`rookTable = 0023452Lllk2KqjLBvaxANWEgTd7bqjsxjo8aZj0wd`, // wrong case
|
||||
|
||||
@@ -19,8 +19,6 @@ func OpenAI() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("openaiApiKey", "sk-"+secrets.NewSecret(utils.AlphaNumeric("20"))+"T3BlbkFJ"+secrets.NewSecret(utils.AlphaNumeric("20"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("openaiApiKey", "sk-"+secrets.NewSecret(utils.AlphaNumeric("20"))+"T3BlbkFJ"+secrets.NewSecret(utils.AlphaNumeric("20")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
)
|
||||
|
||||
// OpenShift 4 user tokens are prefixed with `sha256~`.
|
||||
@@ -23,11 +24,12 @@ func OpenshiftUserToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
tps := utils.GenerateSampleSecrets("oc", secrets.NewSecret("sha256~[\\w-]{43}"))
|
||||
tps = append(tps,
|
||||
`Authorization: Bearer sha256~kV46hPnEYhCWFnB85r5NrprAxggzgb6GOeLbgcKNsH0`, // https://github.com/openshift/console/blob/edae2305e01c2e0e8c33727af720ef960088eee3/dynamic-demo-plugin/README.md?plain=1#L114
|
||||
`oc login --token=sha256~ZBMKw9VAayhdnyANaHvjJeXDiGwA7Fsr5gtLKj3-eh- `, // https://github.com/IBM/tekton-tutorial-openshift/blob/2a97d22ba282accad50821bca069210ea89de706/docs/lab1/0_setup.md?plain=1#L85
|
||||
"sha256~" + secrets.NewSecret(`[\w-]{43}`),
|
||||
}
|
||||
"sha256~"+secrets.NewSecret(`[\w-]{43}`),
|
||||
)
|
||||
fps := []string{
|
||||
`--set kraken.kubeconfig.token.token="sha256~XXXXXXXXXX_PUT_YOUR_TOKEN_HERE_XXXXXXXXXXXX" \`, // https://github.com/krkn-chaos/krkn/blob/f3933f0e6239824eb9b5c46ff0e5d503b8465d6a/docs/index.md?plain=1#L307
|
||||
`oc login --token=sha256~_xxxxxx_xxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxx-X \
|
||||
|
||||
@@ -2,8 +2,8 @@ package rules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
@@ -22,9 +22,7 @@ func PlaidAccessID() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("plaid", secrets.NewSecret(utils.AlphaNumeric("24"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("plaid", secrets.NewSecret(`[a-zA-Z0-9]{24}`))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -42,9 +40,7 @@ func PlaidSecretKey() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("plaid", secrets.NewSecret(utils.AlphaNumeric("30"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("plaid", secrets.NewSecret(utils.AlphaNumeric("30")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -62,8 +58,6 @@ func PlaidAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("plaid", secrets.NewSecret(fmt.Sprintf("access-(?:sandbox|development|production)-%s", utils.Hex8_4_4_4_12()))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("plaid", secrets.NewSecret(fmt.Sprintf("access-(?:sandbox|development|production)-%s", utils.Hex8_4_4_4_12())))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -19,11 +19,9 @@ func PlanetScalePassword() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("planetScalePassword", "pscale_pw_"+secrets.NewSecret(utils.AlphaNumericExtended("32"))),
|
||||
utils.GenerateSampleSecret("planetScalePassword", "pscale_pw_"+secrets.NewSecret(utils.AlphaNumericExtended("43"))),
|
||||
utils.GenerateSampleSecret("planetScalePassword", "pscale_pw_"+secrets.NewSecret(utils.AlphaNumericExtended("64"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("planetScale", "pscale_pw_"+secrets.NewSecret(utils.AlphaNumericExtended("32")))
|
||||
tps = append(tps, utils.GenerateSampleSecrets("planetScale", "pscale_pw_"+secrets.NewSecret(utils.AlphaNumericExtended("43")))...)
|
||||
tps = append(tps, utils.GenerateSampleSecrets("planetScale", "pscale_pw_"+secrets.NewSecret(utils.AlphaNumericExtended("64")))...)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -40,11 +38,9 @@ func PlanetScaleAPIToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("planetScalePassword", "pscale_tkn_"+secrets.NewSecret(utils.AlphaNumericExtended("32"))),
|
||||
utils.GenerateSampleSecret("planetScalePassword", "pscale_tkn_"+secrets.NewSecret(utils.AlphaNumericExtended("43"))),
|
||||
utils.GenerateSampleSecret("planetScalePassword", "pscale_tkn_"+secrets.NewSecret(utils.AlphaNumericExtended("64"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("planetScale", "pscale_tkn_"+secrets.NewSecret(utils.AlphaNumericExtended("32")))
|
||||
tps = append(tps, utils.GenerateSampleSecrets("planetScale", "pscale_tkn_"+secrets.NewSecret(utils.AlphaNumericExtended("43")))...)
|
||||
tps = append(tps, utils.GenerateSampleSecrets("planetScale", "pscale_tkn_"+secrets.NewSecret(utils.AlphaNumericExtended("64")))...)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
|
||||
@@ -61,10 +57,8 @@ func PlanetScaleOAuthToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("planetScalePassword", "pscale_oauth_"+secrets.NewSecret(utils.AlphaNumericExtended("32"))),
|
||||
utils.GenerateSampleSecret("planetScalePassword", "pscale_oauth_"+secrets.NewSecret(utils.AlphaNumericExtended("43"))),
|
||||
utils.GenerateSampleSecret("planetScalePassword", "pscale_oauth_"+secrets.NewSecret(utils.AlphaNumericExtended("64"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("planetScale", "pscale_oauth_"+secrets.NewSecret(utils.AlphaNumericExtended("32")))
|
||||
tps = append(tps, utils.GenerateSampleSecrets("planetScale", "pscale_oauth_"+secrets.NewSecret(utils.AlphaNumericExtended("43")))...)
|
||||
tps = append(tps, utils.GenerateSampleSecrets("planetScale", "pscale_oauth_"+secrets.NewSecret(utils.AlphaNumericExtended("64")))...)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -19,8 +19,6 @@ func PostManAPI() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("postmanAPItoken", "PMAK-"+secrets.NewSecret(utils.Hex("24"))+"-"+secrets.NewSecret(utils.Hex("34"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("postmanAPItoken", "PMAK-"+secrets.NewSecret(utils.Hex("24"))+"-"+secrets.NewSecret(utils.Hex("34")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -19,9 +19,7 @@ func Prefect() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("api-token", "pnu_"+secrets.NewSecret(utils.AlphaNumeric("36"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("api-token", "pnu_"+secrets.NewSecret(utils.AlphaNumeric("36")))
|
||||
fps := []string{
|
||||
`PREFECT_API_KEY = "pnu_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"`,
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
|
||||
@@ -19,9 +19,7 @@ func PulumiAPIToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("pulumi-api-token", "pul-"+secrets.NewSecret(utils.Hex("40"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("pulumi-api-token", "pul-"+secrets.NewSecret(utils.Hex("40")))
|
||||
fps := []string{
|
||||
` <img src="./assets/vipul-f0eb1acf0da84c06a50c5b2c59932001997786b176dec02bd16128ee9ea83628.png" alt="" class="w-16 h-16 rounded-full">`,
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
|
||||
)
|
||||
|
||||
func PyPiUploadToken() *config.Rule {
|
||||
@@ -21,7 +22,6 @@ func PyPiUploadToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{"pypiToken := \"pypi-AgEIcHlwaS5vcmc" + secrets.NewSecret(utils.Hex("32")) +
|
||||
secrets.NewSecret(utils.Hex("32")) + "\""}
|
||||
tps := utils.GenerateSampleSecrets("pypi", "pypi-AgEIcHlwaS5vcmc"+secrets.NewSecret(utils.Hex("32"))+secrets.NewSecret(utils.Hex("32")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -20,9 +20,6 @@ func RapidAPIAccessToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("rapidapi",
|
||||
secrets.NewSecret(utils.AlphaNumericExtendedShort("50"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("rapidapi", secrets.NewSecret(utils.AlphaNumericExtendedShort("50")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -19,9 +19,8 @@ func ReadMe() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("api-token", "rdme_"+secrets.NewSecret(utils.AlphaNumeric("70"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("api-token", "rdme_"+secrets.NewSecret(utils.AlphaNumeric("70")))
|
||||
|
||||
fps := []string{
|
||||
`const API_KEY = 'rdme_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';`,
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ func RubyGemsAPIToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("rubygemsAPIToken", "rubygems_"+secrets.NewSecret(utils.Hex("48"))),
|
||||
}
|
||||
tps := utils.GenerateSampleSecrets("rubygemsAPIToken", "rubygems_"+secrets.NewSecret(utils.Hex("48")))
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
@@ -17,9 +17,9 @@ func ScalingoAPIToken() *config.Rule {
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := []string{
|
||||
utils.GenerateSampleSecret("scalingo", "tk-us-"+secrets.NewSecret(utils.AlphaNumericExtendedShort("48"))),
|
||||
tps := utils.GenerateSampleSecrets("scalingo", "tk-us-"+secrets.NewSecret(utils.AlphaNumericExtendedShort("48")))
|
||||
tps = append(tps,
|
||||
`scalingo_api_token = "tk-us-loys7ib9yrxcys_ta2sq85mjar6lgcsspkd9x61s7h5epf_-"`, // gitleaks:allow
|
||||
}
|
||||
)
|
||||
return utils.Validate(r, tps, nil)
|
||||
}
|
||||
Loaded 100 of 159 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user