Compare commits

...
32 Commits
Author SHA1 Message Date
becojoandBecojo 02808f45d0 Limit hashicorp-tf-password to .tf/.hcl files (#1420)
* Limit hashicorp-tf-password to .tf/.hcl files

* fix tests

---------

Co-authored-by: Becojo <Becojo@users.noreply.github.com>
2024-06-13 11:23:26 -04:00
Zachary Rice 07e1c30592 rm print 2024-06-13 11:14:44 -04:00
Zachary Rice db63fc1bf4 reduce telegram... todo url and xml for later 2024-06-13 11:14:02 -04:00
Zachary Rice 9a4538c4d6 coderabbit.ai <3 2024-06-13 09:16:17 -04:00
danielap-ma fe94ef9ca3 Add NewRelic insert key detection (#1417) 2024-06-02 18:18:52 -05:00
Toxandtoxyl bb4424d454 Improved Telegram bot token rule regex and added more test cases (#1404)
Co-authored-by: toxyl <tox@novasonica.com>
2024-06-01 18:56:14 -05:00
Alexandre GUIOT--VALENTIN 575e923cf8 Add intra42 client secret (#1408)
intra42 is the intranet and API of "42 School", a CS school.
The API is open to all students in 57 campus around the world.
It is thus often subject to credentials leaks on GitHub
See https://42.fr and https://api.intra.42.fr/
2024-06-01 18:55:04 -05:00
shahar4200 39947b0b0d extend FB access token discovery (#1407)
* extend FB access token discovery

* validate config

* set upper 40

* set upper 40
2024-05-31 15:51:43 -05:00
Baruch Odem (Rothkoff)andBaruch Odem 79cac73f72 tests: scalingo validation consistent test (#1359)
* Refactor Scalingo API token regex and add sample token

* improve docs for allowlist

I didn't know it when I made #1358

---------

Co-authored-by: Baruch Odem <baruch.odem@checkmarx.com>
2024-04-29 13:46:16 -05:00
Baruch Odem (Rothkoff)andBaruch Odem 247f423a39 add real (test) standard and restricted keys (#1375)
Co-authored-by: Baruch Odem <baruch.odem@checkmarx.com>
2024-04-29 13:45:32 -05:00
Baruch Odem (Rothkoff)andBaruch Odem 821b232394 Add Cloudflare API and Origin CA keys (#1374)
* add real heroku example

* Add Cloudflare API and Origin CA keys

---------

Co-authored-by: Baruch Odem <baruch.odem@checkmarx.com>
2024-04-29 13:44:19 -05:00
Katrin Leinweber 57ac4b3dc7 Update "contributing guidelines" link (#1390) 2024-04-15 09:13:43 -05:00
Baruch Odem (Rothkoff) db69e8266e add update token from square (#1370) 2024-03-22 13:31:09 -05:00
Baruch Odem (Rothkoff) 4b543280a1 feat: facebook secret, access token, and page access token rules (#1372)
* Add Facebook secret, access token, and page access token rules

* comment
2024-03-22 13:30:42 -05:00
Baruch Odem (Rothkoff) 979f213b93 update mailchimp with new tokens (#1376) 2024-03-22 13:29:59 -05:00
Jarek Porzucek 59c0cc7183 Append ordered rules when extending (#1304) 2024-03-22 11:21:26 -05:00
Baruch Odem (Rothkoff) 6c52f878cc fix: age rule id with dashes (#1349) 2024-02-19 09:26:41 -06:00
dutchhaag 247a5e7214 patching golang.org/x/text for CVE-2021-38561 and CVE-2022-32149 (#1342) 2024-02-15 11:54:47 -06:00
anotherbridge 8d23afd45d Use latest base images. (#1334)
* Use latest images.

* Fix version
2024-02-02 11:29:44 -06:00
João Filipe Silva ac4b5146b0 removed gitleaks user from Dockerfile (#1313) 2024-02-01 08:23:13 -06:00
Kieran Smith 76c9e3175b Remove IAM identifiers for non-credential resources in the aws-access-token rule (#1307)
* Remove IAM identifiers for non-credential resources

Only detects: 
AWS STS service bearer token
Context-specific credential
Access key
Temporary (AWS STS) access key IDs use this prefix, but are unique only in combination with the secret access key and the session token.

* Update gitleaks.toml

* Update testdata

* Update tests
2024-01-31 13:21:53 -06:00
afe046b3b4 Update stripe rule to not alert on publishable keys (#1320)
* Update stripe rule to not alert on publishable keys

* run go gen

---------

Co-authored-by: Erin Browning <ebrowning@makenotion.com>
Co-authored-by: Zachary Rice <zachary.rice@trufflesec.com>
2024-01-31 13:13:04 -06:00
eyalatox 8b8920d4c3 --max-target-megabytes flag now supported for --no-git flag as well (#1330) 2024-01-24 16:08:05 -06:00
Christian Groschupp a59289ca9b add pre-commit hook gitleaks-system (#1225) 2024-01-10 13:09:00 -06:00
Zachary Rice 870194be13 fix errors when using protect and an external git diff tool (#1318) 2023-12-23 15:52:41 -06:00
Zachary Rice 179c607541 rename filesystem to directory (#1317) 2023-12-22 11:08:00 -06:00
Liron Biam 8de8938ad4 Enhance Secret Descriptions (#1300)
* Enhance secret descriptions in gitleaks.toml

* adjust the rule configuration descriptions

* missing spaces in gitleaks.toml
2023-11-29 17:03:11 -06:00
Zachary Rice ca7aa14542 Small refactor detect and sources (#1297) 2023-11-22 10:37:29 -06:00
Oleksandr Redko 01e60c81e6 chore(config): refactor to go generate; simplify configRules init (#1295) 2023-11-21 19:52:50 -06:00
Zach 54f5f04a1f forgot symlinks 2023-11-19 11:32:10 -06:00
Zachary Rice 221d5c40e7 pretty apparent 'protect' and 'detect' should be merged into one command (#1294) 2023-11-19 11:21:40 -06:00
128b50f67b style: sort the stopwords (#1289)
* style: sort the stopwords

* run cmd

---------

Co-authored-by: Nick Nungester <nick.nungester@acaglobal.com>
Co-authored-by: Zach <zricer@protonmail.com>
2023-11-18 12:28:17 -06:00
140 changed files with 4385 additions and 4113 deletions

No files matched your search

+1 -1
View File
@@ -26,4 +26,4 @@ jobs:
run: make test run: make test
- name: Validate Config - name: Validate Config
run: cd cmd/generate/config && go run main.go run: go generate ./... && git diff --exit-code
+5
View File
@@ -9,3 +9,8 @@
description: Detect hardcoded secrets using Gitleaks description: Detect hardcoded secrets using Gitleaks
entry: zricethezav/gitleaks protect --verbose --redact --staged entry: zricethezav/gitleaks protect --verbose --redact --staged
language: docker_image language: docker_image
- id: gitleaks-system
name: Detect hardcoded secrets
description: Detect hardcoded secrets using Gitleaks
entry: gitleaks protect --verbose --redact --staged
language: system
+3 -7
View File
@@ -88,15 +88,11 @@ If you want to add a new rule to the [default Gitleaks configuration](https://gi
validation part. You can use `generateSampleSecret` to create a secret for the validation part. You can use `generateSampleSecret` to create a secret for the
true positives (`tps` in the example above) used in `validate`. true positives (`tps` in the example above) used in `validate`.
1. Update `cmd/generate/config/main.go`. Add a line like 1. Update `cmd/generate/config/main.go`. Extend `configRules` slice with
`configRules = append(configRules, rules.Beamer())` in `main()`. Try and keep the `rules.Beamer(),` in `main()`. Try and keep
this alphabetically pretty please. this alphabetically pretty please.
1. Change directories into `cmd/generate/config` and run `go run main.go` 1. Run `go generate ./...`
```
cd cmd/generate/config && go run main.go
```
1. Check out your new rules in `config/gitleaks.toml` and see if everything looks good. 1. Check out your new rules in `config/gitleaks.toml` and see if everything looks good.
+3 -5
View File
@@ -1,14 +1,12 @@
FROM golang:1.19 AS build FROM golang:1.21 AS build
WORKDIR /go/src/github.com/zricethezav/gitleaks WORKDIR /go/src/github.com/zricethezav/gitleaks
COPY . . COPY . .
RUN VERSION=$(git describe --tags --abbrev=0) && \ RUN VERSION=$(git describe --tags --abbrev=0) && \
CGO_ENABLED=0 go build -o bin/gitleaks -ldflags "-X="github.com/zricethezav/gitleaks/v8/cmd.Version=${VERSION} CGO_ENABLED=0 go build -o bin/gitleaks -ldflags "-X="github.com/zricethezav/gitleaks/v8/cmd.Version=${VERSION}
FROM alpine:3.16 FROM alpine:3.19
RUN adduser -D gitleaks && \ RUN apk add --no-cache bash git openssh-client
apk add --no-cache bash git openssh-client
COPY --from=build /go/src/github.com/zricethezav/gitleaks/bin/* /usr/bin/ COPY --from=build /go/src/github.com/zricethezav/gitleaks/bin/* /usr/bin/
USER gitleaks
RUN git config --global --add safe.directory '*' RUN git config --global --add safe.directory '*'
+8 -2
View File
@@ -382,7 +382,7 @@ stopwords = [
] ]
``` ```
Refer to the default [gitleaks config](https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml) for examples or follow the [contributing guidelines](https://github.com/zricethezav/gitleaks/blob/master/README.md) if you would like to contribute to the default configuration. Additionally, you can check out [this gitleaks blog post](https://blog.gitleaks.io/stop-leaking-secrets-configuration-2-3-aeed293b1fbf) which covers advanced configuration setups. Refer to the default [gitleaks config](https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml) for examples or follow the [contributing guidelines](https://github.com/gitleaks/gitleaks/blob/master/CONTRIBUTING.md) if you would like to contribute to the default configuration. Additionally, you can check out [this gitleaks blog post](https://blog.gitleaks.io/stop-leaking-secrets-configuration-2-3-aeed293b1fbf) which covers advanced configuration setups.
### Additional Configuration ### Additional Configuration
@@ -402,13 +402,19 @@ class CustomClass:
You can ignore specific findings by creating a `.gitleaksignore` file at the root of your repo. In release v8.10.0 Gitleaks added a `Fingerprint` value to the Gitleaks report. Each leak, or finding, has a Fingerprint that uniquely identifies a secret. Add this fingerprint to the `.gitleaksignore` file to ignore that specific secret. See Gitleaks' [.gitleaksignore](https://github.com/zricethezav/gitleaks/blob/master/.gitleaksignore) for an example. Note: this feature is experimental and is subject to change in the future. You can ignore specific findings by creating a `.gitleaksignore` file at the root of your repo. In release v8.10.0 Gitleaks added a `Fingerprint` value to the Gitleaks report. Each leak, or finding, has a Fingerprint that uniquely identifies a secret. Add this fingerprint to the `.gitleaksignore` file to ignore that specific secret. See Gitleaks' [.gitleaksignore](https://github.com/zricethezav/gitleaks/blob/master/.gitleaksignore) for an example. Note: this feature is experimental and is subject to change in the future.
## Sponsorships ## Sponsorships
<p align="left">
<h3><a href="https://coderabbit.ai/?utm_source=oss&utm_medium=sponsorship&utm_campaign=gitleaks">coderabbit.ai</h3>
<a href="https://coderabbit.ai/?utm_source=oss&utm_medium=sponsorship&utm_campaign=gitleaks">
<img alt="CodeRabbit.ai Sponsorship" src="https://github.com/gitleaks/gitleaks/assets/15034943/76c30a85-887b-47ca-9956-17a8e55c6c41" width=200>
</a>
</p>
<p align="left"> <p align="left">
<a href="https://www.tines.com/?utm_source=oss&utm_medium=sponsorship&utm_campaign=gitleaks"> <a href="https://www.tines.com/?utm_source=oss&utm_medium=sponsorship&utm_campaign=gitleaks">
<img alt="Tines Sponsorship" src="https://user-images.githubusercontent.com/15034943/146411864-4878f936-b4f7-49a0-b625-f9f40c704bfa.png" width=200> <img alt="Tines Sponsorship" src="https://user-images.githubusercontent.com/15034943/146411864-4878f936-b4f7-49a0-b625-f9f40c704bfa.png" width=200>
</a> </a>
</p> </p>
## Exit Codes ## Exit Codes
You can always set the exit code when leaks are encountered with the --exit-code flag. Default exit codes below: You can always set the exit code when leaks are encountered with the --exit-code flag. Default exit codes below:
+16 -168
View File
@@ -2,28 +2,19 @@ package cmd
import ( import (
"os" "os"
"path/filepath"
"strings"
"time" "time"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/detect"
"github.com/zricethezav/gitleaks/v8/report" "github.com/zricethezav/gitleaks/v8/report"
"github.com/zricethezav/gitleaks/v8/sources"
) )
func init() { func init() {
rootCmd.AddCommand(detectCmd) rootCmd.AddCommand(detectCmd)
detectCmd.Flags().String("log-opts", "", "git log options")
detectCmd.Flags().Bool("no-git", false, "treat git repo as a regular directory and scan those files, --log-opts has no effect on the scan when --no-git is set") detectCmd.Flags().Bool("no-git", false, "treat git repo as a regular directory and scan those files, --log-opts has no effect on the scan when --no-git is set")
detectCmd.Flags().Bool("pipe", false, "scan input from stdin, ex: `cat some_file | gitleaks detect --pipe`") detectCmd.Flags().Bool("pipe", false, "scan input from stdin, ex: `cat some_file | gitleaks detect --pipe`")
detectCmd.Flags().Bool("follow-symlinks", false, "scan files that are symlinks to other files")
detectCmd.Flags().StringSlice("enable-rule", []string{}, "only enable specific rules by id, ex: `gitleaks detect --enable-rule=atlassian-api-token --enable-rule=slack-access-token`")
detectCmd.Flags().StringP("gitleaks-ignore-path", "i", ".", "path to .gitleaksignore file or folder containing one")
} }
var detectCmd = &cobra.Command{ var detectCmd = &cobra.Command{
@@ -35,117 +26,22 @@ var detectCmd = &cobra.Command{
func runDetect(cmd *cobra.Command, args []string) { func runDetect(cmd *cobra.Command, args []string) {
initConfig() initConfig()
var ( var (
vc config.ViperConfig
findings []report.Finding findings []report.Finding
err error err error
) )
// Load config // setup config (aka, the thing that defines rules)
if err = viper.Unmarshal(&vc); err != nil { cfg := Config(cmd)
log.Fatal().Err(err).Msg("Failed to load config")
}
cfg, err := vc.Translate()
if err != nil {
log.Fatal().Err(err).Msg("Failed to load config")
}
cfg.Path, _ = cmd.Flags().GetString("config")
// start timer // start timer
start := time.Now() start := time.Now()
// Setup detector // grab source
detector := detect.NewDetector(cfg)
// set color flag at first
if detector.NoColor, err = cmd.Flags().GetBool("no-color"); err != nil {
log.Fatal().Err(err).Msg("")
}
// also init logger again without color
if detector.NoColor {
log.Logger = log.Output(zerolog.ConsoleWriter{
Out: os.Stderr,
NoColor: detector.NoColor,
})
}
detector.Config.Path, err = cmd.Flags().GetString("config")
if err != nil {
log.Fatal().Err(err).Msg("")
}
source, err := cmd.Flags().GetString("source") source, err := cmd.Flags().GetString("source")
if err != nil { if err != nil {
log.Fatal().Err(err).Msg("") log.Fatal().Err(err).Msg("")
} }
// if config path is not set, then use the {source}/.gitleaks.toml path. detector := Detector(cmd, cfg, source)
// note that there may not be a `{source}/.gitleaks.toml` file, this is ok.
if detector.Config.Path == "" {
detector.Config.Path = filepath.Join(source, ".gitleaks.toml")
}
// set verbose flag
if detector.Verbose, err = cmd.Flags().GetBool("verbose"); err != nil {
log.Fatal().Err(err).Msg("")
}
// set redact flag
if detector.Redact, err = cmd.Flags().GetUint("redact"); err != nil {
log.Fatal().Err(err).Msg("")
}
if detector.MaxTargetMegaBytes, err = cmd.Flags().GetInt("max-target-megabytes"); err != nil {
log.Fatal().Err(err).Msg("")
}
// set ignore gitleaks:allow flag
if detector.IgnoreGitleaksAllow, err = cmd.Flags().GetBool("ignore-gitleaks-allow"); err != nil {
log.Fatal().Err(err).Msg("")
}
gitleaksIgnorePath, err := cmd.Flags().GetString("gitleaks-ignore-path")
if err != nil {
log.Fatal().Err(err).Msg("could not get .gitleaksignore path")
}
if fileExists(gitleaksIgnorePath) {
if err = detector.AddGitleaksIgnore(gitleaksIgnorePath); err != nil {
log.Fatal().Err(err).Msg("could not call AddGitleaksIgnore")
}
}
if fileExists(filepath.Join(gitleaksIgnorePath, ".gitleaksignore")) {
if err = detector.AddGitleaksIgnore(filepath.Join(gitleaksIgnorePath, ".gitleaksignore")); err != nil {
log.Fatal().Err(err).Msg("could not call AddGitleaksIgnore")
}
}
if fileExists(filepath.Join(source, ".gitleaksignore")) {
if err = detector.AddGitleaksIgnore(filepath.Join(source, ".gitleaksignore")); err != nil {
log.Fatal().Err(err).Msg("could not call AddGitleaksIgnore")
}
}
// ignore findings from the baseline (an existing report in json format generated earlier)
baselinePath, _ := cmd.Flags().GetString("baseline-path")
if baselinePath != "" {
err = detector.AddBaseline(baselinePath, source)
if err != nil {
log.Error().Msgf("Could not load baseline. The path must point of a gitleaks report generated using the default format: %s", err)
}
}
// If set, only apply rules that are defined in the flag
rules, _ := cmd.Flags().GetStringSlice("enable-rule")
if len(rules) > 0 {
log.Info().Msg("Overriding enabled rules: " + strings.Join(rules, ", "))
ruleOverride := make(map[string]config.Rule)
for _, ruleName := range rules {
if rule, ok := cfg.Rules[ruleName]; ok {
ruleOverride[ruleName] = rule
} else {
log.Fatal().Msgf("Requested rule %s not found in rules", ruleName)
}
}
detector.Config.Rules = ruleOverride
}
// set follow symlinks flag
if detector.FollowSymlinks, err = cmd.Flags().GetBool("follow-symlinks"); err != nil {
log.Fatal().Err(err).Msg("")
}
// set exit code // set exit code
exitCode, err := cmd.Flags().GetInt("exit-code") exitCode, err := cmd.Flags().GetInt("exit-code")
@@ -167,7 +63,11 @@ func runDetect(cmd *cobra.Command, args []string) {
// start the detector scan // start the detector scan
if noGit { if noGit {
findings, err = detector.DetectFiles(source) paths, err := sources.DirectoryTargets(source, detector.Sema, detector.FollowSymlinks)
if err != nil {
log.Fatal().Err(err)
}
findings, err = detector.DetectFiles(paths)
if err != nil { if err != nil {
// don't exit on error, just log it // don't exit on error, just log it
log.Error().Err(err).Msg("") log.Error().Err(err).Msg("")
@@ -185,68 +85,16 @@ func runDetect(cmd *cobra.Command, args []string) {
if err != nil { if err != nil {
log.Fatal().Err(err).Msg("") log.Fatal().Err(err).Msg("")
} }
findings, err = detector.DetectGit(source, logOpts, detect.DetectType) gitCmd, err := sources.NewGitLogCmd(source, logOpts)
if err != nil {
log.Fatal().Err(err).Msg("")
}
findings, err = detector.DetectGit(gitCmd)
if err != nil { if err != nil {
// don't exit on error, just log it // don't exit on error, just log it
log.Error().Err(err).Msg("") log.Error().Err(err).Msg("")
} }
} }
// log info about the scan findingSummaryAndExit(findings, cmd, cfg, exitCode, start, err)
if err == nil {
log.Info().Msgf("scan completed in %s", FormatDuration(time.Since(start)))
if len(findings) != 0 {
log.Warn().Msgf("leaks found: %d", len(findings))
} else {
log.Info().Msg("no leaks found")
}
} else {
log.Warn().Msgf("partial scan completed in %s", FormatDuration(time.Since(start)))
if len(findings) != 0 {
log.Warn().Msgf("%d leaks found in partial scan", len(findings))
} else {
log.Warn().Msg("no leaks found in partial scan")
}
}
// write report if desired
reportPath, _ := cmd.Flags().GetString("report-path")
ext, _ := cmd.Flags().GetString("report-format")
if reportPath != "" {
if err := report.Write(findings, cfg, ext, reportPath); err != nil {
log.Fatal().Err(err).Msg("could not write")
}
}
if err != nil {
os.Exit(1)
}
if len(findings) != 0 {
os.Exit(exitCode)
}
}
func fileExists(fileName string) bool {
// check for a .gitleaksignore file
info, err := os.Stat(fileName)
if err != nil && !os.IsNotExist(err) {
return false
}
if info != nil && err == nil {
if !info.IsDir() {
return true
}
}
return false
}
func FormatDuration(d time.Duration) string {
scale := 100 * time.Second
// look for the max scale that is smaller than d
for scale > d {
scale = scale / 10
}
return d.Round(scale / 100).String()
} }
+187 -171
View File
@@ -14,179 +14,195 @@ const (
templatePath = "rules/config.tmpl" templatePath = "rules/config.tmpl"
) )
//go:generate go run $GOFILE ../../../config/gitleaks.toml
func main() { func main() {
var configRules []*config.Rule if len(os.Args) < 2 {
configRules = append(configRules, rules.AdafruitAPIKey()) os.Stderr.WriteString("Specify path to the gitleaks.toml config\n")
configRules = append(configRules, rules.AdobeClientID()) os.Exit(2)
configRules = append(configRules, rules.AdobeClientSecret()) }
configRules = append(configRules, rules.AgeSecretKey()) gitleaksConfigPath := os.Args[1]
configRules = append(configRules, rules.Airtable())
configRules = append(configRules, rules.AlgoliaApiKey()) configRules := []*config.Rule{
configRules = append(configRules, rules.AlibabaAccessKey()) rules.AdafruitAPIKey(),
configRules = append(configRules, rules.AlibabaSecretKey()) rules.AdobeClientID(),
configRules = append(configRules, rules.AsanaClientID()) rules.AdobeClientSecret(),
configRules = append(configRules, rules.AsanaClientSecret()) rules.AgeSecretKey(),
configRules = append(configRules, rules.Atlassian()) rules.Airtable(),
configRules = append(configRules, rules.Authress()) rules.AlgoliaApiKey(),
configRules = append(configRules, rules.AWS()) rules.AlibabaAccessKey(),
configRules = append(configRules, rules.BitBucketClientID()) rules.AlibabaSecretKey(),
configRules = append(configRules, rules.BitBucketClientSecret()) rules.AsanaClientID(),
configRules = append(configRules, rules.BittrexAccessKey()) rules.AsanaClientSecret(),
configRules = append(configRules, rules.BittrexSecretKey()) rules.Atlassian(),
configRules = append(configRules, rules.Beamer()) rules.Authress(),
configRules = append(configRules, rules.CodecovAccessToken()) rules.AWS(),
configRules = append(configRules, rules.CoinbaseAccessToken()) rules.BitBucketClientID(),
configRules = append(configRules, rules.Clojars()) rules.BitBucketClientSecret(),
configRules = append(configRules, rules.ConfluentAccessToken()) rules.BittrexAccessKey(),
configRules = append(configRules, rules.ConfluentSecretKey()) rules.BittrexSecretKey(),
configRules = append(configRules, rules.Contentful()) rules.Beamer(),
configRules = append(configRules, rules.Databricks()) rules.CodecovAccessToken(),
configRules = append(configRules, rules.DatadogtokenAccessToken()) rules.CoinbaseAccessToken(),
configRules = append(configRules, rules.DefinedNetworkingAPIToken()) rules.Clojars(),
configRules = append(configRules, rules.DigitalOceanPAT()) rules.CloudflareAPIKey(),
configRules = append(configRules, rules.DigitalOceanOAuthToken()) rules.CloudflareGlobalAPIKey(),
configRules = append(configRules, rules.DigitalOceanRefreshToken()) rules.CloudflareOriginCAKey(),
configRules = append(configRules, rules.DiscordAPIToken()) rules.ConfluentAccessToken(),
configRules = append(configRules, rules.DiscordClientID()) rules.ConfluentSecretKey(),
configRules = append(configRules, rules.DiscordClientSecret()) rules.Contentful(),
configRules = append(configRules, rules.Doppler()) rules.Databricks(),
configRules = append(configRules, rules.DropBoxAPISecret()) rules.DatadogtokenAccessToken(),
configRules = append(configRules, rules.DropBoxLongLivedAPIToken()) rules.DefinedNetworkingAPIToken(),
configRules = append(configRules, rules.DropBoxShortLivedAPIToken()) rules.DigitalOceanPAT(),
configRules = append(configRules, rules.DroneciAccessToken()) rules.DigitalOceanOAuthToken(),
configRules = append(configRules, rules.Duffel()) rules.DigitalOceanRefreshToken(),
configRules = append(configRules, rules.Dynatrace()) rules.DiscordAPIToken(),
configRules = append(configRules, rules.EasyPost()) rules.DiscordClientID(),
configRules = append(configRules, rules.EasyPostTestAPI()) rules.DiscordClientSecret(),
configRules = append(configRules, rules.EtsyAccessToken()) rules.Doppler(),
configRules = append(configRules, rules.Facebook()) rules.DropBoxAPISecret(),
configRules = append(configRules, rules.FastlyAPIToken()) rules.DropBoxLongLivedAPIToken(),
configRules = append(configRules, rules.FinicityClientSecret()) rules.DropBoxShortLivedAPIToken(),
configRules = append(configRules, rules.FinicityAPIToken()) rules.DroneciAccessToken(),
configRules = append(configRules, rules.FlickrAccessToken()) rules.Duffel(),
configRules = append(configRules, rules.FinnhubAccessToken()) rules.Dynatrace(),
configRules = append(configRules, rules.FlutterwavePublicKey()) rules.EasyPost(),
configRules = append(configRules, rules.FlutterwaveSecretKey()) rules.EasyPostTestAPI(),
configRules = append(configRules, rules.FlutterwaveEncKey()) rules.EtsyAccessToken(),
configRules = append(configRules, rules.FrameIO()) rules.FacebookSecret(),
configRules = append(configRules, rules.FreshbooksAccessToken()) rules.FacebookAccessToken(),
configRules = append(configRules, rules.GoCardless()) rules.FacebookPageAccessToken(),
// TODO figure out what makes sense for GCP rules.FastlyAPIToken(),
// configRules = append(configRules, rules.GCPServiceAccount()) rules.FinicityClientSecret(),
configRules = append(configRules, rules.GCPAPIKey()) rules.FinicityAPIToken(),
configRules = append(configRules, rules.GitHubPat()) rules.FlickrAccessToken(),
configRules = append(configRules, rules.GitHubFineGrainedPat()) rules.FinnhubAccessToken(),
configRules = append(configRules, rules.GitHubOauth()) rules.FlutterwavePublicKey(),
configRules = append(configRules, rules.GitHubApp()) rules.FlutterwaveSecretKey(),
configRules = append(configRules, rules.GitHubRefresh()) rules.FlutterwaveEncKey(),
configRules = append(configRules, rules.GitlabPat()) rules.FrameIO(),
configRules = append(configRules, rules.GitlabPipelineTriggerToken()) rules.FreshbooksAccessToken(),
configRules = append(configRules, rules.GitlabRunnerRegistrationToken()) rules.GoCardless(),
configRules = append(configRules, rules.GitterAccessToken()) // TODO figure out what makes sense for GCP
configRules = append(configRules, rules.GrafanaApiKey()) // rules.GCPServiceAccount(),
configRules = append(configRules, rules.GrafanaCloudApiToken()) rules.GCPAPIKey(),
configRules = append(configRules, rules.GrafanaServiceAccountToken()) rules.GitHubPat(),
configRules = append(configRules, rules.Hashicorp()) rules.GitHubFineGrainedPat(),
configRules = append(configRules, rules.HashicorpField()) rules.GitHubOauth(),
configRules = append(configRules, rules.Heroku()) rules.GitHubApp(),
configRules = append(configRules, rules.HubSpot()) rules.GitHubRefresh(),
configRules = append(configRules, rules.HuggingFaceAccessToken()) rules.GitlabPat(),
configRules = append(configRules, rules.HuggingFaceOrganizationApiToken()) rules.GitlabPipelineTriggerToken(),
configRules = append(configRules, rules.Intercom()) rules.GitlabRunnerRegistrationToken(),
configRules = append(configRules, rules.JFrogAPIKey()) rules.GitterAccessToken(),
configRules = append(configRules, rules.JFrogIdentityToken()) rules.GrafanaApiKey(),
configRules = append(configRules, rules.JWT()) rules.GrafanaCloudApiToken(),
configRules = append(configRules, rules.JWTBase64()) rules.GrafanaServiceAccountToken(),
configRules = append(configRules, rules.KrakenAccessToken()) rules.Hashicorp(),
configRules = append(configRules, rules.KucoinAccessToken()) rules.HashicorpField(),
configRules = append(configRules, rules.KucoinSecretKey()) rules.Heroku(),
configRules = append(configRules, rules.LaunchDarklyAccessToken()) rules.HubSpot(),
configRules = append(configRules, rules.LinearAPIToken()) rules.HuggingFaceAccessToken(),
configRules = append(configRules, rules.LinearClientSecret()) rules.HuggingFaceOrganizationApiToken(),
configRules = append(configRules, rules.LinkedinClientID()) rules.Intercom(),
configRules = append(configRules, rules.LinkedinClientSecret()) rules.Intra42ClientSecret(),
configRules = append(configRules, rules.LobAPIToken()) rules.JFrogAPIKey(),
configRules = append(configRules, rules.LobPubAPIToken()) rules.JFrogIdentityToken(),
configRules = append(configRules, rules.MailChimp()) rules.JWT(),
configRules = append(configRules, rules.MailGunPubAPIToken()) rules.JWTBase64(),
configRules = append(configRules, rules.MailGunPrivateAPIToken()) rules.KrakenAccessToken(),
configRules = append(configRules, rules.MailGunSigningKey()) rules.KucoinAccessToken(),
configRules = append(configRules, rules.MapBox()) rules.KucoinSecretKey(),
configRules = append(configRules, rules.MattermostAccessToken()) rules.LaunchDarklyAccessToken(),
configRules = append(configRules, rules.MessageBirdAPIToken()) rules.LinearAPIToken(),
configRules = append(configRules, rules.MessageBirdClientID()) rules.LinearClientSecret(),
configRules = append(configRules, rules.NetlifyAccessToken()) rules.LinkedinClientID(),
configRules = append(configRules, rules.NewRelicUserID()) rules.LinkedinClientSecret(),
configRules = append(configRules, rules.NewRelicUserKey()) rules.LobAPIToken(),
configRules = append(configRules, rules.NewRelicBrowserAPIKey()) rules.LobPubAPIToken(),
configRules = append(configRules, rules.NPM()) rules.MailChimp(),
configRules = append(configRules, rules.NytimesAccessToken()) rules.MailGunPubAPIToken(),
configRules = append(configRules, rules.OktaAccessToken()) rules.MailGunPrivateAPIToken(),
configRules = append(configRules, rules.OpenAI()) rules.MailGunSigningKey(),
configRules = append(configRules, rules.PlaidAccessID()) rules.MapBox(),
configRules = append(configRules, rules.PlaidSecretKey()) rules.MattermostAccessToken(),
configRules = append(configRules, rules.PlaidAccessToken()) rules.MessageBirdAPIToken(),
configRules = append(configRules, rules.PlanetScalePassword()) rules.MessageBirdClientID(),
configRules = append(configRules, rules.PlanetScaleAPIToken()) rules.NetlifyAccessToken(),
configRules = append(configRules, rules.PlanetScaleOAuthToken()) rules.NewRelicUserID(),
configRules = append(configRules, rules.PostManAPI()) rules.NewRelicUserKey(),
configRules = append(configRules, rules.Prefect()) rules.NewRelicBrowserAPIKey(),
configRules = append(configRules, rules.PrivateKey()) rules.NewRelicInsertKey(),
configRules = append(configRules, rules.PulumiAPIToken()) rules.NPM(),
configRules = append(configRules, rules.PyPiUploadToken()) rules.NytimesAccessToken(),
configRules = append(configRules, rules.RapidAPIAccessToken()) rules.OktaAccessToken(),
configRules = append(configRules, rules.ReadMe()) rules.OpenAI(),
configRules = append(configRules, rules.RubyGemsAPIToken()) rules.PlaidAccessID(),
configRules = append(configRules, rules.ScalingoAPIToken()) rules.PlaidSecretKey(),
configRules = append(configRules, rules.SendbirdAccessID()) rules.PlaidAccessToken(),
configRules = append(configRules, rules.SendbirdAccessToken()) rules.PlanetScalePassword(),
configRules = append(configRules, rules.SendGridAPIToken()) rules.PlanetScaleAPIToken(),
configRules = append(configRules, rules.SendInBlueAPIToken()) rules.PlanetScaleOAuthToken(),
configRules = append(configRules, rules.SentryAccessToken()) rules.PostManAPI(),
configRules = append(configRules, rules.ShippoAPIToken()) rules.Prefect(),
configRules = append(configRules, rules.ShopifyAccessToken()) rules.PrivateKey(),
configRules = append(configRules, rules.ShopifyCustomAccessToken()) rules.PulumiAPIToken(),
configRules = append(configRules, rules.ShopifyPrivateAppAccessToken()) rules.PyPiUploadToken(),
configRules = append(configRules, rules.ShopifySharedSecret()) rules.RapidAPIAccessToken(),
configRules = append(configRules, rules.SidekiqSecret()) rules.ReadMe(),
configRules = append(configRules, rules.SidekiqSensitiveUrl()) rules.RubyGemsAPIToken(),
configRules = append(configRules, rules.SlackBotToken()) rules.ScalingoAPIToken(),
configRules = append(configRules, rules.SlackUserToken()) rules.SendbirdAccessID(),
configRules = append(configRules, rules.SlackAppLevelToken()) rules.SendbirdAccessToken(),
configRules = append(configRules, rules.SlackConfigurationToken()) rules.SendGridAPIToken(),
configRules = append(configRules, rules.SlackConfigurationRefreshToken()) rules.SendInBlueAPIToken(),
configRules = append(configRules, rules.SlackLegacyBotToken()) rules.SentryAccessToken(),
configRules = append(configRules, rules.SlackLegacyWorkspaceToken()) rules.ShippoAPIToken(),
configRules = append(configRules, rules.SlackLegacyToken()) rules.ShopifyAccessToken(),
configRules = append(configRules, rules.SlackWebHookUrl()) rules.ShopifyCustomAccessToken(),
configRules = append(configRules, rules.Snyk()) rules.ShopifyPrivateAppAccessToken(),
configRules = append(configRules, rules.StripeAccessToken()) rules.ShopifySharedSecret(),
configRules = append(configRules, rules.SquareAccessToken()) rules.SidekiqSecret(),
configRules = append(configRules, rules.SquareSpaceAccessToken()) rules.SidekiqSensitiveUrl(),
configRules = append(configRules, rules.SumoLogicAccessID()) rules.SlackBotToken(),
configRules = append(configRules, rules.SumoLogicAccessToken()) rules.SlackUserToken(),
configRules = append(configRules, rules.TeamsWebhook()) rules.SlackAppLevelToken(),
configRules = append(configRules, rules.TelegramBotToken()) rules.SlackConfigurationToken(),
configRules = append(configRules, rules.TravisCIAccessToken()) rules.SlackConfigurationRefreshToken(),
configRules = append(configRules, rules.Twilio()) rules.SlackLegacyBotToken(),
configRules = append(configRules, rules.TwitchAPIToken()) rules.SlackLegacyWorkspaceToken(),
configRules = append(configRules, rules.TwitterAPIKey()) rules.SlackLegacyToken(),
configRules = append(configRules, rules.TwitterAPISecret()) rules.SlackWebHookUrl(),
configRules = append(configRules, rules.TwitterAccessToken()) rules.Snyk(),
configRules = append(configRules, rules.TwitterAccessSecret()) rules.StripeAccessToken(),
configRules = append(configRules, rules.TwitterBearerToken()) rules.SquareAccessToken(),
configRules = append(configRules, rules.Typeform()) rules.SquareSpaceAccessToken(),
configRules = append(configRules, rules.VaultBatchToken()) rules.SumoLogicAccessID(),
configRules = append(configRules, rules.VaultServiceToken()) rules.SumoLogicAccessToken(),
configRules = append(configRules, rules.YandexAPIKey()) rules.TeamsWebhook(),
configRules = append(configRules, rules.YandexAWSAccessToken()) rules.TelegramBotToken(),
configRules = append(configRules, rules.YandexAccessToken()) rules.TravisCIAccessToken(),
configRules = append(configRules, rules.ZendeskSecretKey()) rules.Twilio(),
configRules = append(configRules, rules.GenericCredential()) rules.TwitchAPIToken(),
configRules = append(configRules, rules.InfracostAPIToken()) rules.TwitterAPIKey(),
rules.TwitterAPISecret(),
rules.TwitterAccessToken(),
rules.TwitterAccessSecret(),
rules.TwitterBearerToken(),
rules.Typeform(),
rules.VaultBatchToken(),
rules.VaultServiceToken(),
rules.YandexAPIKey(),
rules.YandexAWSAccessToken(),
rules.YandexAccessToken(),
rules.ZendeskSecretKey(),
rules.GenericCredential(),
rules.InfracostAPIToken(),
}
// ensure rules have unique ids // ensure rules have unique ids
ruleLookUp := make(map[string]config.Rule) ruleLookUp := make(map[string]config.Rule, len(configRules))
for _, rule := range configRules { for _, rule := range configRules {
// check if rule is in ruleLookUp // check if rule is in ruleLookUp
if _, ok := ruleLookUp[rule.RuleID]; ok { if _, ok := ruleLookUp[rule.RuleID]; ok {
@@ -202,7 +218,7 @@ func main() {
log.Fatal().Err(err).Msg("Failed to parse template") log.Fatal().Err(err).Msg("Failed to parse template")
} }
f, err := os.Create("../../../config/gitleaks.toml") f, err := os.Create(gitleaksConfigPath)
if err != nil { if err != nil {
log.Fatal().Err(err).Msg("Failed to create rules.toml") log.Fatal().Err(err).Msg("Failed to create rules.toml")
} }
+1 -1
View File
@@ -8,7 +8,7 @@ import (
func AdafruitAPIKey() *config.Rule { func AdafruitAPIKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Adafruit API Key", Description: "Identified a potential Adafruit API Key, which could lead to unauthorized access to Adafruit services and sensitive data exposure.",
RuleID: "adafruit-api-key", RuleID: "adafruit-api-key",
Regex: generateSemiGenericRegex([]string{"adafruit"}, alphaNumericExtendedShort("32"), true), Regex: generateSemiGenericRegex([]string{"adafruit"}, alphaNumericExtendedShort("32"), true),
Keywords: []string{"adafruit"}, Keywords: []string{"adafruit"},
+2 -2
View File
@@ -8,7 +8,7 @@ import (
func AdobeClientID() *config.Rule { func AdobeClientID() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Adobe Client ID (OAuth Web)", Description: "Detected a pattern that resembles an Adobe OAuth Web Client ID, posing a risk of compromised Adobe integrations and data breaches.",
RuleID: "adobe-client-id", RuleID: "adobe-client-id",
Regex: generateSemiGenericRegex([]string{"adobe"}, hex("32"), true), Regex: generateSemiGenericRegex([]string{"adobe"}, hex("32"), true),
Keywords: []string{"adobe"}, Keywords: []string{"adobe"},
@@ -24,7 +24,7 @@ func AdobeClientID() *config.Rule {
func AdobeClientSecret() *config.Rule { func AdobeClientSecret() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Adobe Client Secret", Description: "Discovered a potential Adobe Client Secret, which, if exposed, could allow unauthorized Adobe service access and data manipulation.",
RuleID: "adobe-client-secret", RuleID: "adobe-client-secret",
Regex: generateUniqueTokenRegex(`(p8e-)(?i)[a-z0-9]{32}`, true), Regex: generateUniqueTokenRegex(`(p8e-)(?i)[a-z0-9]{32}`, true),
Keywords: []string{"p8e-"}, Keywords: []string{"p8e-"},
+2 -2
View File
@@ -9,8 +9,8 @@ import (
func AgeSecretKey() *config.Rule { func AgeSecretKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Age secret key", Description: "Discovered a potential Age encryption tool secret key, risking data decryption and unauthorized access to sensitive information.",
RuleID: "age secret key", RuleID: "age-secret-key",
Regex: regexp.MustCompile(`AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}`), Regex: regexp.MustCompile(`AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}`),
Keywords: []string{"AGE-SECRET-KEY-1"}, Keywords: []string{"AGE-SECRET-KEY-1"},
} }
+1 -1
View File
@@ -8,7 +8,7 @@ import (
func Airtable() *config.Rule { func Airtable() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Airtable API Key", Description: "Uncovered a possible Airtable API Key, potentially compromising database access and leading to data leakage or alteration.",
RuleID: "airtable-api-key", RuleID: "airtable-api-key",
Regex: generateSemiGenericRegex([]string{"airtable"}, alphaNumeric("17"), true), Regex: generateSemiGenericRegex([]string{"airtable"}, alphaNumeric("17"), true),
Keywords: []string{"airtable"}, Keywords: []string{"airtable"},
+1 -1
View File
@@ -8,7 +8,7 @@ import (
func AlgoliaApiKey() *config.Rule { func AlgoliaApiKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Algolia API Key", Description: "Identified an Algolia API Key, which could result in unauthorized search operations and data exposure on Algolia-managed platforms.",
RuleID: "algolia-api-key", RuleID: "algolia-api-key",
Regex: generateSemiGenericRegex([]string{"algolia"}, `[a-z0-9]{32}`, true), Regex: generateSemiGenericRegex([]string{"algolia"}, `[a-z0-9]{32}`, true),
Keywords: []string{"algolia"}, Keywords: []string{"algolia"},
+2 -2
View File
@@ -8,7 +8,7 @@ import (
func AlibabaAccessKey() *config.Rule { func AlibabaAccessKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Alibaba AccessKey ID", Description: "Detected an Alibaba Cloud AccessKey ID, posing a risk of unauthorized cloud resource access and potential data compromise.",
RuleID: "alibaba-access-key-id", RuleID: "alibaba-access-key-id",
Regex: generateUniqueTokenRegex(`(LTAI)(?i)[a-z0-9]{20}`, true), Regex: generateUniqueTokenRegex(`(LTAI)(?i)[a-z0-9]{20}`, true),
Keywords: []string{"LTAI"}, Keywords: []string{"LTAI"},
@@ -25,7 +25,7 @@ func AlibabaAccessKey() *config.Rule {
func AlibabaSecretKey() *config.Rule { func AlibabaSecretKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Alibaba Secret Key", Description: "Discovered a potential Alibaba Cloud Secret Key, potentially allowing unauthorized operations and data access within Alibaba Cloud.",
RuleID: "alibaba-secret-key", RuleID: "alibaba-secret-key",
Regex: generateSemiGenericRegex([]string{"alibaba"}, Regex: generateSemiGenericRegex([]string{"alibaba"},
alphaNumeric("30"), true), alphaNumeric("30"), true),
+2 -2
View File
@@ -8,7 +8,7 @@ import (
func AsanaClientID() *config.Rule { func AsanaClientID() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Asana Client ID", Description: "Discovered a potential Asana Client ID, risking unauthorized access to Asana projects and sensitive task information.",
RuleID: "asana-client-id", RuleID: "asana-client-id",
Regex: generateSemiGenericRegex([]string{"asana"}, numeric("16"), true), Regex: generateSemiGenericRegex([]string{"asana"}, numeric("16"), true),
Keywords: []string{"asana"}, Keywords: []string{"asana"},
@@ -24,7 +24,7 @@ func AsanaClientID() *config.Rule {
func AsanaClientSecret() *config.Rule { func AsanaClientSecret() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Asana Client Secret", Description: "Identified an Asana Client Secret, which could lead to compromised project management integrity and unauthorized access.",
RuleID: "asana-client-secret", RuleID: "asana-client-secret",
Regex: generateSemiGenericRegex([]string{"asana"}, alphaNumeric("32"), true), Regex: generateSemiGenericRegex([]string{"asana"}, alphaNumeric("32"), true),
+1 -1
View File
@@ -8,7 +8,7 @@ import (
func Atlassian() *config.Rule { func Atlassian() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Atlassian API token", Description: "Detected an Atlassian API token, posing a threat to project management and collaboration tool security and data confidentiality.",
RuleID: "atlassian-api-token", RuleID: "atlassian-api-token",
Regex: generateSemiGenericRegex([]string{ Regex: generateSemiGenericRegex([]string{
"atlassian", "confluence", "jira"}, alphaNumeric("24"), true), "atlassian", "confluence", "jira"}, alphaNumeric("24"), true),
+2 -2
View File
@@ -9,9 +9,9 @@ import (
func Authress() *config.Rule { func Authress() *config.Rule {
// Rule Definition // Rule Definition
// (Note: When changes are made to this, rerun `cd cmd/generate/config && go run main.go` and commit the config/gitleaks.toml file // (Note: When changes are made to this, rerun `go generate ./...` and commit the config/gitleaks.toml file
r := config.Rule{ r := config.Rule{
Description: "Authress Service Client Access Key", Description: "Uncovered a possible Authress Service Client Access Key, which may compromise access control services and sensitive data.",
RuleID: "authress-service-client-access-key", RuleID: "authress-service-client-access-key",
Regex: generateUniqueTokenRegex(`(?:sc|ext|scauth|authress)_[a-z0-9]{5,30}\.[a-z0-9]{4,6}\.acc[_-][a-z0-9-]{10,32}\.[a-z0-9+/_=-]{30,120}`, true), Regex: generateUniqueTokenRegex(`(?:sc|ext|scauth|authress)_[a-z0-9]{5,30}\.[a-z0-9]{4,6}\.acc[_-][a-z0-9-]{10,32}\.[a-z0-9+/_=-]{30,120}`, true),
Keywords: []string{"sc_", "ext_", "scauth_", "authress_"}, Keywords: []string{"sc_", "ext_", "scauth_", "authress_"},
+4 -8
View File
@@ -9,19 +9,15 @@ import (
func AWS() *config.Rule { func AWS() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "AWS", Description: "Identified a pattern that may indicate AWS credentials, risking unauthorized cloud resource access and data breaches on AWS platforms.",
RuleID: "aws-access-token", RuleID: "aws-access-token",
Regex: regexp.MustCompile( Regex: regexp.MustCompile(
"(?:A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"), "(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}"),
Keywords: []string{ Keywords: []string{
"AKIA", "AKIA",
"AGPA",
"AIDA",
"AROA",
"AIPA",
"ANPA",
"ANVA",
"ASIA", "ASIA",
"ABIA",
"ACCA",
}, },
} }
+1 -1
View File
@@ -8,7 +8,7 @@ import (
func Beamer() *config.Rule { func Beamer() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Beamer API token", Description: "Detected a Beamer API token, potentially compromising content management and exposing sensitive notifications and updates.",
RuleID: "beamer-api-token", RuleID: "beamer-api-token",
Regex: generateSemiGenericRegex([]string{"beamer"}, Regex: generateSemiGenericRegex([]string{"beamer"},
`b_[a-z0-9=_\-]{44}`, true), `b_[a-z0-9=_\-]{44}`, true),
+2 -2
View File
@@ -8,7 +8,7 @@ import (
func BitBucketClientID() *config.Rule { func BitBucketClientID() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Bitbucket Client ID", Description: "Discovered a potential Bitbucket Client ID, risking unauthorized repository access and potential codebase exposure.",
RuleID: "bitbucket-client-id", RuleID: "bitbucket-client-id",
Regex: generateSemiGenericRegex([]string{"bitbucket"}, alphaNumeric("32"), true), Regex: generateSemiGenericRegex([]string{"bitbucket"}, alphaNumeric("32"), true),
Keywords: []string{"bitbucket"}, Keywords: []string{"bitbucket"},
@@ -24,7 +24,7 @@ func BitBucketClientID() *config.Rule {
func BitBucketClientSecret() *config.Rule { func BitBucketClientSecret() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Bitbucket Client Secret", Description: "Discovered a potential Bitbucket Client Secret, posing a risk of compromised code repositories and unauthorized access.",
RuleID: "bitbucket-client-secret", RuleID: "bitbucket-client-secret",
Regex: generateSemiGenericRegex([]string{"bitbucket"}, alphaNumericExtended("64"), true), Regex: generateSemiGenericRegex([]string{"bitbucket"}, alphaNumericExtended("64"), true),
+2 -2
View File
@@ -8,7 +8,7 @@ import (
func BittrexAccessKey() *config.Rule { func BittrexAccessKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Bittrex Access Key", Description: "Identified a Bittrex Access Key, which could lead to unauthorized access to cryptocurrency trading accounts and financial loss.",
RuleID: "bittrex-access-key", RuleID: "bittrex-access-key",
Regex: generateSemiGenericRegex([]string{"bittrex"}, alphaNumeric("32"), true), Regex: generateSemiGenericRegex([]string{"bittrex"}, alphaNumeric("32"), true),
Keywords: []string{"bittrex"}, Keywords: []string{"bittrex"},
@@ -24,7 +24,7 @@ func BittrexAccessKey() *config.Rule {
func BittrexSecretKey() *config.Rule { func BittrexSecretKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Bittrex Secret Key", Description: "Detected a Bittrex Secret Key, potentially compromising cryptocurrency transactions and financial security.",
RuleID: "bittrex-secret-key", RuleID: "bittrex-secret-key",
Regex: generateSemiGenericRegex([]string{"bittrex"}, alphaNumeric("32"), true), Regex: generateSemiGenericRegex([]string{"bittrex"}, alphaNumeric("32"), true),
+1 -1
View File
@@ -10,7 +10,7 @@ import (
func Clojars() *config.Rule { func Clojars() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Clojars API token", Description: "Uncovered a possible Clojars API token, risking unauthorized access to Clojure libraries and potential code manipulation.",
RuleID: "clojars-api-token", RuleID: "clojars-api-token",
Regex: regexp.MustCompile(`(?i)(CLOJARS_)[a-z0-9]{60}`), Regex: regexp.MustCompile(`(?i)(CLOJARS_)[a-z0-9]{60}`),
Keywords: []string{"clojars"}, Keywords: []string{"clojars"},
+76
View File
@@ -0,0 +1,76 @@
package rules
import (
"github.com/zricethezav/gitleaks/v8/config"
)
var global_keys = []string{
`cloudflare_global_api_key = "d3d1443e0adc9c24564c6c5676d679d47e2ca"`, // gitleaks:allow
`CLOUDFLARE_GLOBAL_API_KEY: 674538c7ecac77d064958a04a83d9e9db068c`, // gitleaks:allow
`cloudflare: "0574b9f43978174cc2cb9a1068681225433c4"`, // gitleaks:allow
}
var api_keys = []string{
`cloudflare_api_key = "Bu0rrK-lerk6y0Suqo1qSqlDDajOk61wZchCkje4"`, // gitleaks:allow
`CLOUDFLARE_API_KEY: 5oK0U90ME14yU6CVxV90crvfqVlNH2wRKBwcLWDc`, // gitleaks:allow
`cloudflare: "oj9Yoyq0zmOyWmPPob1aoY5YSNNuJ0fbZSOURBlX"`, // gitleaks:allow
}
var origin_ca_keys = []string{
`CLOUDFLARE_ORIGIN_CA: v1.0-aaa334dc886f30631ba0a610-0d98ef66290d7e50aac7c27b5986c99e6f3f1084c881d8ac0eae5de1d1aa0644076ff57022069b3237d19afe60ad045f207ef2b16387ee37b749441b2ae2e9ebe5b4606e846475d4a5`,
`CLOUDFLARE_ORIGIN_CA: v1.0-15d20c7fccb4234ac5cdd756-d5c2630d1b606535cf9320ae7456b090e0896cec64169a92fae4e931ab0f72f111b2e4ffed5b2bb40f6fba6b2214df23b188a23693d59ce3fb0d28f7e89a2206d98271b002dac695ed`,
}
var identifiers = []string{"cloudflare"}
func CloudflareGlobalAPIKey() *config.Rule {
// define rule
r := config.Rule{
Description: "Detected a Cloudflare Global API Key, potentially compromising cloud application deployments and operational security.",
RuleID: "cloudflare-global-api-key",
Regex: generateSemiGenericRegex(identifiers, hex("37"), true),
Keywords: identifiers,
}
// validate
tps := global_keys
fps := append(api_keys, origin_ca_keys...)
return validate(r, tps, fps)
}
func CloudflareAPIKey() *config.Rule {
// define rule
r := config.Rule{
Description: "Detected a Cloudflare API Key, potentially compromising cloud application deployments and operational security.",
RuleID: "cloudflare-api-key",
Regex: generateSemiGenericRegex(identifiers, alphaNumericExtendedShort("40"), true),
Keywords: identifiers,
}
// validate
tps := api_keys
fps := append(global_keys, origin_ca_keys...)
return validate(r, tps, fps)
}
func CloudflareOriginCAKey() *config.Rule {
ca_identifiers := append(identifiers, "v1.0-")
// define rule
r := config.Rule{
Description: "Detected a Cloudflare Origin CA Key, potentially compromising cloud application deployments and operational security.",
RuleID: "cloudflare-origin-ca-key",
Regex: generateUniqueTokenRegex(`v1\.0-`+hex("24")+"-"+hex("146"), false),
Keywords: ca_identifiers,
}
// validate
tps := origin_ca_keys
fps := append(global_keys, api_keys...)
return validate(r, tps, fps)
}
+1 -1
View File
@@ -9,7 +9,7 @@ func CodecovAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "codecov-access-token", RuleID: "codecov-access-token",
Description: "Codecov Access Token", Description: "Found a pattern resembling a Codecov Access Token, posing a risk of unauthorized access to code coverage reports and sensitive data.",
Regex: generateSemiGenericRegex([]string{"codecov"}, alphaNumeric("32"), true), Regex: generateSemiGenericRegex([]string{"codecov"}, alphaNumeric("32"), true),
Keywords: []string{ Keywords: []string{
"codecov", "codecov",
+1 -1
View File
@@ -9,7 +9,7 @@ func CoinbaseAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "coinbase-access-token", RuleID: "coinbase-access-token",
Description: "Coinbase Access Token", Description: "Detected a Coinbase Access Token, posing a risk of unauthorized access to cryptocurrency accounts and financial transactions.",
Regex: generateSemiGenericRegex([]string{"coinbase"}, Regex: generateSemiGenericRegex([]string{"coinbase"},
alphaNumericExtendedShort("64"), true), alphaNumericExtendedShort("64"), true),
Keywords: []string{ Keywords: []string{
+2 -2
View File
@@ -9,7 +9,7 @@ func ConfluentSecretKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "confluent-secret-key", RuleID: "confluent-secret-key",
Description: "Confluent Secret Key", Description: "Found a Confluent Secret Key, potentially risking unauthorized operations and data access within Confluent services.",
Regex: generateSemiGenericRegex([]string{"confluent"}, alphaNumeric("64"), true), Regex: generateSemiGenericRegex([]string{"confluent"}, alphaNumeric("64"), true),
Keywords: []string{ Keywords: []string{
"confluent", "confluent",
@@ -27,7 +27,7 @@ func ConfluentAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "confluent-access-token", RuleID: "confluent-access-token",
Description: "Confluent Access Token", Description: "Identified a Confluent Access Token, which could compromise access to streaming data platforms and sensitive data flow.",
Regex: generateSemiGenericRegex([]string{"confluent"}, alphaNumeric("16"), true), Regex: generateSemiGenericRegex([]string{"confluent"}, alphaNumeric("16"), true),
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -8,7 +8,7 @@ import (
func Contentful() *config.Rule { func Contentful() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Contentful delivery API token", Description: "Discovered a Contentful delivery API token, posing a risk to content management systems and data integrity.",
RuleID: "contentful-delivery-api-token", RuleID: "contentful-delivery-api-token",
Regex: generateSemiGenericRegex([]string{"contentful"}, Regex: generateSemiGenericRegex([]string{"contentful"},
alphaNumericExtended("43"), true), alphaNumericExtended("43"), true),
+1 -1
View File
@@ -8,7 +8,7 @@ import (
func Databricks() *config.Rule { func Databricks() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Databricks API token", Description: "Uncovered a Databricks API token, which may compromise big data analytics platforms and sensitive data processing.",
RuleID: "databricks-api-token", RuleID: "databricks-api-token",
Regex: generateUniqueTokenRegex(`dapi[a-h0-9]{32}`, true), Regex: generateUniqueTokenRegex(`dapi[a-h0-9]{32}`, true),
Keywords: []string{"dapi"}, Keywords: []string{"dapi"},
+1 -1
View File
@@ -9,7 +9,7 @@ func DatadogtokenAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "datadog-access-token", RuleID: "datadog-access-token",
Description: "Datadog Access Token", Description: "Detected a Datadog Access Token, potentially risking monitoring and analytics data exposure and manipulation.",
Regex: generateSemiGenericRegex([]string{"datadog"}, Regex: generateSemiGenericRegex([]string{"datadog"},
alphaNumeric("40"), true), alphaNumeric("40"), true),
Keywords: []string{ Keywords: []string{
@@ -9,7 +9,7 @@ func DefinedNetworkingAPIToken() *config.Rule {
// Define Rule // Define Rule
r := config.Rule{ r := config.Rule{
// Human redable description of the rule // Human redable description of the rule
Description: "Defined Networking API token", Description: "Identified a Defined Networking API token, which could lead to unauthorized network operations and data breaches.",
// Unique ID for the rule // Unique ID for the rule
RuleID: "defined-networking-api-token", RuleID: "defined-networking-api-token",
+3 -3
View File
@@ -7,7 +7,7 @@ import (
func DigitalOceanPAT() *config.Rule { func DigitalOceanPAT() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "DigitalOcean Personal Access Token", Description: "Discovered a DigitalOcean Personal Access Token, posing a threat to cloud infrastructure security and data privacy.",
RuleID: "digitalocean-pat", RuleID: "digitalocean-pat",
Regex: generateUniqueTokenRegex(`dop_v1_[a-f0-9]{64}`, true), Regex: generateUniqueTokenRegex(`dop_v1_[a-f0-9]{64}`, true),
Keywords: []string{"dop_v1_"}, Keywords: []string{"dop_v1_"},
@@ -21,7 +21,7 @@ func DigitalOceanPAT() *config.Rule {
func DigitalOceanOAuthToken() *config.Rule { func DigitalOceanOAuthToken() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "DigitalOcean OAuth Access Token", Description: "Found a DigitalOcean OAuth Access Token, risking unauthorized cloud resource access and data compromise.",
RuleID: "digitalocean-access-token", RuleID: "digitalocean-access-token",
Regex: generateUniqueTokenRegex(`doo_v1_[a-f0-9]{64}`, true), Regex: generateUniqueTokenRegex(`doo_v1_[a-f0-9]{64}`, true),
@@ -36,7 +36,7 @@ func DigitalOceanOAuthToken() *config.Rule {
func DigitalOceanRefreshToken() *config.Rule { func DigitalOceanRefreshToken() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "DigitalOcean OAuth Refresh Token", Description: "Uncovered a DigitalOcean OAuth Refresh Token, which could allow prolonged unauthorized access and resource manipulation.",
RuleID: "digitalocean-refresh-token", RuleID: "digitalocean-refresh-token",
Regex: generateUniqueTokenRegex(`dor_v1_[a-f0-9]{64}`, true), Regex: generateUniqueTokenRegex(`dor_v1_[a-f0-9]{64}`, true),
+3 -3
View File
@@ -8,7 +8,7 @@ import (
func DiscordAPIToken() *config.Rule { func DiscordAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Discord API key", Description: "Detected a Discord API key, potentially compromising communication channels and user data privacy on Discord.",
RuleID: "discord-api-token", RuleID: "discord-api-token",
Regex: generateSemiGenericRegex([]string{"discord"}, hex("64"), true), Regex: generateSemiGenericRegex([]string{"discord"}, hex("64"), true),
Keywords: []string{"discord"}, Keywords: []string{"discord"},
@@ -24,7 +24,7 @@ func DiscordAPIToken() *config.Rule {
func DiscordClientID() *config.Rule { func DiscordClientID() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Discord client ID", Description: "Identified a Discord client ID, which may lead to unauthorized integrations and data exposure in Discord applications.",
RuleID: "discord-client-id", RuleID: "discord-client-id",
Regex: generateSemiGenericRegex([]string{"discord"}, numeric("18"), true), Regex: generateSemiGenericRegex([]string{"discord"}, numeric("18"), true),
Keywords: []string{"discord"}, Keywords: []string{"discord"},
@@ -40,7 +40,7 @@ func DiscordClientID() *config.Rule {
func DiscordClientSecret() *config.Rule { func DiscordClientSecret() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Discord client secret", Description: "Discovered a potential Discord client secret, risking compromised Discord bot integrations and data leaks.",
RuleID: "discord-client-secret", RuleID: "discord-client-secret",
Regex: generateSemiGenericRegex([]string{"discord"}, alphaNumericExtended("32"), true), Regex: generateSemiGenericRegex([]string{"discord"}, alphaNumericExtended("32"), true),
Keywords: []string{"discord"}, Keywords: []string{"discord"},
+1 -1
View File
@@ -10,7 +10,7 @@ import (
func Doppler() *config.Rule { func Doppler() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Doppler API token", Description: "Discovered a Doppler API token, posing a risk to environment and secrets management security.",
RuleID: "doppler-api-token", RuleID: "doppler-api-token",
Regex: regexp.MustCompile(`(dp\.pt\.)(?i)[a-z0-9]{43}`), Regex: regexp.MustCompile(`(dp\.pt\.)(?i)[a-z0-9]{43}`),
Keywords: []string{"doppler"}, Keywords: []string{"doppler"},
+1 -1
View File
@@ -9,7 +9,7 @@ func DroneciAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "droneci-access-token", RuleID: "droneci-access-token",
Description: "Droneci Access Token", Description: "Detected a Droneci Access Token, potentially compromising continuous integration and deployment workflows.",
Regex: generateSemiGenericRegex([]string{"droneci"}, alphaNumeric("32"), true), Regex: generateSemiGenericRegex([]string{"droneci"}, alphaNumeric("32"), true),
Keywords: []string{ Keywords: []string{
+3 -3
View File
@@ -8,7 +8,7 @@ import (
func DropBoxAPISecret() *config.Rule { func DropBoxAPISecret() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Dropbox API secret", Description: "Identified a Dropbox API secret, which could lead to unauthorized file access and data breaches in Dropbox storage.",
RuleID: "dropbox-api-token", RuleID: "dropbox-api-token",
Regex: generateSemiGenericRegex([]string{"dropbox"}, alphaNumeric("15"), true), Regex: generateSemiGenericRegex([]string{"dropbox"}, alphaNumeric("15"), true),
@@ -26,7 +26,7 @@ func DropBoxShortLivedAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "dropbox-short-lived-api-token", RuleID: "dropbox-short-lived-api-token",
Description: "Dropbox short lived API token", Description: "Discovered a Dropbox short-lived API token, posing a risk of temporary but potentially harmful data access and manipulation.",
Regex: generateSemiGenericRegex([]string{"dropbox"}, `sl\.[a-z0-9\-=_]{135}`, true), Regex: generateSemiGenericRegex([]string{"dropbox"}, `sl\.[a-z0-9\-=_]{135}`, true),
Keywords: []string{"dropbox"}, Keywords: []string{"dropbox"},
} }
@@ -39,7 +39,7 @@ func DropBoxLongLivedAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "dropbox-long-lived-api-token", RuleID: "dropbox-long-lived-api-token",
Description: "Dropbox long lived API token", Description: "Found a Dropbox long-lived API token, risking prolonged unauthorized access to cloud storage and sensitive data.",
Regex: generateSemiGenericRegex([]string{"dropbox"}, `[a-z0-9]{11}(AAAAAAAAAA)[a-z0-9\-_=]{43}`, true), Regex: generateSemiGenericRegex([]string{"dropbox"}, `[a-z0-9]{11}(AAAAAAAAAA)[a-z0-9\-_=]{43}`, true),
Keywords: []string{"dropbox"}, Keywords: []string{"dropbox"},
} }
+1 -1
View File
@@ -11,7 +11,7 @@ func Duffel() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "duffel-api-token", RuleID: "duffel-api-token",
Description: "Duffel API token", Description: "Uncovered a Duffel API token, which may compromise travel platform integrations and sensitive customer data.",
Regex: regexp.MustCompile(`duffel_(test|live)_(?i)[a-z0-9_\-=]{43}`), Regex: regexp.MustCompile(`duffel_(test|live)_(?i)[a-z0-9_\-=]{43}`),
Keywords: []string{"duffel"}, Keywords: []string{"duffel"},
} }
+1 -1
View File
@@ -10,7 +10,7 @@ import (
func Dynatrace() *config.Rule { func Dynatrace() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Dynatrace API token", Description: "Detected a Dynatrace API token, potentially risking application performance monitoring and data exposure.",
RuleID: "dynatrace-api-token", RuleID: "dynatrace-api-token",
Regex: regexp.MustCompile(`dt0c01\.(?i)[a-z0-9]{24}\.[a-z0-9]{64}`), Regex: regexp.MustCompile(`dt0c01\.(?i)[a-z0-9]{24}\.[a-z0-9]{64}`),
Keywords: []string{"dynatrace"}, Keywords: []string{"dynatrace"},
+2 -2
View File
@@ -10,7 +10,7 @@ import (
func EasyPost() *config.Rule { func EasyPost() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "EasyPost API token", Description: "Identified an EasyPost API token, which could lead to unauthorized postal and shipment service access and data exposure.",
RuleID: "easypost-api-token", RuleID: "easypost-api-token",
Regex: regexp.MustCompile(`\bEZAK(?i)[a-z0-9]{54}`), Regex: regexp.MustCompile(`\bEZAK(?i)[a-z0-9]{54}`),
Keywords: []string{"EZAK"}, Keywords: []string{"EZAK"},
@@ -26,7 +26,7 @@ func EasyPost() *config.Rule {
func EasyPostTestAPI() *config.Rule { func EasyPostTestAPI() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "EasyPost test API token", Description: "Detected an EasyPost test API token, risking exposure of test environments and potentially sensitive shipment data.",
RuleID: "easypost-test-api-token", RuleID: "easypost-test-api-token",
Regex: regexp.MustCompile(`\bEZTK(?i)[a-z0-9]{54}`), Regex: regexp.MustCompile(`\bEZTK(?i)[a-z0-9]{54}`),
Keywords: []string{"EZTK"}, Keywords: []string{"EZTK"},
+1 -1
View File
@@ -9,7 +9,7 @@ func EtsyAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "etsy-access-token", RuleID: "etsy-access-token",
Description: "Etsy Access Token", Description: "Found an Etsy Access Token, potentially compromising Etsy shop management and customer data.",
Regex: generateSemiGenericRegex([]string{"etsy"}, alphaNumeric("24"), true), Regex: generateSemiGenericRegex([]string{"etsy"}, alphaNumeric("24"), true),
Keywords: []string{ Keywords: []string{
+45 -3
View File
@@ -5,11 +5,13 @@ import (
"github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/config"
) )
func Facebook() *config.Rule { // This rule includes both App Secret and Client Access Token
// https://developers.facebook.com/docs/facebook-login/guides/access-tokens/
func FacebookSecret() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Facebook Access Token", Description: "Discovered a Facebook Application secret, posing a risk of unauthorized access to Facebook accounts and personal data exposure.",
RuleID: "facebook", RuleID: "facebook-secret",
Regex: generateSemiGenericRegex([]string{"facebook"}, hex("32"), true), Regex: generateSemiGenericRegex([]string{"facebook"}, hex("32"), true),
Keywords: []string{"facebook"}, Keywords: []string{"facebook"},
@@ -18,6 +20,46 @@ func Facebook() *config.Rule {
// validate // validate
tps := []string{ tps := []string{
generateSampleSecret("facebook", secrets.NewSecret(hex("32"))), generateSampleSecret("facebook", secrets.NewSecret(hex("32"))),
`facebook_app_secret = "6dca6432e45d933e13650d1882bd5e69"`, // gitleaks:allow
`facebook_client_access_token: 26f5fd13099f2c1331aafb86f6489692`, // gitleaks:allow
}
return validate(r, tps, nil)
}
// https://developers.facebook.com/docs/facebook-login/guides/access-tokens/#apptokens
func FacebookAccessToken() *config.Rule {
// define rule
r := config.Rule{
Description: "Discovered a Facebook Access Token, posing a risk of unauthorized access to Facebook accounts and personal data exposure.",
RuleID: "facebook-access-token",
Regex: generateUniqueTokenRegex(`\d{15,16}(\||%)[0-9a-z\-_]{27,40}`, true),
}
// validate
tps := []string{
`{"access_token":"911602140448729|AY-lRJZq9BoDLobvAiP25L7RcMg","token_type":"bearer"}`, // gitleaks:allow
`1308742762612587|rhoK1cbv0DOU_RTX_87O4MkX7AI`, // gitleaks:allow
`1477036645700765|wRPf2v3mt2JfMqCLK8n7oltrEmc`, // gitleaks:allow
}
return validate(r, tps, nil)
}
// https://developers.facebook.com/docs/facebook-login/guides/access-tokens/#pagetokens
func FacebookPageAccessToken() *config.Rule {
// define rule
r := config.Rule{
Description: "Discovered a Facebook Page Access Token, posing a risk of unauthorized access to Facebook accounts and personal data exposure.",
RuleID: "facebook-page-access-token",
Regex: generateUniqueTokenRegex("EAA[MC]"+alphaNumeric("20,"), true),
Keywords: []string{"EAAM", "EAAC"},
}
// validate
tps := []string{
`EAAM9GOnCB9kBO2frzOAWGN2zMnZClQshlWydZCrBNdodesbwimx1mfVJgqZBP5RSpMfUzWhtjTTXHG5I1UlvlwRZCgjm3ZBVGeTYiqAAoxyED6HaUdhpGVNoPUwAuAWWFsi9OvyYBQt22DGLqMIgD7VktuCTTZCWKasz81Q822FPhMTB9VFFyClNzQ0NLZClt9zxpsMMrUZCo1VU1rL3CKavir5QTfBjfCEzHNlWAUDUV2YZD`, // gitleaks:allow
`EAAM9GOnCB9kBO2zXpAtRBmCrsPPjdA3KeBl4tqsEpcYd09cpjm9MZCBIklZBjIQBKGIJgFwm8IE17G5pipsfRBRBEHMWxvJsL7iHLUouiprxKRQfAagw8BEEDucceqxTiDhVW2IZAQNNbf0d1JhcapAGntx5S1Csm4j0GgZB3DuUfI2HJ9aViTtdfH2vjBy0wtpXm2iamevohGfoF4NgyRHusDLjqy91uYMkfrkc`, // gitleaks:allow
`- name: FACEBOOK_TOKEN
value: "EAACEdEose0cBA1bad3afsf2aew"`, // gitleaks:allow
} }
return validate(r, tps, nil) return validate(r, tps, nil)
} }
+1 -1
View File
@@ -8,7 +8,7 @@ import (
func FastlyAPIToken() *config.Rule { func FastlyAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Fastly API key", Description: "Uncovered a Fastly API key, which may compromise CDN and edge cloud services, leading to content delivery and security issues.",
RuleID: "fastly-api-token", RuleID: "fastly-api-token",
Regex: generateSemiGenericRegex([]string{"fastly"}, alphaNumericExtended("32"), true), Regex: generateSemiGenericRegex([]string{"fastly"}, alphaNumericExtended("32"), true),
+2 -2
View File
@@ -8,7 +8,7 @@ import (
func FinicityClientSecret() *config.Rule { func FinicityClientSecret() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Finicity Client Secret", Description: "Identified a Finicity Client Secret, which could lead to compromised financial service integrations and data breaches.",
RuleID: "finicity-client-secret", RuleID: "finicity-client-secret",
Regex: generateSemiGenericRegex([]string{"finicity"}, alphaNumeric("20"), true), Regex: generateSemiGenericRegex([]string{"finicity"}, alphaNumeric("20"), true),
@@ -25,7 +25,7 @@ func FinicityClientSecret() *config.Rule {
func FinicityAPIToken() *config.Rule { func FinicityAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Finicity API token", Description: "Detected a Finicity API token, potentially risking financial data access and unauthorized financial operations.",
RuleID: "finicity-api-token", RuleID: "finicity-api-token",
Regex: generateSemiGenericRegex([]string{"finicity"}, hex("32"), true), Regex: generateSemiGenericRegex([]string{"finicity"}, hex("32"), true),
+1 -1
View File
@@ -9,7 +9,7 @@ func FinnhubAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "finnhub-access-token", RuleID: "finnhub-access-token",
Description: "Finnhub Access Token", Description: "Found a Finnhub Access Token, risking unauthorized access to financial market data and analytics.",
Regex: generateSemiGenericRegex([]string{"finnhub"}, alphaNumeric("20"), true), Regex: generateSemiGenericRegex([]string{"finnhub"}, alphaNumeric("20"), true),
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -9,7 +9,7 @@ func FlickrAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "flickr-access-token", RuleID: "flickr-access-token",
Description: "Flickr Access Token", Description: "Discovered a Flickr Access Token, posing a risk of unauthorized photo management and potential data leakage.",
Regex: generateSemiGenericRegex([]string{"flickr"}, alphaNumeric("32"), true), Regex: generateSemiGenericRegex([]string{"flickr"}, alphaNumeric("32"), true),
Keywords: []string{ Keywords: []string{
+3 -3
View File
@@ -10,7 +10,7 @@ import (
func FlutterwavePublicKey() *config.Rule { func FlutterwavePublicKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Finicity Public Key", Description: "Detected a Finicity Public Key, potentially exposing public cryptographic operations and integrations.",
RuleID: "flutterwave-public-key", RuleID: "flutterwave-public-key",
Regex: regexp.MustCompile(`FLWPUBK_TEST-(?i)[a-h0-9]{32}-X`), Regex: regexp.MustCompile(`FLWPUBK_TEST-(?i)[a-h0-9]{32}-X`),
Keywords: []string{"FLWPUBK_TEST"}, Keywords: []string{"FLWPUBK_TEST"},
@@ -26,7 +26,7 @@ func FlutterwavePublicKey() *config.Rule {
func FlutterwaveSecretKey() *config.Rule { func FlutterwaveSecretKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Flutterwave Secret Key", Description: "Identified a Flutterwave Secret Key, risking unauthorized financial transactions and data breaches.",
RuleID: "flutterwave-secret-key", RuleID: "flutterwave-secret-key",
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{32}-X`), Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{32}-X`),
Keywords: []string{"FLWSECK_TEST"}, Keywords: []string{"FLWSECK_TEST"},
@@ -42,7 +42,7 @@ func FlutterwaveSecretKey() *config.Rule {
func FlutterwaveEncKey() *config.Rule { func FlutterwaveEncKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Flutterwave Encryption Key", Description: "Uncovered a Flutterwave Encryption Key, which may compromise payment processing and sensitive financial information.",
RuleID: "flutterwave-encryption-key", RuleID: "flutterwave-encryption-key",
Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{12}`), Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{12}`),
Keywords: []string{"FLWSECK_TEST"}, Keywords: []string{"FLWSECK_TEST"},
+1 -1
View File
@@ -10,7 +10,7 @@ import (
func FrameIO() *config.Rule { func FrameIO() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Frame.io API token", Description: "Found a Frame.io API token, potentially compromising video collaboration and project management.",
RuleID: "frameio-api-token", RuleID: "frameio-api-token",
Regex: regexp.MustCompile(`fio-u-(?i)[a-z0-9\-_=]{64}`), Regex: regexp.MustCompile(`fio-u-(?i)[a-z0-9\-_=]{64}`),
Keywords: []string{"fio-u-"}, Keywords: []string{"fio-u-"},
+1 -1
View File
@@ -9,7 +9,7 @@ func FreshbooksAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "freshbooks-access-token", RuleID: "freshbooks-access-token",
Description: "Freshbooks Access Token", Description: "Discovered a Freshbooks Access Token, posing a risk to accounting software access and sensitive financial data exposure.",
Regex: generateSemiGenericRegex([]string{"freshbooks"}, alphaNumeric("64"), true), Regex: generateSemiGenericRegex([]string{"freshbooks"}, alphaNumeric("64"), true),
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -28,7 +28,7 @@ func GCPAPIKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "gcp-api-key", RuleID: "gcp-api-key",
Description: "GCP API key", Description: "Uncovered a GCP API key, which could lead to unauthorized access to Google Cloud services and data breaches.",
Regex: generateUniqueTokenRegex(`AIza[0-9A-Za-z\\-_]{35}`, true), Regex: generateUniqueTokenRegex(`AIza[0-9A-Za-z\\-_]{35}`, true),
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -8,7 +8,7 @@ func GenericCredential() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "generic-api-key", RuleID: "generic-api-key",
Description: "Generic API Key", Description: "Detected a Generic API Key, potentially exposing access to various services and sensitive operations.",
Regex: generateSemiGenericRegex([]string{ Regex: generateSemiGenericRegex([]string{
"key", "key",
"api", "api",
+5 -5
View File
@@ -10,7 +10,7 @@ import (
func GitHubPat() *config.Rule { func GitHubPat() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "GitHub Personal Access Token", Description: "Uncovered a GitHub Personal Access Token, potentially leading to unauthorized repository access and sensitive content exposure.",
RuleID: "github-pat", RuleID: "github-pat",
Regex: regexp.MustCompile(`ghp_[0-9a-zA-Z]{36}`), Regex: regexp.MustCompile(`ghp_[0-9a-zA-Z]{36}`),
Keywords: []string{"ghp_"}, Keywords: []string{"ghp_"},
@@ -26,7 +26,7 @@ func GitHubPat() *config.Rule {
func GitHubFineGrainedPat() *config.Rule { func GitHubFineGrainedPat() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "GitHub Fine-Grained Personal Access Token", Description: "Found a GitHub Fine-Grained Personal Access Token, risking unauthorized repository access and code manipulation.",
RuleID: "github-fine-grained-pat", RuleID: "github-fine-grained-pat",
Regex: regexp.MustCompile(`github_pat_[0-9a-zA-Z_]{82}`), Regex: regexp.MustCompile(`github_pat_[0-9a-zA-Z_]{82}`),
Keywords: []string{"github_pat_"}, Keywords: []string{"github_pat_"},
@@ -42,7 +42,7 @@ func GitHubFineGrainedPat() *config.Rule {
func GitHubOauth() *config.Rule { func GitHubOauth() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "GitHub OAuth Access Token", Description: "Discovered a GitHub OAuth Access Token, posing a risk of compromised GitHub account integrations and data leaks.",
RuleID: "github-oauth", RuleID: "github-oauth",
Regex: regexp.MustCompile(`gho_[0-9a-zA-Z]{36}`), Regex: regexp.MustCompile(`gho_[0-9a-zA-Z]{36}`),
Keywords: []string{"gho_"}, Keywords: []string{"gho_"},
@@ -58,7 +58,7 @@ func GitHubOauth() *config.Rule {
func GitHubApp() *config.Rule { func GitHubApp() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "GitHub App Token", Description: "Identified a GitHub App Token, which may compromise GitHub application integrations and source code security.",
RuleID: "github-app-token", RuleID: "github-app-token",
Regex: regexp.MustCompile(`(ghu|ghs)_[0-9a-zA-Z]{36}`), Regex: regexp.MustCompile(`(ghu|ghs)_[0-9a-zA-Z]{36}`),
Keywords: []string{"ghu_", "ghs_"}, Keywords: []string{"ghu_", "ghs_"},
@@ -75,7 +75,7 @@ func GitHubApp() *config.Rule {
func GitHubRefresh() *config.Rule { func GitHubRefresh() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "GitHub Refresh Token", Description: "Detected a GitHub Refresh Token, which could allow prolonged unauthorized access to GitHub services.",
RuleID: "github-refresh-token", RuleID: "github-refresh-token",
Regex: regexp.MustCompile(`ghr_[0-9a-zA-Z]{36}`), Regex: regexp.MustCompile(`ghr_[0-9a-zA-Z]{36}`),
Keywords: []string{"ghr_"}, Keywords: []string{"ghr_"},
+3 -3
View File
@@ -10,7 +10,7 @@ import (
func GitlabPat() *config.Rule { func GitlabPat() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "GitLab Personal Access Token", Description: "Identified a GitLab Personal Access Token, risking unauthorized access to GitLab repositories and codebase exposure.",
RuleID: "gitlab-pat", RuleID: "gitlab-pat",
Regex: regexp.MustCompile(`glpat-[0-9a-zA-Z\-\_]{20}`), Regex: regexp.MustCompile(`glpat-[0-9a-zA-Z\-\_]{20}`),
Keywords: []string{"glpat-"}, Keywords: []string{"glpat-"},
@@ -26,7 +26,7 @@ func GitlabPat() *config.Rule {
func GitlabPipelineTriggerToken() *config.Rule { func GitlabPipelineTriggerToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "GitLab Pipeline Trigger Token", Description: "Found a GitLab Pipeline Trigger Token, potentially compromising continuous integration workflows and project security.",
RuleID: "gitlab-ptt", RuleID: "gitlab-ptt",
Regex: regexp.MustCompile(`glptt-[0-9a-f]{40}`), Regex: regexp.MustCompile(`glptt-[0-9a-f]{40}`),
Keywords: []string{"glptt-"}, Keywords: []string{"glptt-"},
@@ -42,7 +42,7 @@ func GitlabPipelineTriggerToken() *config.Rule {
func GitlabRunnerRegistrationToken() *config.Rule { func GitlabRunnerRegistrationToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "GitLab Runner Registration Token", Description: "Discovered a GitLab Runner Registration Token, posing a risk to CI/CD pipeline integrity and unauthorized access.",
RuleID: "gitlab-rrt", RuleID: "gitlab-rrt",
Regex: regexp.MustCompile(`GR1348941[0-9a-zA-Z\-\_]{20}`), Regex: regexp.MustCompile(`GR1348941[0-9a-zA-Z\-\_]{20}`),
Keywords: []string{"GR1348941"}, Keywords: []string{"GR1348941"},
+1 -1
View File
@@ -9,7 +9,7 @@ func GitterAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "gitter-access-token", RuleID: "gitter-access-token",
Description: "Gitter Access Token", Description: "Uncovered a Gitter Access Token, which may lead to unauthorized access to chat and communication services.",
Regex: generateSemiGenericRegex([]string{"gitter"}, Regex: generateSemiGenericRegex([]string{"gitter"},
alphaNumericExtendedShort("40"), true), alphaNumericExtendedShort("40"), true),
+1 -1
View File
@@ -9,7 +9,7 @@ func GoCardless() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "gocardless-api-token", RuleID: "gocardless-api-token",
Description: "GoCardless API token", Description: "Detected a GoCardless API token, potentially risking unauthorized direct debit payment operations and financial data exposure.",
Regex: generateSemiGenericRegex([]string{"gocardless"}, `live_(?i)[a-z0-9\-_=]{40}`, true), Regex: generateSemiGenericRegex([]string{"gocardless"}, `live_(?i)[a-z0-9\-_=]{40}`, true),
Keywords: []string{ Keywords: []string{
+3 -3
View File
@@ -8,7 +8,7 @@ import (
func GrafanaApiKey() *config.Rule { func GrafanaApiKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Grafana api key (or Grafana cloud api key)", Description: "Identified a Grafana API key, which could compromise monitoring dashboards and sensitive data analytics.",
RuleID: "grafana-api-key", RuleID: "grafana-api-key",
Regex: generateUniqueTokenRegex(`eyJrIjoi[A-Za-z0-9]{70,400}={0,2}`, true), Regex: generateUniqueTokenRegex(`eyJrIjoi[A-Za-z0-9]{70,400}={0,2}`, true),
@@ -27,7 +27,7 @@ func GrafanaApiKey() *config.Rule {
func GrafanaCloudApiToken() *config.Rule { func GrafanaCloudApiToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Grafana cloud api token", Description: "Found a Grafana cloud API token, risking unauthorized access to cloud-based monitoring services and data exposure.",
RuleID: "grafana-cloud-api-token", RuleID: "grafana-cloud-api-token",
Regex: generateUniqueTokenRegex(`glc_[A-Za-z0-9+/]{32,400}={0,2}`, true), Regex: generateUniqueTokenRegex(`glc_[A-Za-z0-9+/]{32,400}={0,2}`, true),
@@ -46,7 +46,7 @@ func GrafanaCloudApiToken() *config.Rule {
func GrafanaServiceAccountToken() *config.Rule { func GrafanaServiceAccountToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Grafana service account token", Description: "Discovered a Grafana service account token, posing a risk of compromised monitoring services and data integrity.",
RuleID: "grafana-service-account-token", RuleID: "grafana-service-account-token",
Regex: generateUniqueTokenRegex(`glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8}`, true), Regex: generateUniqueTokenRegex(`glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8}`, true),
+12 -9
View File
@@ -11,7 +11,7 @@ import (
func Hashicorp() *config.Rule { func Hashicorp() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "HashiCorp Terraform user/org API token", Description: "Uncovered a HashiCorp Terraform user/org API token, which may lead to unauthorized infrastructure management and security breaches.",
RuleID: "hashicorp-tf-api-token", RuleID: "hashicorp-tf-api-token",
Regex: regexp.MustCompile(`(?i)[a-z0-9]{14}\.atlasv1\.[a-z0-9\-_=]{60,70}`), Regex: regexp.MustCompile(`(?i)[a-z0-9]{14}\.atlasv1\.[a-z0-9\-_=]{60,70}`),
Keywords: []string{"atlasv1"}, Keywords: []string{"atlasv1"},
@@ -28,21 +28,24 @@ func HashicorpField() *config.Rule {
keywords := []string{"administrator_login_password", "password"} keywords := []string{"administrator_login_password", "password"}
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "HashiCorp Terraform password field", Description: "Identified a HashiCorp Terraform password field, risking unauthorized infrastructure configuration and security breaches.",
RuleID: "hashicorp-tf-password", RuleID: "hashicorp-tf-password",
Regex: generateSemiGenericRegex(keywords, fmt.Sprintf(`"%s"`, alphaNumericExtended("8,20")), true), Regex: generateSemiGenericRegex(keywords, fmt.Sprintf(`"%s"`, alphaNumericExtended("8,20")), true),
Keywords: keywords, Keywords: keywords,
Path: regexp.MustCompile(`\.(tf|hcl)$`),
} }
tps := []string{ tps := map[string]string{
// Example from: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/sql_server.html // Example from: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/sql_server.html
"administrator_login_password = " + `"thisIsDog11"`, "file.tf": "administrator_login_password = " + `"thisIsDog11"`,
// https://registry.terraform.io/providers/petoju/mysql/latest/docs // https://registry.terraform.io/providers/petoju/mysql/latest/docs
"password = " + `"rootpasswd"`, "file.hcl": "password = " + `"rootpasswd"`,
} }
fps := []string{ fps := map[string]string{
"administrator_login_password = var.db_password", "file.tf": "administrator_login_password = var.db_password",
`password = "${aws_db_instance.default.password}"`, "file.hcl": `password = "${aws_db_instance.default.password}"`,
"unrelated.js": "password = " + `"rootpasswd"`,
} }
return validate(r, tps, fps)
return validateWithPaths(r, tps, fps)
} }
+2 -1
View File
@@ -7,7 +7,7 @@ import (
func Heroku() *config.Rule { func Heroku() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Heroku API Key", Description: "Detected a Heroku API Key, potentially compromising cloud application deployments and operational security.",
RuleID: "heroku-api-key", RuleID: "heroku-api-key",
Regex: generateSemiGenericRegex([]string{"heroku"}, hex8_4_4_4_12(), true), Regex: generateSemiGenericRegex([]string{"heroku"}, hex8_4_4_4_12(), true),
@@ -17,6 +17,7 @@ func Heroku() *config.Rule {
// validate // validate
tps := []string{ tps := []string{
`const HEROKU_KEY = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow `const HEROKU_KEY = "12345678-ABCD-ABCD-ABCD-1234567890AB"`, // gitleaks:allow
`heroku_api_key = "832d2129-a846-4e27-99f4-7004b6ad53ef"`, // gitleaks:allow
} }
return validate(r, tps, nil) return validate(r, tps, nil)
} }
+1 -1
View File
@@ -7,7 +7,7 @@ import (
func HubSpot() *config.Rule { func HubSpot() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "HubSpot API Token", Description: "Found a HubSpot API Token, posing a risk to CRM data integrity and unauthorized marketing operations.",
RuleID: "hubspot-api-key", RuleID: "hubspot-api-key",
Regex: generateSemiGenericRegex([]string{"hubspot"}, Regex: generateSemiGenericRegex([]string{"hubspot"},
`[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}`, true), `[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}`, true),
+2 -2
View File
@@ -16,7 +16,7 @@ func HuggingFaceAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "huggingface-access-token", RuleID: "huggingface-access-token",
Description: "Hugging Face 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: regexp.MustCompile(`(?:^|[\\'"` + "`" + ` >=:])(hf_[a-zA-Z]{34})(?:$|[\\'"` + "`" + ` <])`),
Entropy: 1, Entropy: 1,
@@ -71,7 +71,7 @@ func HuggingFaceOrganizationApiToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "huggingface-organization-api-token", RuleID: "huggingface-organization-api-token",
Description: "Hugging Face 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: regexp.MustCompile(`(?:^|[\\'"` + "`" + ` >=:\(,)])(api_org_[a-zA-Z]{34})(?:$|[\\'"` + "`" + ` <\),])`),
Entropy: 2, Entropy: 2,
+1 -1
View File
@@ -9,7 +9,7 @@ func InfracostAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
// Human readable description of the rule // Human readable description of the rule
Description: "Infracost API Token", Description: "Detected an Infracost API Token, risking unauthorized access to cloud cost estimation tools and financial data.",
// Unique ID for the rule // Unique ID for the rule
RuleID: "infracost-api-token", RuleID: "infracost-api-token",
+1 -1
View File
@@ -8,7 +8,7 @@ import (
func Intercom() *config.Rule { func Intercom() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Intercom API Token", Description: "Identified an Intercom API Token, which could compromise customer communication channels and data privacy.",
RuleID: "intercom-api-key", RuleID: "intercom-api-key",
Regex: generateSemiGenericRegex([]string{"intercom"}, alphaNumericExtended("60"), true), Regex: generateSemiGenericRegex([]string{"intercom"}, alphaNumericExtended("60"), true),
+29
View File
@@ -0,0 +1,29 @@
package rules
import (
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
)
func Intra42ClientSecret() *config.Rule {
// define rule
r := config.Rule{
Description: "Found a Intra42 client secret, which could lead to unauthorized access to the 42School API and sensitive data.",
RuleID: "intra42-client-secret",
Regex: generateUniqueTokenRegex(`s-s4t2(?:ud|af)-[abcdef0123456789]{64}`, true),
Keywords: []string{
"intra",
"s-s4t2ud-",
"s-s4t2af-",
},
}
// validate
tps := []string{
"clientSecret := \"s-s4t2ud-" + secrets.NewSecret(hex("64")) + "\"",
"clientSecret := \"s-s4t2af-" + secrets.NewSecret(hex("64")) + "\"",
"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", // gitleaks:allow
"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", // gitleaks:allow
}
return validate(r, tps, nil)
}
+2 -2
View File
@@ -13,7 +13,7 @@ func JFrogAPIKey() *config.Rule {
// Define Rule // Define Rule
r := config.Rule{ r := config.Rule{
// Human readable description of the rule // Human readable description of the rule
Description: "JFrog API Key", Description: "Found a JFrog API Key, posing a risk of unauthorized access to software artifact repositories and build pipelines.",
// Unique ID for the rule // Unique ID for the rule
RuleID: "jfrog-api-key", RuleID: "jfrog-api-key",
@@ -39,7 +39,7 @@ func JFrogIdentityToken() *config.Rule {
// Define Rule // Define Rule
r := config.Rule{ r := config.Rule{
// Human readable description of the rule // Human readable description of the rule
Description: "JFrog Identity Token", Description: "Discovered a JFrog Identity Token, potentially compromising access to JFrog services and sensitive software artifacts.",
// Unique ID for the rule // Unique ID for the rule
RuleID: "jfrog-identity-token", RuleID: "jfrog-identity-token",
+2 -2
View File
@@ -11,7 +11,7 @@ import (
func JWT() *config.Rule { func JWT() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "JSON Web Token", Description: "Uncovered a JSON Web Token, which may lead to unauthorized access to web applications and sensitive user data.",
RuleID: "jwt", RuleID: "jwt",
Regex: generateUniqueTokenRegex(`ey[a-zA-Z0-9]{17,}\.ey[a-zA-Z0-9\/\\_-]{17,}\.(?:[a-zA-Z0-9\/\\_-]{10,}={0,2})?`, false), Regex: generateUniqueTokenRegex(`ey[a-zA-Z0-9]{17,}\.ey[a-zA-Z0-9\/\\_-]{17,}\.(?:[a-zA-Z0-9\/\\_-]{10,}={0,2})?`, false),
Keywords: []string{"ey"}, Keywords: []string{"ey"},
@@ -68,7 +68,7 @@ func JWTBase64() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "jwt-base64", RuleID: "jwt-base64",
Description: "Base64-encoded JSON Web Token", Description: "Detected a Base64-encoded JSON Web Token, posing a risk of exposing encoded authentication and data exchange information.",
Regex: regexp.MustCompile( Regex: regexp.MustCompile(
`\bZXlK(?:(?P<alg>aGJHY2lPaU)|(?P<apu>aGNIVWlPaU)|(?P<apv>aGNIWWlPaU)|(?P<aud>aGRXUWlPaU)|(?P<b64>aU5qUWlP)|(?P<crit>amNtbDBJanBi)|(?P<cty>amRIa2lPaU)|(?P<epk>bGNHc2lPbn)|(?P<enc>bGJtTWlPaU)|(?P<jku>cWEzVWlPaU)|(?P<jwk>cWQyc2lPb)|(?P<iss>cGMzTWlPaU)|(?P<iv>cGRpSTZJ)|(?P<kid>cmFXUWlP)|(?P<key_ops>clpYbGZiM0J6SWpwY)|(?P<kty>cmRIa2lPaUp)|(?P<nonce>dWIyNWpaU0k2)|(?P<p2c>d01tTWlP)|(?P<p2s>d01uTWlPaU)|(?P<ppt>d2NIUWlPaU)|(?P<sub>emRXSWlPaU)|(?P<svt>emRuUWlP)|(?P<tag>MFlXY2lPaU)|(?P<typ>MGVYQWlPaUp)|(?P<url>MWNtd2l)|(?P<use>MWMyVWlPaUp)|(?P<ver>MlpYSWlPaU)|(?P<version>MlpYSnphVzl1SWpv)|(?P<x>NElqb2)|(?P<x5c>NE5XTWlP)|(?P<x5t>NE5YUWlPaU)|(?P<x5ts256>NE5YUWpVekkxTmlJNkl)|(?P<x5u>NE5YVWlPaU)|(?P<zip>NmFYQWlPaU))[a-zA-Z0-9\/\\_+\-\r\n]{40,}={0,2}`), `\bZXlK(?:(?P<alg>aGJHY2lPaU)|(?P<apu>aGNIVWlPaU)|(?P<apv>aGNIWWlPaU)|(?P<aud>aGRXUWlPaU)|(?P<b64>aU5qUWlP)|(?P<crit>amNtbDBJanBi)|(?P<cty>amRIa2lPaU)|(?P<epk>bGNHc2lPbn)|(?P<enc>bGJtTWlPaU)|(?P<jku>cWEzVWlPaU)|(?P<jwk>cWQyc2lPb)|(?P<iss>cGMzTWlPaU)|(?P<iv>cGRpSTZJ)|(?P<kid>cmFXUWlP)|(?P<key_ops>clpYbGZiM0J6SWpwY)|(?P<kty>cmRIa2lPaUp)|(?P<nonce>dWIyNWpaU0k2)|(?P<p2c>d01tTWlP)|(?P<p2s>d01uTWlPaU)|(?P<ppt>d2NIUWlPaU)|(?P<sub>emRXSWlPaU)|(?P<svt>emRuUWlP)|(?P<tag>MFlXY2lPaU)|(?P<typ>MGVYQWlPaUp)|(?P<url>MWNtd2l)|(?P<use>MWMyVWlPaUp)|(?P<ver>MlpYSWlPaU)|(?P<version>MlpYSnphVzl1SWpv)|(?P<x>NElqb2)|(?P<x5c>NE5XTWlP)|(?P<x5t>NE5YUWlPaU)|(?P<x5ts256>NE5YUWpVekkxTmlJNkl)|(?P<x5u>NE5YVWlPaU)|(?P<zip>NmFYQWlPaU))[a-zA-Z0-9\/\\_+\-\r\n]{40,}={0,2}`),
Keywords: []string{"zxlk"}, Keywords: []string{"zxlk"},
+1 -1
View File
@@ -9,7 +9,7 @@ func KrakenAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "kraken-access-token", RuleID: "kraken-access-token",
Description: "Kraken Access Token", Description: "Identified a Kraken Access Token, potentially compromising cryptocurrency trading accounts and financial security.",
Regex: generateSemiGenericRegex([]string{"kraken"}, Regex: generateSemiGenericRegex([]string{"kraken"},
alphaNumericExtendedLong("80,90"), true), alphaNumericExtendedLong("80,90"), true),
+2 -2
View File
@@ -9,7 +9,7 @@ func KucoinAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "kucoin-access-token", RuleID: "kucoin-access-token",
Description: "Kucoin Access Token", Description: "Found a Kucoin Access Token, risking unauthorized access to cryptocurrency exchange services and transactions.",
Regex: generateSemiGenericRegex([]string{"kucoin"}, hex("24"), true), Regex: generateSemiGenericRegex([]string{"kucoin"}, hex("24"), true),
Keywords: []string{ Keywords: []string{
@@ -28,7 +28,7 @@ func KucoinSecretKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "kucoin-secret-key", RuleID: "kucoin-secret-key",
Description: "Kucoin Secret Key", Description: "Discovered a Kucoin Secret Key, which could lead to compromised cryptocurrency operations and financial data breaches.",
Regex: generateSemiGenericRegex([]string{"kucoin"}, hex8_4_4_4_12(), true), Regex: generateSemiGenericRegex([]string{"kucoin"}, hex8_4_4_4_12(), true),
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -9,7 +9,7 @@ func LaunchDarklyAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "launchdarkly-access-token", RuleID: "launchdarkly-access-token",
Description: "Launchdarkly Access Token", Description: "Uncovered a Launchdarkly Access Token, potentially compromising feature flag management and application functionality.",
Regex: generateSemiGenericRegex([]string{"launchdarkly"}, alphaNumericExtended("40"), true), Regex: generateSemiGenericRegex([]string{"launchdarkly"}, alphaNumericExtended("40"), true),
Keywords: []string{ Keywords: []string{
+2 -2
View File
@@ -10,7 +10,7 @@ import (
func LinearAPIToken() *config.Rule { func LinearAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Linear API Token", Description: "Detected a Linear API Token, posing a risk to project management tools and sensitive task data.",
RuleID: "linear-api-key", RuleID: "linear-api-key",
Regex: regexp.MustCompile(`lin_api_(?i)[a-z0-9]{40}`), Regex: regexp.MustCompile(`lin_api_(?i)[a-z0-9]{40}`),
Keywords: []string{"lin_api_"}, Keywords: []string{"lin_api_"},
@@ -26,7 +26,7 @@ func LinearAPIToken() *config.Rule {
func LinearClientSecret() *config.Rule { func LinearClientSecret() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Linear Client Secret", Description: "Identified a Linear Client Secret, which may compromise secure integrations and sensitive project management data.",
RuleID: "linear-client-secret", RuleID: "linear-client-secret",
Regex: generateSemiGenericRegex([]string{"linear"}, hex("32"), true), Regex: generateSemiGenericRegex([]string{"linear"}, hex("32"), true),
Keywords: []string{"linear"}, Keywords: []string{"linear"},
+2 -2
View File
@@ -9,7 +9,7 @@ func LinkedinClientSecret() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "linkedin-client-secret", RuleID: "linkedin-client-secret",
Description: "LinkedIn Client secret", Description: "Discovered a LinkedIn Client secret, potentially compromising LinkedIn application integrations and user data.",
Regex: generateSemiGenericRegex([]string{ Regex: generateSemiGenericRegex([]string{
"linkedin", "linkedin",
"linked-in", "linked-in",
@@ -32,7 +32,7 @@ func LinkedinClientID() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "linkedin-client-id", RuleID: "linkedin-client-id",
Description: "LinkedIn Client ID", Description: "Found a LinkedIn Client ID, risking unauthorized access to LinkedIn integrations and professional data exposure.",
Regex: generateSemiGenericRegex([]string{ Regex: generateSemiGenericRegex([]string{
"linkedin", "linkedin",
"linked-in", "linked-in",
+2 -2
View File
@@ -8,7 +8,7 @@ import (
func LobPubAPIToken() *config.Rule { func LobPubAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Lob Publishable API Key", Description: "Detected a Lob Publishable API Key, posing a risk of exposing mail and print service integrations.",
RuleID: "lob-pub-api-key", RuleID: "lob-pub-api-key",
Regex: generateSemiGenericRegex([]string{"lob"}, `(test|live)_pub_[a-f0-9]{31}`, true), Regex: generateSemiGenericRegex([]string{"lob"}, `(test|live)_pub_[a-f0-9]{31}`, true),
@@ -29,7 +29,7 @@ func LobPubAPIToken() *config.Rule {
func LobAPIToken() *config.Rule { func LobAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Lob API Key", Description: "Uncovered a Lob API Key, which could lead to unauthorized access to mailing and address verification services.",
RuleID: "lob-api-key", RuleID: "lob-api-key",
Regex: generateSemiGenericRegex([]string{"lob"}, `(live|test)_[a-f0-9]{35}`, true), Regex: generateSemiGenericRegex([]string{"lob"}, `(live|test)_[a-f0-9]{35}`, true),
Keywords: []string{ Keywords: []string{
+9 -3
View File
@@ -9,8 +9,8 @@ func MailChimp() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "mailchimp-api-key", RuleID: "mailchimp-api-key",
Description: "Mailchimp API key", Description: "Identified a Mailchimp API key, potentially compromising email marketing campaigns and subscriber data.",
Regex: generateSemiGenericRegex([]string{"mailchimp"}, `[a-f0-9]{32}-us20`, true), Regex: generateSemiGenericRegex([]string{"MailchimpSDK.initialize", "mailchimp"}, hex("32")+`-us\d\d`, true),
Keywords: []string{ Keywords: []string{
"mailchimp", "mailchimp",
@@ -20,6 +20,12 @@ func MailChimp() *config.Rule {
// validate // validate
tps := []string{ tps := []string{
generateSampleSecret("mailchimp", secrets.NewSecret(hex("32"))+"-us20"), generateSampleSecret("mailchimp", secrets.NewSecret(hex("32"))+"-us20"),
`mailchimp_api_key: cefa780880ba5f5696192a34f6292c35-us18`, // gitleaks:allow
`MAILCHIMPE_KEY = "b5b9f8e50c640da28993e8b6a48e3e53-us18"`, // gitleaks:allow
} }
return validate(r, tps, nil) fps := []string{
// False Negative
`MailchimpSDK.initialize(token: 3012a5754bbd716926f99c028f7ea428-us18)`, // gitleaks:allow
}
return validate(r, tps, fps)
} }
+3 -3
View File
@@ -9,7 +9,7 @@ func MailGunPrivateAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "mailgun-private-api-token", RuleID: "mailgun-private-api-token",
Description: "Mailgun private API token", Description: "Found a Mailgun private API token, risking unauthorized email service operations and data breaches.",
Regex: generateSemiGenericRegex([]string{"mailgun"}, `key-[a-f0-9]{32}`, true), Regex: generateSemiGenericRegex([]string{"mailgun"}, `key-[a-f0-9]{32}`, true),
Keywords: []string{ Keywords: []string{
@@ -28,7 +28,7 @@ func MailGunPubAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "mailgun-pub-key", RuleID: "mailgun-pub-key",
Description: "Mailgun public validation key", Description: "Discovered a Mailgun public validation key, which could expose email verification processes and associated data.",
Regex: generateSemiGenericRegex([]string{"mailgun"}, `pubkey-[a-f0-9]{32}`, true), Regex: generateSemiGenericRegex([]string{"mailgun"}, `pubkey-[a-f0-9]{32}`, true),
Keywords: []string{ Keywords: []string{
@@ -47,7 +47,7 @@ func MailGunSigningKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "mailgun-signing-key", RuleID: "mailgun-signing-key",
Description: "Mailgun webhook signing key", Description: "Uncovered a Mailgun webhook signing key, potentially compromising email automation and data integrity.",
Regex: generateSemiGenericRegex([]string{"mailgun"}, `[a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8}`, true), Regex: generateSemiGenericRegex([]string{"mailgun"}, `[a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8}`, true),
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -8,7 +8,7 @@ import (
func MapBox() *config.Rule { func MapBox() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "MapBox API token", Description: "Detected a MapBox API token, posing a risk to geospatial services and sensitive location data exposure.",
RuleID: "mapbox-api-token", RuleID: "mapbox-api-token",
Regex: generateSemiGenericRegex([]string{"mapbox"}, `pk\.[a-z0-9]{60}\.[a-z0-9]{22}`, true), Regex: generateSemiGenericRegex([]string{"mapbox"}, `pk\.[a-z0-9]{60}\.[a-z0-9]{22}`, true),
+1 -1
View File
@@ -9,7 +9,7 @@ func MattermostAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "mattermost-access-token", RuleID: "mattermost-access-token",
Description: "Mattermost Access Token", Description: "Identified a Mattermost Access Token, which may compromise team communication channels and data privacy.",
Regex: generateSemiGenericRegex([]string{"mattermost"}, alphaNumeric("26"), true), Regex: generateSemiGenericRegex([]string{"mattermost"}, alphaNumeric("26"), true),
Keywords: []string{ Keywords: []string{
+2 -2
View File
@@ -8,7 +8,7 @@ import (
func MessageBirdAPIToken() *config.Rule { func MessageBirdAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "MessageBird API token", Description: "Found a MessageBird API token, risking unauthorized access to communication platforms and message data.",
RuleID: "messagebird-api-token", RuleID: "messagebird-api-token",
Regex: generateSemiGenericRegex([]string{ Regex: generateSemiGenericRegex([]string{
"messagebird", "messagebird",
@@ -35,7 +35,7 @@ func MessageBirdAPIToken() *config.Rule {
func MessageBirdClientID() *config.Rule { func MessageBirdClientID() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "MessageBird client ID", Description: "Discovered a MessageBird client ID, potentially compromising API integrations and sensitive communication data.",
RuleID: "messagebird-client-id", RuleID: "messagebird-client-id",
Regex: generateSemiGenericRegex([]string{ Regex: generateSemiGenericRegex([]string{
"messagebird", "messagebird",
+1 -1
View File
@@ -9,7 +9,7 @@ func NetlifyAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "netlify-access-token", RuleID: "netlify-access-token",
Description: "Netlify Access Token", Description: "Detected a Netlify Access Token, potentially compromising web hosting services and site management.",
Regex: generateSemiGenericRegex([]string{"netlify"}, Regex: generateSemiGenericRegex([]string{"netlify"},
alphaNumericExtended("40,46"), true), alphaNumericExtended("40,46"), true),
+26 -3
View File
@@ -9,7 +9,7 @@ func NewRelicUserID() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "new-relic-user-api-key", RuleID: "new-relic-user-api-key",
Description: "New Relic user API Key", Description: "Discovered a New Relic user API Key, which could lead to compromised application insights and performance monitoring.",
Regex: generateSemiGenericRegex([]string{ Regex: generateSemiGenericRegex([]string{
"new-relic", "new-relic",
"newrelic", "newrelic",
@@ -32,7 +32,7 @@ func NewRelicUserKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "new-relic-user-api-id", RuleID: "new-relic-user-api-id",
Description: "New Relic user API ID", Description: "Found a New Relic user API ID, posing a risk to application monitoring services and data integrity.",
Regex: generateSemiGenericRegex([]string{ Regex: generateSemiGenericRegex([]string{
"new-relic", "new-relic",
"newrelic", "newrelic",
@@ -57,7 +57,7 @@ func NewRelicBrowserAPIKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "new-relic-browser-api-token", RuleID: "new-relic-browser-api-token",
Description: "New Relic ingest browser API token", Description: "Identified a New Relic ingest browser API token, risking unauthorized access to application performance data and analytics.",
Regex: generateSemiGenericRegex([]string{ Regex: generateSemiGenericRegex([]string{
"new-relic", "new-relic",
"newrelic", "newrelic",
@@ -75,3 +75,26 @@ func NewRelicBrowserAPIKey() *config.Rule {
} }
return validate(r, tps, nil) return validate(r, tps, nil)
} }
func NewRelicInsertKey() *config.Rule {
// define rule
r := config.Rule{
RuleID: "new-relic-insert-key",
Description: "Discovered a New Relic insight insert key, compromising data injection into the platform.",
Regex: generateSemiGenericRegex([]string{
"new-relic",
"newrelic",
"new_relic",
}, `NRII-[a-z0-9-]{32}`, true),
Keywords: []string{
"NRII-",
},
}
// validate
tps := []string{
generateSampleSecret("new-relic", "NRII-"+secrets.NewSecret(hex("32"))),
}
return validate(r, tps, nil)
}
+1 -1
View File
@@ -9,7 +9,7 @@ func NPM() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "npm-access-token", RuleID: "npm-access-token",
Description: "npm access token", Description: "Uncovered an npm access token, potentially compromising package management and code repository access.",
Regex: generateUniqueTokenRegex(`npm_[a-z0-9]{36}`, true), Regex: generateUniqueTokenRegex(`npm_[a-z0-9]{36}`, true),
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -9,7 +9,7 @@ func NytimesAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "nytimes-access-token", RuleID: "nytimes-access-token",
Description: "Nytimes Access Token", Description: "Detected a Nytimes Access Token, risking unauthorized access to New York Times APIs and content services.",
Regex: generateSemiGenericRegex([]string{ Regex: generateSemiGenericRegex([]string{
"nytimes", "new-york-times,", "newyorktimes"}, "nytimes", "new-york-times,", "newyorktimes"},
alphaNumericExtended("32"), true), alphaNumericExtended("32"), true),
+1 -1
View File
@@ -9,7 +9,7 @@ func OktaAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "okta-access-token", RuleID: "okta-access-token",
Description: "Okta Access Token", Description: "Identified an Okta Access Token, which may compromise identity management services and user authentication data.",
Regex: generateSemiGenericRegex([]string{"okta"}, Regex: generateSemiGenericRegex([]string{"okta"},
alphaNumericExtended("42"), true), alphaNumericExtended("42"), true),
+1 -1
View File
@@ -9,7 +9,7 @@ func OpenAI() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "openai-api-key", RuleID: "openai-api-key",
Description: "OpenAI API Key", Description: "Found an OpenAI API Key, posing a risk of unauthorized access to AI services and data manipulation.",
Regex: generateUniqueTokenRegex(`sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20}`, true), Regex: generateUniqueTokenRegex(`sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20}`, true),
Keywords: []string{ Keywords: []string{
+3 -3
View File
@@ -11,7 +11,7 @@ func PlaidAccessID() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "plaid-client-id", RuleID: "plaid-client-id",
Description: "Plaid Client ID", Description: "Uncovered a Plaid Client ID, which could lead to unauthorized financial service integrations and data breaches.",
Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("24"), true), Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("24"), true),
Entropy: 3.5, Entropy: 3.5,
@@ -31,7 +31,7 @@ func PlaidSecretKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "plaid-secret-key", RuleID: "plaid-secret-key",
Description: "Plaid Secret key", Description: "Detected a Plaid Secret key, risking unauthorized access to financial accounts and sensitive transaction data.",
Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("30"), true), Regex: generateSemiGenericRegex([]string{"plaid"}, alphaNumeric("30"), true),
Entropy: 3.5, Entropy: 3.5,
@@ -51,7 +51,7 @@ func PlaidAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "plaid-api-token", RuleID: "plaid-api-token",
Description: "Plaid API Token", Description: "Discovered a Plaid API Token, potentially compromising financial data aggregation and banking services.",
Regex: generateSemiGenericRegex([]string{"plaid"}, Regex: generateSemiGenericRegex([]string{"plaid"},
fmt.Sprintf("access-(?:sandbox|development|production)-%s", hex8_4_4_4_12()), true), fmt.Sprintf("access-(?:sandbox|development|production)-%s", hex8_4_4_4_12()), true),
+3 -3
View File
@@ -9,7 +9,7 @@ func PlanetScalePassword() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "planetscale-password", RuleID: "planetscale-password",
Description: "PlanetScale password", Description: "Discovered a PlanetScale password, which could lead to unauthorized database operations and data breaches.",
Regex: generateUniqueTokenRegex(`pscale_pw_(?i)[a-z0-9=\-_\.]{32,64}`, true), Regex: generateUniqueTokenRegex(`pscale_pw_(?i)[a-z0-9=\-_\.]{32,64}`, true),
Keywords: []string{ Keywords: []string{
@@ -30,7 +30,7 @@ func PlanetScaleAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "planetscale-api-token", RuleID: "planetscale-api-token",
Description: "PlanetScale API token", Description: "Identified a PlanetScale API token, potentially compromising database management and operations.",
Regex: generateUniqueTokenRegex(`pscale_tkn_(?i)[a-z0-9=\-_\.]{32,64}`, true), Regex: generateUniqueTokenRegex(`pscale_tkn_(?i)[a-z0-9=\-_\.]{32,64}`, true),
Keywords: []string{ Keywords: []string{
@@ -51,7 +51,7 @@ func PlanetScaleOAuthToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "planetscale-oauth-token", RuleID: "planetscale-oauth-token",
Description: "PlanetScale OAuth token", Description: "Found a PlanetScale OAuth token, posing a risk to database access control and sensitive data integrity.",
Regex: generateUniqueTokenRegex(`pscale_oauth_(?i)[a-z0-9=\-_\.]{32,64}`, true), Regex: generateUniqueTokenRegex(`pscale_oauth_(?i)[a-z0-9=\-_\.]{32,64}`, true),
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -9,7 +9,7 @@ func PostManAPI() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "postman-api-token", RuleID: "postman-api-token",
Description: "Postman API token", Description: "Uncovered a Postman API token, potentially compromising API testing and development workflows.",
Regex: generateUniqueTokenRegex(`PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34}`, true), Regex: generateUniqueTokenRegex(`PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34}`, true),
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -9,7 +9,7 @@ func Prefect() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "prefect-api-token", RuleID: "prefect-api-token",
Description: "Prefect API token", Description: "Detected a Prefect API token, risking unauthorized access to workflow management and automation services.",
Regex: generateUniqueTokenRegex(`pnu_[a-z0-9]{36}`, true), Regex: generateUniqueTokenRegex(`pnu_[a-z0-9]{36}`, true),
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -9,7 +9,7 @@ import (
func PrivateKey() *config.Rule { func PrivateKey() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Private Key", Description: "Identified a Private Key, which may compromise cryptographic security and sensitive data encryption.",
RuleID: "private-key", RuleID: "private-key",
Regex: regexp.MustCompile(`(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY( BLOCK)?-----[\s\S-]*KEY( BLOCK)?----`), Regex: regexp.MustCompile(`(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY( BLOCK)?-----[\s\S-]*KEY( BLOCK)?----`),
Keywords: []string{"-----BEGIN"}, Keywords: []string{"-----BEGIN"},
+1 -1
View File
@@ -9,7 +9,7 @@ func PulumiAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "pulumi-api-token", RuleID: "pulumi-api-token",
Description: "Pulumi API token", Description: "Found a Pulumi API token, posing a risk to infrastructure as code services and cloud resource management.",
Regex: generateUniqueTokenRegex(`pul-[a-f0-9]{40}`, true), Regex: generateUniqueTokenRegex(`pul-[a-f0-9]{40}`, true),
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -10,7 +10,7 @@ import (
func PyPiUploadToken() *config.Rule { func PyPiUploadToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "PyPI upload token", Description: "Discovered a PyPI upload token, potentially compromising Python package distribution and repository integrity.",
RuleID: "pypi-upload-token", RuleID: "pypi-upload-token",
Regex: regexp.MustCompile( Regex: regexp.MustCompile(
`pypi-AgEIcHlwaS5vcmc[A-Za-z0-9\-_]{50,1000}`), `pypi-AgEIcHlwaS5vcmc[A-Za-z0-9\-_]{50,1000}`),
+1 -1
View File
@@ -9,7 +9,7 @@ func RapidAPIAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "rapidapi-access-token", RuleID: "rapidapi-access-token",
Description: "RapidAPI Access Token", Description: "Uncovered a RapidAPI Access Token, which could lead to unauthorized access to various APIs and data services.",
Regex: generateSemiGenericRegex([]string{"rapidapi"}, Regex: generateSemiGenericRegex([]string{"rapidapi"},
alphaNumericExtendedShort("50"), true), alphaNumericExtendedShort("50"), true),
+1 -1
View File
@@ -9,7 +9,7 @@ func ReadMe() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "readme-api-token", RuleID: "readme-api-token",
Description: "Readme API token", Description: "Detected a Readme API token, risking unauthorized documentation management and content exposure.",
Regex: generateUniqueTokenRegex(`rdme_[a-z0-9]{70}`, true), Regex: generateUniqueTokenRegex(`rdme_[a-z0-9]{70}`, true),
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -9,7 +9,7 @@ func RubyGemsAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "rubygems-api-token", RuleID: "rubygems-api-token",
Description: "Rubygem API token", Description: "Identified a Rubygem API token, potentially compromising Ruby library distribution and package management.",
Regex: generateUniqueTokenRegex(`rubygems_[a-f0-9]{48}`, true), Regex: generateUniqueTokenRegex(`rubygems_[a-f0-9]{48}`, true),
Keywords: []string{ Keywords: []string{
+28
View File
@@ -97,6 +97,34 @@ func validate(r config.Rule, truePositives []string, falsePositives []string) *c
return &r return &r
} }
func validateWithPaths(r config.Rule, truePositives map[string]string, falsePositives map[string]string) *config.Rule {
var keywords []string
for _, k := range r.Keywords {
keywords = append(keywords, strings.ToLower(k))
}
r.Keywords = keywords
rules := make(map[string]config.Rule)
rules[r.RuleID] = r
d := detect.NewDetector(config.Config{
Rules: rules,
Keywords: keywords,
})
for path, tp := range truePositives {
f := detect.Fragment{Raw: tp, FilePath: path}
if len(d.Detect(f)) != 1 {
log.Fatal().Msgf("Failed to validate. For rule ID [%s], true positive [%s] in %s was not detected by regexp [%s] path [%s]", r.RuleID, tp, path, r.Regex, r.Path)
}
}
for path, fp := range falsePositives {
f := detect.Fragment{Raw: fp, FilePath: path}
if len(d.Detect(f)) != 0 {
log.Fatal().Msgf("Failed to validate. For rule ID [%s], false positive [%s] in %s was detected by regexp [%s] path [%s]", r.RuleID, fp, path, r.Regex, r.Path)
}
}
return &r
}
func numeric(size string) string { func numeric(size string) string {
return fmt.Sprintf(`[0-9]{%s}`, size) return fmt.Sprintf(`[0-9]{%s}`, size)
} }
+3 -4
View File
@@ -1,8 +1,6 @@
package rules package rules
import ( import (
"regexp"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets" "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/config"
) )
@@ -10,15 +8,16 @@ import (
func ScalingoAPIToken() *config.Rule { func ScalingoAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Scalingo API token", Description: "Found a Scalingo API token, posing a risk to cloud platform services and application deployment security.",
RuleID: "scalingo-api-token", RuleID: "scalingo-api-token",
Regex: regexp.MustCompile(`\btk-us-[a-zA-Z0-9-_]{48}\b`), Regex: generateUniqueTokenRegex(`tk-us-[a-zA-Z0-9-_]{48}`, false),
Keywords: []string{"tk-us-"}, Keywords: []string{"tk-us-"},
} }
// validate // validate
tps := []string{ tps := []string{
generateSampleSecret("scalingo", "tk-us-"+secrets.NewSecret(alphaNumericExtendedShort("48"))), generateSampleSecret("scalingo", "tk-us-"+secrets.NewSecret(alphaNumericExtendedShort("48"))),
`scalingo_api_token = "tk-us-loys7ib9yrxcys_ta2sq85mjar6lgcsspkd9x61s7h5epf_-"`, // gitleaks:allow
} }
return validate(r, tps, nil) return validate(r, tps, nil)
} }
+2 -2
View File
@@ -9,7 +9,7 @@ func SendbirdAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "sendbird-access-token", RuleID: "sendbird-access-token",
Description: "Sendbird Access Token", Description: "Uncovered a Sendbird Access Token, potentially risking unauthorized access to communication services and user data.",
Regex: generateSemiGenericRegex([]string{"sendbird"}, hex("40"), true), Regex: generateSemiGenericRegex([]string{"sendbird"}, hex("40"), true),
Keywords: []string{ Keywords: []string{
@@ -28,7 +28,7 @@ func SendbirdAccessID() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "sendbird-access-id", RuleID: "sendbird-access-id",
Description: "Sendbird Access ID", Description: "Discovered a Sendbird Access ID, which could compromise chat and messaging platform integrations.",
Regex: generateSemiGenericRegex([]string{"sendbird"}, hex8_4_4_4_12(), true), Regex: generateSemiGenericRegex([]string{"sendbird"}, hex8_4_4_4_12(), true),
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -9,7 +9,7 @@ func SendGridAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "sendgrid-api-token", RuleID: "sendgrid-api-token",
Description: "SendGrid API token", Description: "Detected a SendGrid API token, posing a risk of unauthorized email service operations and data exposure.",
Regex: generateUniqueTokenRegex(`SG\.(?i)[a-z0-9=_\-\.]{66}`, true), Regex: generateUniqueTokenRegex(`SG\.(?i)[a-z0-9=_\-\.]{66}`, true),
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -9,7 +9,7 @@ func SendInBlueAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "sendinblue-api-token", RuleID: "sendinblue-api-token",
Description: "Sendinblue API token", Description: "Identified a Sendinblue API token, which may compromise email marketing services and subscriber data privacy.",
Regex: generateUniqueTokenRegex(`xkeysib-[a-f0-9]{64}\-(?i)[a-z0-9]{16}`, true), Regex: generateUniqueTokenRegex(`xkeysib-[a-f0-9]{64}\-(?i)[a-z0-9]{16}`, true),
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -9,7 +9,7 @@ func SentryAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "sentry-access-token", RuleID: "sentry-access-token",
Description: "Sentry Access Token", Description: "Found a Sentry Access Token, risking unauthorized access to error tracking services and sensitive application data.",
Regex: generateSemiGenericRegex([]string{"sentry"}, hex("64"), true), Regex: generateSemiGenericRegex([]string{"sentry"}, hex("64"), true),
Keywords: []string{ Keywords: []string{
+1 -1
View File
@@ -9,7 +9,7 @@ func ShippoAPIToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
RuleID: "shippo-api-token", RuleID: "shippo-api-token",
Description: "Shippo API token", Description: "Discovered a Shippo API token, potentially compromising shipping services and customer order data.",
Regex: generateUniqueTokenRegex(`shippo_(live|test)_[a-f0-9]{40}`, true), Regex: generateUniqueTokenRegex(`shippo_(live|test)_[a-f0-9]{40}`, true),
Keywords: []string{ Keywords: []string{
+4 -4
View File
@@ -10,7 +10,7 @@ import (
func ShopifySharedSecret() *config.Rule { func ShopifySharedSecret() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Shopify shared secret", Description: "Found a Shopify shared secret, posing a risk to application authentication and e-commerce platform security.",
RuleID: "shopify-shared-secret", RuleID: "shopify-shared-secret",
Regex: regexp.MustCompile(`shpss_[a-fA-F0-9]{32}`), Regex: regexp.MustCompile(`shpss_[a-fA-F0-9]{32}`),
Keywords: []string{"shpss_"}, Keywords: []string{"shpss_"},
@@ -24,7 +24,7 @@ func ShopifySharedSecret() *config.Rule {
func ShopifyAccessToken() *config.Rule { func ShopifyAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Shopify access token", Description: "Uncovered a Shopify access token, which could lead to unauthorized e-commerce platform access and data breaches.",
RuleID: "shopify-access-token", RuleID: "shopify-access-token",
Regex: regexp.MustCompile(`shpat_[a-fA-F0-9]{32}`), Regex: regexp.MustCompile(`shpat_[a-fA-F0-9]{32}`),
Keywords: []string{"shpat_"}, Keywords: []string{"shpat_"},
@@ -38,7 +38,7 @@ func ShopifyAccessToken() *config.Rule {
func ShopifyCustomAccessToken() *config.Rule { func ShopifyCustomAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Shopify custom access token", Description: "Detected a Shopify custom access token, potentially compromising custom app integrations and e-commerce data security.",
RuleID: "shopify-custom-access-token", RuleID: "shopify-custom-access-token",
Regex: regexp.MustCompile(`shpca_[a-fA-F0-9]{32}`), Regex: regexp.MustCompile(`shpca_[a-fA-F0-9]{32}`),
Keywords: []string{"shpca_"}, Keywords: []string{"shpca_"},
@@ -52,7 +52,7 @@ func ShopifyCustomAccessToken() *config.Rule {
func ShopifyPrivateAppAccessToken() *config.Rule { func ShopifyPrivateAppAccessToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Shopify private app access token", Description: "Identified a Shopify private app access token, risking unauthorized access to private app data and store operations.",
RuleID: "shopify-private-app-access-token", RuleID: "shopify-private-app-access-token",
Regex: regexp.MustCompile(`shppa_[a-fA-F0-9]{32}`), Regex: regexp.MustCompile(`shppa_[a-fA-F0-9]{32}`),
Keywords: []string{"shppa_"}, Keywords: []string{"shppa_"},
+2 -2
View File
@@ -9,7 +9,7 @@ import (
func SidekiqSecret() *config.Rule { func SidekiqSecret() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Sidekiq Secret", Description: "Discovered a Sidekiq Secret, which could lead to compromised background job processing and application data breaches.",
RuleID: "sidekiq-secret", RuleID: "sidekiq-secret",
Regex: generateSemiGenericRegex([]string{"BUNDLE_ENTERPRISE__CONTRIBSYS__COM", "BUNDLE_GEMS__CONTRIBSYS__COM"}, Regex: generateSemiGenericRegex([]string{"BUNDLE_ENTERPRISE__CONTRIBSYS__COM", "BUNDLE_GEMS__CONTRIBSYS__COM"},
@@ -34,7 +34,7 @@ func SidekiqSecret() *config.Rule {
func SidekiqSensitiveUrl() *config.Rule { func SidekiqSensitiveUrl() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Sidekiq Sensitive URL", Description: "Uncovered a Sidekiq Sensitive URL, potentially exposing internal job queues and sensitive operation details.",
RuleID: "sidekiq-sensitive-url", RuleID: "sidekiq-sensitive-url",
SecretGroup: 2, SecretGroup: 2,
Regex: regexp.MustCompile(`(?i)\b(http(?:s??):\/\/)([a-f0-9]{8}:[a-f0-9]{8})@(?:gems.contribsys.com|enterprise.contribsys.com)(?:[\/|\#|\?|:]|$)`), Regex: regexp.MustCompile(`(?i)\b(http(?:s??):\/\/)([a-f0-9]{8}:[a-f0-9]{8})@(?:gems.contribsys.com|enterprise.contribsys.com)(?:[\/|\#|\?|:]|$)`),
+9 -9
View File
@@ -12,7 +12,7 @@ import (
func SlackBotToken() *config.Rule { func SlackBotToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Slack Bot token", Description: "Identified a Slack Bot token, which may compromise bot integrations and communication channel security.",
RuleID: "slack-bot-token", RuleID: "slack-bot-token",
Regex: regexp.MustCompile( Regex: regexp.MustCompile(
`(xoxb-[0-9]{10,13}\-[0-9]{10,13}[a-zA-Z0-9-]*)`), `(xoxb-[0-9]{10,13}\-[0-9]{10,13}[a-zA-Z0-9-]*)`),
@@ -43,7 +43,7 @@ func SlackBotToken() *config.Rule {
func SlackUserToken() *config.Rule { func SlackUserToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Slack User", Description: "Found a Slack User token, posing a risk of unauthorized user impersonation and data access within Slack workspaces.",
RuleID: "slack-user-token", RuleID: "slack-user-token",
// The last segment seems to be consistently 32 characters. I've made it 28-34 just in case. // The last segment seems to be consistently 32 characters. I've made it 28-34 just in case.
Regex: regexp.MustCompile(`(xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34})`), Regex: regexp.MustCompile(`(xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34})`),
@@ -81,7 +81,7 @@ func SlackUserToken() *config.Rule {
func SlackAppLevelToken() *config.Rule { func SlackAppLevelToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Slack App-level token", Description: "Detected a Slack App-level token, risking unauthorized access to Slack applications and workspace data.",
RuleID: "slack-app-token", RuleID: "slack-app-token",
// This regex is based on a limited number of examples and may not be 100% accurate. // This regex is based on a limited number of examples and may not be 100% accurate.
Regex: regexp.MustCompile(`(?i)(xapp-\d-[A-Z0-9]+-\d+-[a-z0-9]+)`), Regex: regexp.MustCompile(`(?i)(xapp-\d-[A-Z0-9]+-\d+-[a-z0-9]+)`),
@@ -102,7 +102,7 @@ func SlackAppLevelToken() *config.Rule {
func SlackConfigurationToken() *config.Rule { func SlackConfigurationToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Slack Configuration access token", Description: "Found a Slack Configuration access token, posing a risk to workspace configuration and sensitive data access.",
RuleID: "slack-config-access-token", RuleID: "slack-config-access-token",
Regex: regexp.MustCompile(`(?i)(xoxe.xox[bp]-\d-[A-Z0-9]{163,166})`), Regex: regexp.MustCompile(`(?i)(xoxe.xox[bp]-\d-[A-Z0-9]{163,166})`),
Keywords: []string{"xoxe.xoxb-", "xoxe.xoxp-"}, Keywords: []string{"xoxe.xoxb-", "xoxe.xoxp-"},
@@ -127,7 +127,7 @@ func SlackConfigurationToken() *config.Rule {
func SlackConfigurationRefreshToken() *config.Rule { func SlackConfigurationRefreshToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Slack Configuration refresh token", Description: "Discovered a Slack Configuration refresh token, potentially allowing prolonged unauthorized access to configuration settings.",
RuleID: "slack-config-refresh-token", RuleID: "slack-config-refresh-token",
Regex: regexp.MustCompile(`(?i)(xoxe-\d-[A-Z0-9]{146})`), Regex: regexp.MustCompile(`(?i)(xoxe-\d-[A-Z0-9]{146})`),
Keywords: []string{"xoxe-"}, Keywords: []string{"xoxe-"},
@@ -145,7 +145,7 @@ func SlackConfigurationRefreshToken() *config.Rule {
// Reference: https://api.slack.com/authentication/token-types#legacy_bot // Reference: https://api.slack.com/authentication/token-types#legacy_bot
func SlackLegacyBotToken() *config.Rule { func SlackLegacyBotToken() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Slack Legacy bot token", Description: "Uncovered a Slack Legacy bot token, which could lead to compromised legacy bot operations and data exposure.",
RuleID: "slack-legacy-bot-token", RuleID: "slack-legacy-bot-token",
// This rule is based off the limited information I could find and may not be 100% accurate. // This rule is based off the limited information I could find and may not be 100% accurate.
Regex: regexp.MustCompile( Regex: regexp.MustCompile(
@@ -188,7 +188,7 @@ func SlackLegacyBotToken() *config.Rule {
// Reference: https://api.slack.com/authentication/token-types#workspace // Reference: https://api.slack.com/authentication/token-types#workspace
func SlackLegacyWorkspaceToken() *config.Rule { func SlackLegacyWorkspaceToken() *config.Rule {
r := config.Rule{ r := config.Rule{
Description: "Slack Legacy Workspace token", Description: "Identified a Slack Legacy Workspace token, potentially compromising access to workspace data and legacy features.",
RuleID: "slack-legacy-workspace-token", RuleID: "slack-legacy-workspace-token",
// This is by far the least confident pattern. // This is by far the least confident pattern.
Regex: regexp.MustCompile( Regex: regexp.MustCompile(
@@ -223,7 +223,7 @@ func SlackLegacyWorkspaceToken() *config.Rule {
func SlackLegacyToken() *config.Rule { func SlackLegacyToken() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Slack Legacy token", Description: "Detected a Slack Legacy token, risking unauthorized access to older Slack integrations and user data.",
RuleID: "slack-legacy-token", RuleID: "slack-legacy-token",
Regex: regexp.MustCompile(`(xox[os]-\d+-\d+-\d+-[a-fA-F\d]+)`), Regex: regexp.MustCompile(`(xox[os]-\d+-\d+-\d+-[a-fA-F\d]+)`),
Keywords: []string{"xoxo", "xoxs"}, Keywords: []string{"xoxo", "xoxs"},
@@ -254,7 +254,7 @@ func SlackLegacyToken() *config.Rule {
func SlackWebHookUrl() *config.Rule { func SlackWebHookUrl() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Slack Webhook", Description: "Discovered a Slack Webhook, which could lead to unauthorized message posting and data leakage in Slack channels.",
RuleID: "slack-webhook-url", RuleID: "slack-webhook-url",
// If this generates too many false-positives we should define an allowlist (e.g., "xxxx", "00000"). // If this generates too many false-positives we should define an allowlist (e.g., "xxxx", "00000").
Regex: regexp.MustCompile( Regex: regexp.MustCompile(
+1 -1
View File
@@ -16,7 +16,7 @@ func Snyk() *config.Rule {
// define rule // define rule
r := config.Rule{ r := config.Rule{
Description: "Snyk API token", Description: "Uncovered a Snyk API token, potentially compromising software vulnerability scanning and code security.",
RuleID: "snyk-api-token", RuleID: "snyk-api-token",
Regex: generateSemiGenericRegex(keywords, hex8_4_4_4_12(), true), Regex: generateSemiGenericRegex(keywords, hex8_4_4_4_12(), true),
Loaded 100 of 140 files, more files were not shown because too many files have changed in this diff. Show more