mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ae1def963 | ||
|
|
6517900e5a | ||
|
|
5e51da600b | ||
|
|
f0b8d26c99 | ||
|
|
1724591029 | ||
|
|
80d29764a0 | ||
|
|
f498b1d308 | ||
|
|
8eabfd614e | ||
|
|
4acd7a3c8d | ||
|
|
a37822dffd | ||
|
|
1c6b28aa61 | ||
|
|
f15b4e408b | ||
|
|
d5f9d2b5d2 |
No files matched your search
@@ -34,11 +34,16 @@ brew install gitleaks
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
Using the image from DockerHub:
|
#### DockerHub
|
||||||
```bash
|
```bash
|
||||||
docker pull zricethezav/gitleaks:latest
|
docker pull zricethezav/gitleaks:latest
|
||||||
docker run -v ${path_to_host_folder_to_scan}:/path zricethezav/gitleaks:latest [COMMAND] --source="/path" [OPTIONS]
|
docker run -v ${path_to_host_folder_to_scan}:/path zricethezav/gitleaks:latest [COMMAND] --source="/path" [OPTIONS]
|
||||||
```
|
```
|
||||||
|
#### ghrc.io
|
||||||
|
```bash
|
||||||
|
docker pull ghcr.io/zricethezav/gitleaks:latest
|
||||||
|
docker run -v ${path_to_host_folder_to_scan}:/path zricethezav/gitleaks:latest [COMMAND] --source="/path" [OPTIONS]
|
||||||
|
```
|
||||||
|
|
||||||
### From Source
|
### From Source
|
||||||
1. Download and install Go from https://golang.org/dl/
|
1. Download and install Go from https://golang.org/dl/
|
||||||
@@ -204,7 +209,38 @@ commits = [ "commit-A", "commit-B"]
|
|||||||
paths = ['''one-file-path-regex''']
|
paths = ['''one-file-path-regex''']
|
||||||
regexes = ['''one-regex-within-the-already-matched-regex''']
|
regexes = ['''one-regex-within-the-already-matched-regex''']
|
||||||
```
|
```
|
||||||
Refer to the default [gitleaks config](https://github.com/zricethezav/gitleaks/blob/v8/config/gitleaks.toml) for examples and advice on writing regular expressions for secret detection.
|
Refer to the default [gitleaks config](https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml) for examples and advice on writing regular expressions for secret detection.
|
||||||
|
|
||||||
|
### Tips on Writing Regular Expressions
|
||||||
|
Gitleaks rules are defined by regular expressions and entropy ranges.
|
||||||
|
Some secrets have unique signatures which make detecting those secrets easy.
|
||||||
|
Examples of those secrets would be Gitlab Personal Access Tokens, AWS keys, and Github Access Tokens.
|
||||||
|
All these examples have defined prefixes like `glpat`, `AKIA`, `ghp_`, etc.
|
||||||
|
|
||||||
|
Other secrets might just be a hash which means we need to write more complex rules to verify
|
||||||
|
that what we are matching is a secret.
|
||||||
|
|
||||||
|
Here is an example of a semi-generic secret
|
||||||
|
```
|
||||||
|
discord_client_secret = "8dyfuiRyq=vVc3RRr_edRk-fK__JItpZ"
|
||||||
|
```
|
||||||
|
We can write a regular expression to capture the variable name (identifier),
|
||||||
|
the assignment symbol (like '=' or ':='), and finally the actual secret.
|
||||||
|
The structure of a rule to match this example secret is below:
|
||||||
|
|
||||||
|
Beginning string
|
||||||
|
quotation
|
||||||
|
│ End string quotation
|
||||||
|
│ │
|
||||||
|
▼ ▼
|
||||||
|
(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-z0-9=_\-]{32})['\"]
|
||||||
|
|
||||||
|
▲ ▲ ▲
|
||||||
|
│ │ │
|
||||||
|
│ │ │
|
||||||
|
identifier assignment symbol
|
||||||
|
Secret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Exit Codes
|
## Exit Codes
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
@@ -40,12 +41,16 @@ func runDetect(cmd *cobra.Command, args []string) {
|
|||||||
log.Fatal().Err(err).Msg("Failed to load config")
|
log.Fatal().Err(err).Msg("Failed to load config")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg.Path, _ = cmd.Flags().GetString("config")
|
||||||
source, _ := cmd.Flags().GetString("source")
|
source, _ := cmd.Flags().GetString("source")
|
||||||
logOpts, _ := cmd.Flags().GetString("log-opts")
|
logOpts, _ := cmd.Flags().GetString("log-opts")
|
||||||
verbose, _ := cmd.Flags().GetBool("verbose")
|
verbose, _ := cmd.Flags().GetBool("verbose")
|
||||||
redact, _ := cmd.Flags().GetBool("redact")
|
redact, _ := cmd.Flags().GetBool("redact")
|
||||||
noGit, _ := cmd.Flags().GetBool("no-git")
|
noGit, _ := cmd.Flags().GetBool("no-git")
|
||||||
exitCode, _ := cmd.Flags().GetInt("exit-code")
|
exitCode, _ := cmd.Flags().GetInt("exit-code")
|
||||||
|
if cfg.Path == "" {
|
||||||
|
cfg.Path = filepath.Join(source, ".gitleaks.toml")
|
||||||
|
}
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
||||||
if noGit {
|
if noGit {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
@@ -35,11 +36,15 @@ func runProtect(cmd *cobra.Command, args []string) {
|
|||||||
log.Fatal().Err(err).Msg("Failed to load config")
|
log.Fatal().Err(err).Msg("Failed to load config")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg.Path, _ = cmd.Flags().GetString("config")
|
||||||
source, _ := cmd.Flags().GetString("source")
|
source, _ := cmd.Flags().GetString("source")
|
||||||
verbose, _ := cmd.Flags().GetBool("verbose")
|
verbose, _ := cmd.Flags().GetBool("verbose")
|
||||||
redact, _ := cmd.Flags().GetBool("redact")
|
redact, _ := cmd.Flags().GetBool("redact")
|
||||||
exitCode, _ := cmd.Flags().GetInt("exit-code")
|
exitCode, _ := cmd.Flags().GetInt("exit-code")
|
||||||
staged, _ := cmd.Flags().GetBool("staged")
|
staged, _ := cmd.Flags().GetBool("staged")
|
||||||
|
if cfg.Path == "" {
|
||||||
|
cfg.Path = filepath.Join(source, ".gitleaks.toml")
|
||||||
|
}
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
||||||
files, err := git.GitDiff(source, staged)
|
files, err := git.GitDiff(source, staged)
|
||||||
|
|||||||
+22
-5
@@ -52,7 +52,7 @@ func initLog() {
|
|||||||
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
||||||
ll, err := rootCmd.Flags().GetString("log-level")
|
ll, err := rootCmd.Flags().GetString("log-level")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal().Err(err)
|
log.Fatal().Msg(err.Error())
|
||||||
}
|
}
|
||||||
switch strings.ToLower(ll) {
|
switch strings.ToLower(ll) {
|
||||||
case "debug":
|
case "debug":
|
||||||
@@ -74,7 +74,7 @@ func initConfig() {
|
|||||||
fmt.Fprintf(os.Stderr, banner)
|
fmt.Fprintf(os.Stderr, banner)
|
||||||
cfgPath, err := rootCmd.Flags().GetString("config")
|
cfgPath, err := rootCmd.Flags().GetString("config")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal().Err(err)
|
log.Fatal().Msg(err.Error())
|
||||||
}
|
}
|
||||||
if cfgPath != "" {
|
if cfgPath != "" {
|
||||||
viper.SetConfigFile(cfgPath)
|
viper.SetConfigFile(cfgPath)
|
||||||
@@ -82,12 +82,25 @@ func initConfig() {
|
|||||||
} else {
|
} else {
|
||||||
source, err := rootCmd.Flags().GetString("source")
|
source, err := rootCmd.Flags().GetString("source")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal().Err(err)
|
log.Fatal().Msg(err.Error())
|
||||||
}
|
}
|
||||||
|
fileInfo, err := os.Stat(source)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal().Msg(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
if !fileInfo.IsDir() {
|
||||||
|
log.Debug().Msgf("Unable to write default gitleaks config to %s since --source=%s is a file, using default config",
|
||||||
|
filepath.Join(source, ".gitleaks.toml"), source)
|
||||||
|
viper.SetConfigType("toml")
|
||||||
|
viper.ReadConfig(strings.NewReader(config.DefaultConfig))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if _, err := os.Stat(filepath.Join(source, ".gitleaks.toml")); os.IsNotExist(err) {
|
if _, err := os.Stat(filepath.Join(source, ".gitleaks.toml")); os.IsNotExist(err) {
|
||||||
log.Debug().Msgf("No gitleaks config found, writing default gitleaks config to %s", filepath.Join(source, ".gitleaks.toml"))
|
log.Debug().Msgf("No gitleaks config found, writing default gitleaks config to %s", filepath.Join(source, ".gitleaks.toml"))
|
||||||
if err := os.WriteFile(filepath.Join(source, ".gitleaks.toml"), []byte(config.DefaultConfig), os.ModePerm); err != nil {
|
if err := os.WriteFile(filepath.Join(source, ".gitleaks.toml"), []byte(config.DefaultConfig), os.ModePerm); err != nil {
|
||||||
log.Debug().Msgf("Unable to write default gitleaks config to %s", filepath.Join(source, ".gitleaks.toml, using default config"))
|
log.Debug().Msgf("Unable to write default gitleaks config to %s, using default config", filepath.Join(source, ".gitleaks.toml"))
|
||||||
viper.SetConfigType("toml")
|
viper.SetConfigType("toml")
|
||||||
viper.ReadConfig(strings.NewReader(config.DefaultConfig))
|
viper.ReadConfig(strings.NewReader(config.DefaultConfig))
|
||||||
return
|
return
|
||||||
@@ -107,6 +120,10 @@ func initConfig() {
|
|||||||
|
|
||||||
func Execute() {
|
func Execute() {
|
||||||
if err := rootCmd.Execute(); err != nil {
|
if err := rootCmd.Execute(); err != nil {
|
||||||
log.Fatal().Err(err)
|
if strings.Contains(err.Error(), "unknown flag") {
|
||||||
|
// exit code 126: Command invoked cannot execute
|
||||||
|
os.Exit(126)
|
||||||
|
}
|
||||||
|
log.Fatal().Msg(err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,6 +38,7 @@ type ViperConfig struct {
|
|||||||
|
|
||||||
// Config is a configuration struct that contains rules and an allowlist if present.
|
// Config is a configuration struct that contains rules and an allowlist if present.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
Path string
|
||||||
Description string
|
Description string
|
||||||
Rules []*Rule
|
Rules []*Rule
|
||||||
Allowlist Allowlist
|
Allowlist Allowlist
|
||||||
|
|||||||
@@ -126,14 +126,6 @@ id = "pypi-upload-token"
|
|||||||
description = "PyPI upload token"
|
description = "PyPI upload token"
|
||||||
regex = '''pypi-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{50,1000}'''
|
regex = '''pypi-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{50,1000}'''
|
||||||
|
|
||||||
[[rules]]
|
|
||||||
id = "generic-api-key"
|
|
||||||
description = "Generic API Key"
|
|
||||||
regex = '''(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]'''
|
|
||||||
entropy = 3.7
|
|
||||||
entropyGroup = 4
|
|
||||||
|
|
||||||
# ➜ ~/code/gitleaks (v8) git show ec2fc9d6cb0954fb3b57201cf6133c48d8ca0d29 -- checks_test.go
|
|
||||||
[[rules]]
|
[[rules]]
|
||||||
id = "gcp-service-account"
|
id = "gcp-service-account"
|
||||||
description = "Google (GCP) Service-account"
|
description = "Google (GCP) Service-account"
|
||||||
@@ -441,8 +433,15 @@ regex = '''(?i)(twitch[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-
|
|||||||
description = "Typeform API token"
|
description = "Typeform API token"
|
||||||
regex = '''(?i)(typeform[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}(tfp_[a-z0-9\-_\.=]{59})'''
|
regex = '''(?i)(typeform[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}(tfp_[a-z0-9\-_\.=]{59})'''
|
||||||
|
|
||||||
|
# [[rules]]
|
||||||
|
# id = "generic-api-key"
|
||||||
|
# description = "Generic API Key"
|
||||||
|
# regex = '''(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]'''
|
||||||
|
# entropy = 3.7
|
||||||
|
# entropyGroup = 4
|
||||||
|
|
||||||
|
|
||||||
[allowlist]
|
[allowlist]
|
||||||
description = "global allow lists"
|
description = "global allow lists"
|
||||||
regexes = ['''219-09-9999''', '''078-05-1120''', '''(9[0-9]{2}|666)-\d{2}-\d{4}''']
|
regexes = ['''219-09-9999''', '''078-05-1120''', '''(9[0-9]{2}|666)-\d{2}-\d{4}''']
|
||||||
files = ['''(.*?)(jpg|gif|doc|pdf|bin|svg|socket)$''']
|
paths = ['''(.*?)(jpg|gif|doc|pdf|bin|svg|socket)$''']
|
||||||
+3
-3
@@ -19,8 +19,8 @@ func DetectFindings(cfg config.Config, b []byte, filePath string, commit string)
|
|||||||
var findings []report.Finding
|
var findings []report.Finding
|
||||||
linePairs := regexp.MustCompile("\n").FindAllIndex(b, -1)
|
linePairs := regexp.MustCompile("\n").FindAllIndex(b, -1)
|
||||||
|
|
||||||
// check if we should skip file based on the global allowlist
|
// check if we should skip file based on the global allowlist or if the file is the same as the gitleaks config
|
||||||
if cfg.Allowlist.PathAllowed(filePath) {
|
if cfg.Allowlist.PathAllowed(filePath) || filePath == cfg.Path {
|
||||||
return findings
|
return findings
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ func DetectFindings(cfg config.Config, b []byte, filePath string, commit string)
|
|||||||
Tags: r.Tags,
|
Tags: r.Tags,
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.Allowlist.RegexAllowed(f.Secret) {
|
if r.Allowlist.RegexAllowed(f.Secret) || cfg.Allowlist.RegexAllowed(f.Secret) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package detect
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
@@ -111,6 +112,18 @@ func TestDetectFindings(t *testing.T) {
|
|||||||
expectedFindings: []report.Finding{},
|
expectedFindings: []report.Finding{},
|
||||||
wantError: fmt.Errorf("Discord API key invalid regex entropy group 5, max regex entropy group 3"),
|
wantError: fmt.Errorf("Discord API key invalid regex entropy group 5, max regex entropy group 3"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
cfgName: "simple",
|
||||||
|
bytes: []byte(`awsToken := \"AKIALALEMEL33243OLIA\"`),
|
||||||
|
filePath: filepath.Join(configPath, "simple.toml"),
|
||||||
|
expectedFindings: []report.Finding{},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
cfgName: "allow_global_aws_re",
|
||||||
|
bytes: []byte(`awsToken := \"AKIALALEMEL33243OLIA\"`),
|
||||||
|
filePath: "tmp.go",
|
||||||
|
expectedFindings: []report.Finding{},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
@@ -126,6 +139,7 @@ func TestDetectFindings(t *testing.T) {
|
|||||||
var vc config.ViperConfig
|
var vc config.ViperConfig
|
||||||
viper.Unmarshal(&vc)
|
viper.Unmarshal(&vc)
|
||||||
cfg, err := vc.Translate()
|
cfg, err := vc.Translate()
|
||||||
|
cfg.Path = filepath.Join(configPath, tt.cfgName+".toml")
|
||||||
if tt.wantError != nil {
|
if tt.wantError != nil {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Errorf("expected error")
|
t.Errorf("expected error")
|
||||||
|
|||||||
+7
-1
@@ -5,6 +5,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/gitleaks/go-gitdiff/gitdiff"
|
"github.com/gitleaks/go-gitdiff/gitdiff"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/zricethezav/gitleaks/v8/config"
|
"github.com/zricethezav/gitleaks/v8/config"
|
||||||
"github.com/zricethezav/gitleaks/v8/report"
|
"github.com/zricethezav/gitleaks/v8/report"
|
||||||
godocutil "golang.org/x/tools/godoc/util"
|
godocutil "golang.org/x/tools/godoc/util"
|
||||||
@@ -17,7 +18,12 @@ func FromGit(files <-chan *gitdiff.File, cfg config.Config, outputOptions Option
|
|||||||
var findings []*report.Finding
|
var findings []*report.Finding
|
||||||
mu := sync.Mutex{}
|
mu := sync.Mutex{}
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
|
commitMap := make(map[string]bool)
|
||||||
for f := range files {
|
for f := range files {
|
||||||
|
// keep track of commits for logging
|
||||||
|
if f.PatchHeader != nil {
|
||||||
|
commitMap[f.PatchHeader.SHA] = true
|
||||||
|
}
|
||||||
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(f *gitdiff.File) {
|
go func(f *gitdiff.File) {
|
||||||
@@ -35,7 +41,6 @@ func FromGit(files <-chan *gitdiff.File, cfg config.Config, outputOptions Option
|
|||||||
// Check if commit is allowed
|
// Check if commit is allowed
|
||||||
if f.PatchHeader != nil {
|
if f.PatchHeader != nil {
|
||||||
commitSHA = f.PatchHeader.SHA
|
commitSHA = f.PatchHeader.SHA
|
||||||
|
|
||||||
if cfg.Allowlist.CommitAllowed(f.PatchHeader.SHA) {
|
if cfg.Allowlist.CommitAllowed(f.PatchHeader.SHA) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -85,5 +90,6 @@ func FromGit(files <-chan *gitdiff.File, cfg config.Config, outputOptions Option
|
|||||||
}
|
}
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
log.Debug().Msgf("%d commits scanned. Note: this number might be smaller than expected due to commits with no additions", len(commitMap))
|
||||||
return findings
|
return findings
|
||||||
}
|
}
|
||||||
+4
-1
@@ -7,6 +7,7 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gitleaks/go-gitdiff/gitdiff"
|
"github.com/gitleaks/go-gitdiff/gitdiff"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
@@ -21,7 +22,7 @@ func GitLog(source string, logOpts string) (<-chan *gitdiff.File, error) {
|
|||||||
args = append(args, strings.Split(logOpts, " ")...)
|
args = append(args, strings.Split(logOpts, " ")...)
|
||||||
cmd = exec.Command("git", args...)
|
cmd = exec.Command("git", args...)
|
||||||
} else {
|
} else {
|
||||||
cmd = exec.Command("git", "-C", sourceClean, "log", "-p", "-U0", "--full-history", "--simplify-merges", "--show-pulls", "--all")
|
cmd = exec.Command("git", "-C", sourceClean, "log", "-p", "-U0", "--full-history", "--all")
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debug().Msgf("executing: %s", cmd.String())
|
log.Debug().Msgf("executing: %s", cmd.String())
|
||||||
@@ -39,6 +40,7 @@ func GitLog(source string, logOpts string) (<-chan *gitdiff.File, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
go listenForStdErr(stderr)
|
go listenForStdErr(stderr)
|
||||||
|
time.Sleep(50 * time.Millisecond) // HACK: to avoid https://github.com/zricethezav/gitleaks/issues/722
|
||||||
|
|
||||||
return gitdiff.Parse(stdout)
|
return gitdiff.Parse(stdout)
|
||||||
}
|
}
|
||||||
@@ -66,6 +68,7 @@ func GitDiff(source string, staged bool) (<-chan *gitdiff.File, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
go listenForStdErr(stderr)
|
go listenForStdErr(stderr)
|
||||||
|
time.Sleep(50 * time.Millisecond) // HACK: to avoid https://github.com/zricethezav/gitleaks/issues/722
|
||||||
|
|
||||||
return gitdiff.Parse(stdout)
|
return gitdiff.Parse(stdout)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ import (
|
|||||||
func writeSarif(cfg config.Config, findings []*Finding, w io.WriteCloser) error {
|
func writeSarif(cfg config.Config, findings []*Finding, w io.WriteCloser) error {
|
||||||
sarif := Sarif{
|
sarif := Sarif{
|
||||||
Schema: "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json",
|
Schema: "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json",
|
||||||
Version: version,
|
Version: "2.1.0",
|
||||||
Runs: getRuns(cfg, findings),
|
Runs: getRuns(cfg, findings),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
[[rules]]
|
||||||
|
description = "AWS Access Key"
|
||||||
|
id = "aws-access-key"
|
||||||
|
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
|
||||||
|
tags = ["key", "AWS"]
|
||||||
|
|
||||||
|
[allowlist]
|
||||||
|
regexes = ['''AKIALALEMEL33243OLIA''']
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json",
|
"$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json",
|
||||||
"version": "v8.0.0",
|
"version": "2.1.0",
|
||||||
"runs": [
|
"runs": [
|
||||||
{
|
{
|
||||||
"tool": {
|
"tool": {
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
Reference in new issue
Block a user