mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-27 19:54:24 +01:00
Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f0c6f34bf | ||
|
|
66c5bc15d4 | ||
|
|
fa9fadbb84 | ||
|
|
d5e7364bcf | ||
|
|
e0ea9cefde | ||
|
|
56e409d9f1 | ||
|
|
82f7e32b71 | ||
|
|
f97a9ee872 | ||
|
|
78eebaca9d | ||
|
|
6f967cad68 | ||
|
|
88f56d3695 | ||
|
|
9609928c02 | ||
|
|
23cb69fba4 | ||
|
|
d1c77598da | ||
|
|
5f210c9d35 | ||
|
|
770baf7458 |
No files matched your search
@@ -144,7 +144,6 @@ Usage:
|
||||
gitleaks [command]
|
||||
|
||||
Available Commands:
|
||||
completion generate the autocompletion script for the specified shell
|
||||
dir scan directories or files for secrets
|
||||
git scan git repositories for secrets
|
||||
help Help about any command
|
||||
@@ -160,6 +159,8 @@ Flags:
|
||||
3. env var GITLEAKS_CONFIG_TOML with the file content
|
||||
4. (target path)/.gitleaks.toml
|
||||
If none of the four options are used, then gitleaks will use the default config
|
||||
--diagnostics string enable diagnostics (comma-separated list: cpu,mem,trace). cpu=CPU profiling, mem=memory profiling, trace=execution tracing
|
||||
--diagnostics-dir string directory to store diagnostics output files (defaults to current directory)
|
||||
--enable-rule strings only enable specific rules by id
|
||||
--exit-code int exit code when leaks have been encountered (default 1)
|
||||
-i, --gitleaks-ignore-path string path to .gitleaksignore file or folder containing one (default ".")
|
||||
@@ -171,7 +172,7 @@ Flags:
|
||||
--no-banner suppress banner
|
||||
--no-color turn off color for verbose output
|
||||
--redact uint[=100] redact secrets from logs and stdout. To redact only parts of the secret just apply a percent value from 0..100. For example --redact=20 (default 100%)
|
||||
-f, --report-format string output format (json, csv, junit, sarif) (default "json")
|
||||
-f, --report-format string output format (json, csv, junit, sarif, template)
|
||||
-r, --report-path string report file
|
||||
--report-template string template file used to generate the report (implies --report-format=template)
|
||||
-v, --verbose show verbose output from scan
|
||||
@@ -449,7 +450,9 @@ ways:
|
||||
|
||||
Currently supported encodings:
|
||||
|
||||
- `base64` (both standard and base64url)
|
||||
- **percent** - Any printable ASCII percent encoded values
|
||||
- **hex** - Any printable ASCII hex encoded values >= 32 characters
|
||||
- **base64** - Any printable ASCII base64 encoded values >= 16 characters
|
||||
|
||||
#### Reporting
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ func runDetect(cmd *cobra.Command, args []string) {
|
||||
|
||||
// setup config (aka, the thing that defines rules)
|
||||
initConfig(source)
|
||||
initDiagnostics()
|
||||
cfg := Config(cmd)
|
||||
|
||||
// create detector
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
"runtime/trace"
|
||||
"strings"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/logging"
|
||||
)
|
||||
|
||||
// DiagnosticsManager manages various types of diagnostics
|
||||
type DiagnosticsManager struct {
|
||||
Enabled bool
|
||||
DiagTypes []string
|
||||
OutputDir string
|
||||
cpuProfile *os.File
|
||||
memProfile string
|
||||
traceProfile *os.File
|
||||
}
|
||||
|
||||
// NewDiagnosticsManager creates a new DiagnosticsManager instance
|
||||
func NewDiagnosticsManager(diagnosticsFlag string, diagnosticsDir string) (*DiagnosticsManager, error) {
|
||||
if diagnosticsFlag == "" {
|
||||
return &DiagnosticsManager{Enabled: false}, nil
|
||||
}
|
||||
|
||||
dm := &DiagnosticsManager{
|
||||
Enabled: true,
|
||||
DiagTypes: strings.Split(diagnosticsFlag, ","),
|
||||
OutputDir: diagnosticsDir,
|
||||
}
|
||||
|
||||
// If no output directory is specified, use the current directory
|
||||
if dm.OutputDir == "" {
|
||||
var err error
|
||||
dm.OutputDir, err = os.Getwd()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get current directory: %w", err)
|
||||
}
|
||||
logging.Debug().Msgf("No diagnostics directory specified, using current directory: %s", dm.OutputDir)
|
||||
}
|
||||
|
||||
// Create the output directory if it doesn't exist
|
||||
if err := os.MkdirAll(dm.OutputDir, 0755); err != nil {
|
||||
return nil, fmt.Errorf("failed to create diagnostics directory: %w", err)
|
||||
}
|
||||
|
||||
// Make sure the output directory is absolute
|
||||
if !filepath.IsAbs(dm.OutputDir) {
|
||||
absPath, err := filepath.Abs(dm.OutputDir)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get absolute path for diagnostics directory: %w", err)
|
||||
}
|
||||
dm.OutputDir = absPath
|
||||
}
|
||||
|
||||
logging.Debug().Msgf("Diagnostics enabled: %s", strings.Join(dm.DiagTypes, ","))
|
||||
logging.Debug().Msgf("Diagnostics output directory: %s", dm.OutputDir)
|
||||
|
||||
return dm, nil
|
||||
}
|
||||
|
||||
// StartDiagnostics starts all enabled diagnostics
|
||||
func (dm *DiagnosticsManager) StartDiagnostics() error {
|
||||
if !dm.Enabled {
|
||||
return nil
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
for _, diagType := range dm.DiagTypes {
|
||||
diagType = strings.TrimSpace(diagType)
|
||||
switch diagType {
|
||||
case "cpu":
|
||||
if err = dm.StartCPUProfile(); err != nil {
|
||||
return err
|
||||
}
|
||||
case "mem":
|
||||
if err = dm.SetupMemoryProfile(); err != nil {
|
||||
return err
|
||||
}
|
||||
case "trace":
|
||||
if err = dm.StartTraceProfile(); err != nil {
|
||||
return err
|
||||
}
|
||||
default:
|
||||
logging.Warn().Msgf("Unknown diagnostics type: %s", diagType)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// StopDiagnostics stops all started diagnostics
|
||||
func (dm *DiagnosticsManager) StopDiagnostics() {
|
||||
if !dm.Enabled {
|
||||
return
|
||||
}
|
||||
|
||||
logging.Debug().Msg("Stopping diagnostics and writing profiling data...")
|
||||
|
||||
for _, diagType := range dm.DiagTypes {
|
||||
diagType = strings.TrimSpace(diagType)
|
||||
switch diagType {
|
||||
case "cpu":
|
||||
dm.StopCPUProfile()
|
||||
case "mem":
|
||||
dm.WriteMemoryProfile()
|
||||
case "trace":
|
||||
dm.StopTraceProfile()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// StartCPUProfile starts CPU profiling
|
||||
func (dm *DiagnosticsManager) StartCPUProfile() error {
|
||||
cpuProfilePath := filepath.Join(dm.OutputDir, "cpu.pprof")
|
||||
f, err := os.Create(cpuProfilePath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not create CPU profile at %s: %w", cpuProfilePath, err)
|
||||
}
|
||||
|
||||
if err := pprof.StartCPUProfile(f); err != nil {
|
||||
f.Close()
|
||||
return fmt.Errorf("could not start CPU profile: %w", err)
|
||||
}
|
||||
|
||||
dm.cpuProfile = f
|
||||
return nil
|
||||
}
|
||||
|
||||
// StopCPUProfile stops CPU profiling
|
||||
func (dm *DiagnosticsManager) StopCPUProfile() {
|
||||
if dm.cpuProfile != nil {
|
||||
pprof.StopCPUProfile()
|
||||
if err := dm.cpuProfile.Close(); err != nil {
|
||||
logging.Error().Err(err).Msg("Error closing CPU profile file")
|
||||
}
|
||||
logging.Info().Msgf("CPU profile written to: %s", dm.cpuProfile.Name())
|
||||
dm.cpuProfile = nil
|
||||
}
|
||||
}
|
||||
|
||||
// SetupMemoryProfile sets up memory profiling to be written when StopDiagnostics is called
|
||||
func (dm *DiagnosticsManager) SetupMemoryProfile() error {
|
||||
memProfilePath := filepath.Join(dm.OutputDir, "mem.pprof")
|
||||
dm.memProfile = memProfilePath
|
||||
return nil
|
||||
}
|
||||
|
||||
// WriteMemoryProfile writes the memory profile to disk
|
||||
func (dm *DiagnosticsManager) WriteMemoryProfile() {
|
||||
if dm.memProfile == "" {
|
||||
return
|
||||
}
|
||||
|
||||
f, err := os.Create(dm.memProfile)
|
||||
if err != nil {
|
||||
logging.Error().Err(err).Msgf("Could not create memory profile at %s", dm.memProfile)
|
||||
return
|
||||
}
|
||||
|
||||
// Get memory profile
|
||||
runtime.GC() // Run GC before taking the memory profile
|
||||
if err := pprof.WriteHeapProfile(f); err != nil {
|
||||
logging.Error().Err(err).Msg("Could not write memory profile")
|
||||
} else {
|
||||
logging.Info().Msgf("Memory profile written to: %s", dm.memProfile)
|
||||
}
|
||||
|
||||
if err := f.Close(); err != nil {
|
||||
logging.Error().Err(err).Msg("Error closing memory profile file")
|
||||
}
|
||||
|
||||
dm.memProfile = ""
|
||||
}
|
||||
|
||||
// StartTraceProfile starts execution tracing
|
||||
func (dm *DiagnosticsManager) StartTraceProfile() error {
|
||||
traceProfilePath := filepath.Join(dm.OutputDir, "trace.out")
|
||||
f, err := os.Create(traceProfilePath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not create trace profile at %s: %w", traceProfilePath, err)
|
||||
}
|
||||
|
||||
if err := trace.Start(f); err != nil {
|
||||
f.Close()
|
||||
return fmt.Errorf("could not start trace profile: %w", err)
|
||||
}
|
||||
|
||||
dm.traceProfile = f
|
||||
return nil
|
||||
}
|
||||
|
||||
// StopTraceProfile stops execution tracing
|
||||
func (dm *DiagnosticsManager) StopTraceProfile() {
|
||||
if dm.traceProfile != nil {
|
||||
trace.Stop()
|
||||
if err := dm.traceProfile.Close(); err != nil {
|
||||
logging.Error().Err(err).Msg("Error closing trace profile file")
|
||||
}
|
||||
logging.Info().Msgf("Trace profile written to: %s", dm.traceProfile.Name())
|
||||
dm.traceProfile = nil
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,10 @@ func runDirectory(cmd *cobra.Command, args []string) {
|
||||
source = "."
|
||||
}
|
||||
}
|
||||
|
||||
initConfig(source)
|
||||
initDiagnostics()
|
||||
|
||||
var (
|
||||
findings []report.Finding
|
||||
err error
|
||||
|
||||
@@ -66,7 +66,7 @@ func CreateGlobalConfig() config.Config {
|
||||
// ----------- Documents and media -----------
|
||||
regexp.MustCompile(`(?i)\.(?:bmp|gif|jpe?g|png|svg|tiff?)$`), // Images
|
||||
regexp.MustCompile(`(?i)\.(?:eot|[ot]tf|woff2?)$`), // Fonts
|
||||
regexp.MustCompile(`(?i)\.(?:docx?|xlsx?|pdf|bin|socket|vsidx|v2|suo|wsuo|.dll|pdb|exe|gltf|zip)$`),
|
||||
regexp.MustCompile(`(?i)\.(?:docx?|xlsx?|pdf|bin|socket|vsidx|v2|suo|wsuo|.dll|pdb|exe|gltf)$`),
|
||||
|
||||
// ----------- Golang files -----------
|
||||
regexp.MustCompile(`go\.(?:mod|sum|work(?:\.sum)?)$`),
|
||||
|
||||
@@ -26,6 +26,7 @@ func main() {
|
||||
gitleaksConfigPath := os.Args[1]
|
||||
|
||||
configRules := []*config.Rule{
|
||||
rules.OnePasswordSecretKey(),
|
||||
rules.OnePasswordServiceAccountToken(),
|
||||
rules.AdafruitAPIKey(),
|
||||
rules.AdobeClientID(),
|
||||
|
||||
@@ -33,10 +33,49 @@ export OP_SERVICE_ACCOUNT_TOKEN=ops_eyJzaWduSW5BZGRyZXNzIjoibXkuMXBhc3N3b3JkLmNv
|
||||
serviceAccountToken:
|
||||
fn::secret: ops_eyJzaWduSW5B..[Redacted]`,
|
||||
`: To start using this service account, run the following command:
|
||||
:
|
||||
:
|
||||
: export OP_SERVICE_ACCOUNT_TOKEN=ops_eyJzaWduSW5BZGRyZXNzIjoiaHR0cHM6...`,
|
||||
// Low entropy.
|
||||
`ops_eyJxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
|
||||
// Reference:
|
||||
// - https://1passwordstatic.com/files/security/1password-white-paper.pdf
|
||||
func OnePasswordSecretKey() *config.Rule {
|
||||
// 1Password secret keys include several hyphens but these are only for readability
|
||||
// and are stripped during 1Password login. This means that the following are technically
|
||||
// the same valid key:
|
||||
// - A3ASWWYB798JRYLJVD423DC286TVMH43EB
|
||||
// - A-3-A-S-W-W-Y-B-7-9-8-J-R-Y-L-J-V-D-4-2-3-D-C-2-8-6-T-V-M-H-4-3-E-B
|
||||
// But in practice, when these keys are added to a vault, exported in an emergency kit, or
|
||||
// copied, they have hyphens that follow one of two patterns I can find:
|
||||
// - A3-ASWWYB-798JRY-LJVD4-23DC2-86TVM-H43EB (every key I've generated has this pattern)
|
||||
// - A3-ASWWYB-798JRYLJVD4-23DC2-86TVM-H43EB (the whitepaper includes this example, which could just be a typo)
|
||||
// To avoid a complicated regex that checks for every possible situation it's probably best
|
||||
// to scan for the these two patterns.
|
||||
r := config.Rule{
|
||||
Description: "Uncovered a possible 1Password secret key, potentially compromising access to secrets in vaults.",
|
||||
RuleID: "1password-secret-key",
|
||||
Regex: regexp.MustCompile(`\bA3-[A-Z0-9]{6}-(?:(?:[A-Z0-9]{11})|(?:[A-Z0-9]{6}-[A-Z0-9]{5}))-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}\b`),
|
||||
Entropy: 3.8,
|
||||
Keywords: []string{"A3-"},
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := utils.GenerateSampleSecrets("1password", secrets.NewSecret(`A3-[A-Z0-9]{6}-[A-Z0-9]{11}-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}`))
|
||||
tps = append(tps, utils.GenerateSampleSecrets("1password", secrets.NewSecret(`A3-[A-Z0-9]{6}-[A-Z0-9]{6}-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}`))...)
|
||||
tps = append(tps,
|
||||
// from whitepaper
|
||||
`A3-ASWWYB-798JRYLJVD4-23DC2-86TVM-H43EB`,
|
||||
`A3-ASWWYB-798JRY-LJVD4-23DC2-86TVM-H43EB`,
|
||||
)
|
||||
fps := []string{
|
||||
// low entropy
|
||||
`A3-XXXXXX-XXXXXXXXXXX-XXXXX-XXXXX-XXXXX`,
|
||||
// lowercase
|
||||
`A3-xXXXXX-XXXXXX-XXXXX-XXXXX-XXXXX-XXXXX`,
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
@@ -17,7 +17,7 @@ func KubernetesSecret() *config.Rule {
|
||||
// - valid base64 characters
|
||||
// - longer than 10 characters (no "YmFyCg==")
|
||||
//language=regexp
|
||||
dataPat := `\bdata:(?:.|\s){0,100}?\s+([\w.-]+:(?:[ \t]*(?:\||>[-+]?)\s+)?[ \t]*(?:["']?[a-z0-9+/]{10,}={0,3}["']?|\{\{[ \t\w"|$:=,.-]+}}|""|''))`
|
||||
dataPat := `\bdata:(?s:.){0,100}?\s+([\w.-]+:(?:[ \t]*(?:\||>[-+]?)\s+)?[ \t]*(?:["']?[a-z0-9+/]{10,}={0,3}["']?|\{\{[ \t\w"|$:=,.-]+}}|""|''))`
|
||||
|
||||
// define rule
|
||||
r := config.Rule{
|
||||
@@ -25,7 +25,7 @@ func KubernetesSecret() *config.Rule {
|
||||
Description: "Possible Kubernetes Secret detected, posing a risk of leaking credentials/tokens from your deployments",
|
||||
Regex: regexp.MustCompile(fmt.Sprintf(
|
||||
//language=regexp
|
||||
`(?i)(?:%s(?:.|\s){0,200}?%s|%s(?:.|\s){0,200}?%s)`, kindPat, dataPat, dataPat, kindPat)),
|
||||
`(?i)(?:%s(?s:.){0,200}?%s|%s(?s:.){0,200}?%s)`, kindPat, dataPat, dataPat, kindPat)),
|
||||
Keywords: []string{
|
||||
"secret",
|
||||
},
|
||||
@@ -45,7 +45,7 @@ func KubernetesSecret() *config.Rule {
|
||||
// Avoid overreach between directives.
|
||||
RegexTarget: "match",
|
||||
Regexes: []*regexp.Regexp{
|
||||
regexp.MustCompile(`(kind:(?:.|\s)+\n---\n(?:.|\s)+\bdata:|data:(?:.|\s)+\n---\n(?:.|\s)+\bkind:)`),
|
||||
regexp.MustCompile(`(kind:(?s:.)+\n---\n(?s:.)+\bdata:|data:(?s:.)+\n---\n(?s:.)+\bkind:)`),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -42,6 +42,8 @@ func runGit(cmd *cobra.Command, args []string) {
|
||||
|
||||
// setup config (aka, the thing that defines rules)
|
||||
initConfig(source)
|
||||
initDiagnostics()
|
||||
|
||||
cfg := Config(cmd)
|
||||
|
||||
// create detector
|
||||
|
||||
@@ -33,6 +33,8 @@ func runProtect(cmd *cobra.Command, args []string) {
|
||||
|
||||
// setup config (aka, the thing that defines rules)
|
||||
initConfig(source)
|
||||
initDiagnostics()
|
||||
|
||||
cfg := Config(cmd)
|
||||
|
||||
// create detector
|
||||
|
||||
+49
-5
@@ -38,11 +38,17 @@ order of precedence:
|
||||
4. (target path)/.gitleaks.toml
|
||||
If none of the four options are used, then gitleaks will use the default config`
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "gitleaks",
|
||||
Short: "Gitleaks scans code, past or present, for secrets",
|
||||
Version: Version,
|
||||
}
|
||||
var (
|
||||
rootCmd = &cobra.Command{
|
||||
Use: "gitleaks",
|
||||
Short: "Gitleaks scans code, past or present, for secrets",
|
||||
Version: Version,
|
||||
}
|
||||
|
||||
// diagnostics manager is global to ensure it can be started before a scan begins
|
||||
// and stopped after a scan completes
|
||||
diagnosticsManager *DiagnosticsManager
|
||||
)
|
||||
|
||||
const (
|
||||
BYTE = 1.0
|
||||
@@ -71,6 +77,10 @@ func init() {
|
||||
rootCmd.PersistentFlags().StringP("gitleaks-ignore-path", "i", ".", "path to .gitleaksignore file or folder containing one")
|
||||
rootCmd.PersistentFlags().Int("max-decode-depth", 0, "allow recursive decoding up to this depth (default \"0\", no decoding is done)")
|
||||
|
||||
// Add diagnostics flags
|
||||
rootCmd.PersistentFlags().String("diagnostics", "", "enable diagnostics (comma-separated list: cpu,mem,trace). cpu=CPU profiling, mem=memory profiling, trace=execution tracing")
|
||||
rootCmd.PersistentFlags().String("diagnostics-dir", "", "directory to store diagnostics output files (defaults to current directory)")
|
||||
|
||||
err := viper.BindPFlag("config", rootCmd.PersistentFlags().Lookup("config"))
|
||||
if err != nil {
|
||||
logging.Fatal().Msgf("err binding config %s", err.Error())
|
||||
@@ -169,6 +179,33 @@ func initConfig(source string) {
|
||||
}
|
||||
}
|
||||
|
||||
func initDiagnostics() {
|
||||
// Initialize diagnostics manager
|
||||
diagnosticsFlag, err := rootCmd.PersistentFlags().GetString("diagnostics")
|
||||
if err != nil {
|
||||
logging.Fatal().Err(err).Msg("Error getting diagnostics flag")
|
||||
}
|
||||
|
||||
diagnosticsDir, err := rootCmd.PersistentFlags().GetString("diagnostics-dir")
|
||||
if err != nil {
|
||||
logging.Fatal().Err(err).Msg("Error getting diagnostics-dir flag")
|
||||
}
|
||||
|
||||
var diagErr error
|
||||
diagnosticsManager, diagErr = NewDiagnosticsManager(diagnosticsFlag, diagnosticsDir)
|
||||
if diagErr != nil {
|
||||
logging.Fatal().Err(diagErr).Msg("Error initializing diagnostics")
|
||||
}
|
||||
|
||||
if diagnosticsManager.Enabled {
|
||||
logging.Info().Msg("Starting diagnostics...")
|
||||
if diagErr := diagnosticsManager.StartDiagnostics(); diagErr != nil {
|
||||
logging.Fatal().Err(diagErr).Msg("Failed to start diagnostics")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func Execute() {
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
if strings.Contains(err.Error(), "unknown flag") {
|
||||
@@ -379,6 +416,13 @@ func bytesConvert(bytes uint64) string {
|
||||
}
|
||||
|
||||
func findingSummaryAndExit(detector *detect.Detector, findings []report.Finding, exitCode int, start time.Time, err error) {
|
||||
if diagnosticsManager.Enabled {
|
||||
logging.Debug().Msg("Finalizing diagnostics...")
|
||||
diagnosticsManager.StopDiagnostics()
|
||||
}
|
||||
|
||||
detector.Cleanup()
|
||||
|
||||
totalBytes := detector.TotalBytes.Load()
|
||||
bytesMsg := fmt.Sprintf("scanned ~%d bytes (%s)", totalBytes, bytesConvert(totalBytes))
|
||||
if err == nil {
|
||||
|
||||
@@ -25,6 +25,8 @@ func runStdIn(cmd *cobra.Command, _ []string) {
|
||||
|
||||
// setup config (aka, the thing that defines rules)
|
||||
initConfig(".")
|
||||
initDiagnostics()
|
||||
|
||||
cfg := Config(cmd)
|
||||
|
||||
// create detector
|
||||
|
||||
+10
-3
@@ -20,7 +20,7 @@ paths = [
|
||||
'''gitleaks\.toml''',
|
||||
'''(?i)\.(?:bmp|gif|jpe?g|png|svg|tiff?)$''',
|
||||
'''(?i)\.(?:eot|[ot]tf|woff2?)$''',
|
||||
'''(?i)\.(?:docx?|xlsx?|pdf|bin|socket|vsidx|v2|suo|wsuo|.dll|pdb|exe|gltf|zip)$''',
|
||||
'''(?i)\.(?:docx?|xlsx?|pdf|bin|socket|vsidx|v2|suo|wsuo|.dll|pdb|exe|gltf)$''',
|
||||
'''go\.(?:mod|sum|work(?:\.sum)?)$''',
|
||||
'''(?:^|/)vendor/modules\.txt$''',
|
||||
'''(?:^|/)vendor/(?:github\.com|golang\.org/x|google\.golang\.org|gopkg\.in|istio\.io|k8s\.io|sigs\.k8s\.io)(?:/.*)?$''',
|
||||
@@ -62,6 +62,13 @@ stopwords = [
|
||||
"014df517-39d1-4453-b7b3-9930c563627c",
|
||||
]
|
||||
|
||||
[[rules]]
|
||||
id = "1password-secret-key"
|
||||
description = "Uncovered a possible 1Password secret key, potentially compromising access to secrets in vaults."
|
||||
regex = '''\bA3-[A-Z0-9]{6}-(?:(?:[A-Z0-9]{11})|(?:[A-Z0-9]{6}-[A-Z0-9]{5}))-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}\b'''
|
||||
entropy = 3.8
|
||||
keywords = ["a3-"]
|
||||
|
||||
[[rules]]
|
||||
id = "1password-service-account-token"
|
||||
description = "Uncovered a possible 1Password service account token, potentially compromising access to secrets in vaults."
|
||||
@@ -2377,7 +2384,7 @@ keywords = ["kraken"]
|
||||
[[rules]]
|
||||
id = "kubernetes-secret-yaml"
|
||||
description = "Possible Kubernetes Secret detected, posing a risk of leaking credentials/tokens from your deployments"
|
||||
regex = '''(?i)(?:\bkind:[ \t]*["']?\bsecret\b["']?(?:.|\s){0,200}?\bdata:(?:.|\s){0,100}?\s+([\w.-]+:(?:[ \t]*(?:\||>[-+]?)\s+)?[ \t]*(?:["']?[a-z0-9+/]{10,}={0,3}["']?|\{\{[ \t\w"|$:=,.-]+}}|""|''))|\bdata:(?:.|\s){0,100}?\s+([\w.-]+:(?:[ \t]*(?:\||>[-+]?)\s+)?[ \t]*(?:["']?[a-z0-9+/]{10,}={0,3}["']?|\{\{[ \t\w"|$:=,.-]+}}|""|''))(?:.|\s){0,200}?\bkind:[ \t]*["']?\bsecret\b["']?)'''
|
||||
regex = '''(?i)(?:\bkind:[ \t]*["']?\bsecret\b["']?(?s:.){0,200}?\bdata:(?s:.){0,100}?\s+([\w.-]+:(?:[ \t]*(?:\||>[-+]?)\s+)?[ \t]*(?:["']?[a-z0-9+/]{10,}={0,3}["']?|\{\{[ \t\w"|$:=,.-]+}}|""|''))|\bdata:(?s:.){0,100}?\s+([\w.-]+:(?:[ \t]*(?:\||>[-+]?)\s+)?[ \t]*(?:["']?[a-z0-9+/]{10,}={0,3}["']?|\{\{[ \t\w"|$:=,.-]+}}|""|''))(?s:.){0,200}?\bkind:[ \t]*["']?\bsecret\b["']?)'''
|
||||
path = '''(?i)\.ya?ml$'''
|
||||
keywords = ["secret"]
|
||||
[[rules.allowlists]]
|
||||
@@ -2387,7 +2394,7 @@ regexes = [
|
||||
[[rules.allowlists]]
|
||||
regexTarget = "match"
|
||||
regexes = [
|
||||
'''(kind:(?:.|\s)+\n---\n(?:.|\s)+\bdata:|data:(?:.|\s)+\n---\n(?:.|\s)+\bkind:)''',
|
||||
'''(kind:(?s:.)+\n---\n(?s:.)+\bdata:|data:(?s:.)+\n---\n(?s:.)+\bkind:)''',
|
||||
]
|
||||
|
||||
[[rules]]
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package detect
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/mholt/archives"
|
||||
"github.com/zricethezav/gitleaks/v8/sources"
|
||||
)
|
||||
|
||||
// isArchive asks archives.Identify (with a nil stream, so only the filename)
|
||||
// whether this file would be handled by an Extractor. If Identify returns
|
||||
// a Format implementing archives.Extractor, we treat it as an archive.
|
||||
func isArchive(path string) bool {
|
||||
format, _, err := archives.Identify(context.Background(), path, nil)
|
||||
if err != nil {
|
||||
// no matching format at all
|
||||
return false
|
||||
}
|
||||
_, ok := format.(archives.Extractor)
|
||||
return ok
|
||||
}
|
||||
|
||||
// ExtractArchive extracts all files from archivePath into a temp dir.
|
||||
// Returns the list of ScanTargets (with real file paths) and the temp dir for cleanup.
|
||||
func extractArchive(archivePath string) ([]sources.ScanTarget, string, error) {
|
||||
tmpArchiveDir, err := os.MkdirTemp(tmpDir, "archive-*")
|
||||
if err != nil {
|
||||
return nil, "", fmt.Errorf("creating temp dir for archive: %w", err)
|
||||
}
|
||||
|
||||
f, err := os.Open(archivePath)
|
||||
if err != nil {
|
||||
os.RemoveAll(tmpArchiveDir)
|
||||
return nil, "", err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
ctx := context.Background()
|
||||
format, stream, err := archives.Identify(ctx, archivePath, f)
|
||||
if err != nil {
|
||||
os.RemoveAll(tmpArchiveDir)
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
extractor, ok := format.(archives.Extractor)
|
||||
if !ok {
|
||||
os.RemoveAll(tmpArchiveDir)
|
||||
return nil, "", fmt.Errorf("format %T is not extractable", format)
|
||||
}
|
||||
|
||||
// Walk and extract
|
||||
var targets []sources.ScanTarget
|
||||
err = extractor.Extract(ctx, stream, func(ctx context.Context, file archives.FileInfo) error {
|
||||
name := file.Name()
|
||||
// skip macOS metadata and __MACOSX folders
|
||||
// TODO add more exceptions here if needed
|
||||
base := filepath.Base(name)
|
||||
if strings.HasPrefix(base, "._") || strings.HasPrefix(name, "__MACOSX/") {
|
||||
return nil
|
||||
}
|
||||
|
||||
if file.IsDir() {
|
||||
return nil
|
||||
}
|
||||
// open and copy out
|
||||
r, err := file.Open()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer r.Close()
|
||||
|
||||
outPath := filepath.Join(tmpArchiveDir, file.Name())
|
||||
if err := os.MkdirAll(filepath.Dir(outPath), 0o755); err != nil {
|
||||
return err
|
||||
}
|
||||
outFile, err := os.Create(outPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer outFile.Close()
|
||||
|
||||
if _, err := io.Copy(outFile, r); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
targets = append(targets, sources.ScanTarget{Path: outPath})
|
||||
return nil
|
||||
})
|
||||
|
||||
return targets, tmpArchiveDir, err
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package codec
|
||||
|
||||
var printableASCII [256]bool
|
||||
|
||||
func init() {
|
||||
for b := 0; b < len(printableASCII); b++ {
|
||||
if '\x08' < b && b < '\x7f' {
|
||||
printableASCII[b] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// isPrintableASCII returns true if all bytes are printable ASCII
|
||||
func isPrintableASCII(b []byte) bool {
|
||||
for _, c := range b {
|
||||
if !printableASCII[c] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// hasByte can be used to check if a string has at least one of the provided
|
||||
// bytes. Note: make sure byteset is long enough to handle the largest byte in
|
||||
// the string.
|
||||
func hasByte(data string, byteset []bool) bool {
|
||||
for i := 0; i < len(data); i++ {
|
||||
if byteset[data[i]] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package codec
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
)
|
||||
|
||||
// likelyBase64Chars is a set of characters that you would expect to find at
|
||||
// least one of in base64 encoded data. This risks missing about 1% of
|
||||
// base64 encoded data that doesn't contain these characters, but gives you
|
||||
// the performance gain of not trying to decode a lot of long symbols in code.
|
||||
var likelyBase64Chars = make([]bool, 256)
|
||||
|
||||
func init() {
|
||||
for _, c := range `0123456789+/-_` {
|
||||
likelyBase64Chars[c] = true
|
||||
}
|
||||
}
|
||||
|
||||
// decodeBase64 decodes base64 encoded printable ASCII characters
|
||||
func decodeBase64(encodedValue string) string {
|
||||
// Exit early if it doesn't seem like base64
|
||||
if !hasByte(encodedValue, likelyBase64Chars) {
|
||||
return ""
|
||||
}
|
||||
|
||||
// Try standard base64 decoding
|
||||
decodedValue, err := base64.StdEncoding.DecodeString(encodedValue)
|
||||
if err == nil && isPrintableASCII(decodedValue) {
|
||||
return string(decodedValue)
|
||||
}
|
||||
|
||||
// Try base64url decoding
|
||||
decodedValue, err = base64.RawURLEncoding.DecodeString(encodedValue)
|
||||
if err == nil && isPrintableASCII(decodedValue) {
|
||||
return string(decodedValue)
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package codec
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/logging"
|
||||
)
|
||||
|
||||
// Decoder decodes various types of data in place
|
||||
type Decoder struct {
|
||||
decodedMap map[string]string
|
||||
}
|
||||
|
||||
// NewDecoder creates a default decoder struct
|
||||
func NewDecoder() *Decoder {
|
||||
return &Decoder{
|
||||
decodedMap: make(map[string]string),
|
||||
}
|
||||
}
|
||||
|
||||
// Decode returns the data with the values decoded in place along with the
|
||||
// encoded segment meta data for the next pass of decoding
|
||||
func (d *Decoder) Decode(data string, predecessors []*EncodedSegment) (string, []*EncodedSegment) {
|
||||
segments := d.findEncodedSegments(data, predecessors)
|
||||
|
||||
if len(segments) > 0 {
|
||||
result := bytes.NewBuffer(make([]byte, 0, len(data)))
|
||||
encodedStart := 0
|
||||
for _, segment := range segments {
|
||||
result.WriteString(data[encodedStart:segment.encoded.start])
|
||||
result.WriteString(segment.decodedValue)
|
||||
encodedStart = segment.encoded.end
|
||||
}
|
||||
|
||||
result.WriteString(data[encodedStart:])
|
||||
return result.String(), segments
|
||||
}
|
||||
|
||||
return data, segments
|
||||
}
|
||||
|
||||
// findEncodedSegments finds the encoded segments in the data
|
||||
func (d *Decoder) findEncodedSegments(data string, predecessors []*EncodedSegment) []*EncodedSegment {
|
||||
if len(data) == 0 {
|
||||
return []*EncodedSegment{}
|
||||
}
|
||||
|
||||
decodedShift := 0
|
||||
encodingMatches := findEncodingMatches(data)
|
||||
segments := make([]*EncodedSegment, 0, len(encodingMatches))
|
||||
for _, m := range encodingMatches {
|
||||
encodedValue := data[m.start:m.end]
|
||||
decodedValue, alreadyDecoded := d.decodedMap[encodedValue]
|
||||
|
||||
if !alreadyDecoded {
|
||||
decodedValue = m.encoding.decode(encodedValue)
|
||||
d.decodedMap[encodedValue] = decodedValue
|
||||
}
|
||||
|
||||
if len(decodedValue) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
segment := &EncodedSegment{
|
||||
predecessors: predecessors,
|
||||
original: toOriginal(predecessors, m.startEnd),
|
||||
encoded: m.startEnd,
|
||||
decoded: startEnd{
|
||||
m.start + decodedShift,
|
||||
m.start + decodedShift + len(decodedValue),
|
||||
},
|
||||
decodedValue: decodedValue,
|
||||
encodings: m.encoding.kind,
|
||||
depth: 1,
|
||||
}
|
||||
|
||||
// Shift decoded start and ends based on size changes
|
||||
decodedShift += len(decodedValue) - len(encodedValue)
|
||||
|
||||
// Adjust depth and encoding if applicable
|
||||
if len(segment.predecessors) != 0 {
|
||||
// Set the depth based on the predecessors' depth in the previous pass
|
||||
segment.depth = 1 + segment.predecessors[0].depth
|
||||
// Adjust encodings
|
||||
for _, p := range segment.predecessors {
|
||||
if segment.encoded.overlaps(p.decoded) {
|
||||
segment.encodings |= p.encodings
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
segments = append(segments, segment)
|
||||
logging.Debug().
|
||||
Str("decoder", m.encoding.kind.String()).
|
||||
Msgf(
|
||||
"segment found: original=%s pos=%s: %q -> %q",
|
||||
segment.original,
|
||||
segment.encoded,
|
||||
encodedValue,
|
||||
segment.decodedValue,
|
||||
)
|
||||
}
|
||||
|
||||
return segments
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
package detect
|
||||
package codec
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"encoding/hex"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"net/url"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDecode(t *testing.T) {
|
||||
@@ -66,8 +67,8 @@ func TestDecode(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "b64-url-safe: hyphen url b64",
|
||||
chunk: `dHJ1ZmZsZWhvZz4-ZmluZHMtc2VjcmV0cw`,
|
||||
expected: `trufflehog>>finds-secrets`,
|
||||
chunk: `Z2l0bGVha3M-PmZpbmRzLXNlY3JldHM`,
|
||||
expected: `gitleaks>>finds-secrets`,
|
||||
},
|
||||
{
|
||||
name: "b64-url-safe: underscore url b64",
|
||||
@@ -79,13 +80,49 @@ func TestDecode(t *testing.T) {
|
||||
chunk: `a3d3fa7c2bb99e469ba55e5834ce79ee4853a8a3`,
|
||||
expected: `a3d3fa7c2bb99e469ba55e5834ce79ee4853a8a3`,
|
||||
},
|
||||
{
|
||||
name: "url encoded value",
|
||||
chunk: `secret%3D%22q%24%21%40%23%24%25%5E%26%2A%28%20asdf%22`,
|
||||
expected: `secret="q$!@#$%^&*( asdf"`,
|
||||
},
|
||||
{
|
||||
name: "hex encoded value",
|
||||
chunk: `secret="466973684D617048756E6B79212121363334"`,
|
||||
expected: `secret="FishMapHunky!!!634"`,
|
||||
},
|
||||
}
|
||||
|
||||
decoder := NewDecoder()
|
||||
fullDecode := func(data string) string {
|
||||
segments := []*EncodedSegment{}
|
||||
for {
|
||||
data, segments = decoder.Decode(data, segments)
|
||||
if len(segments) == 0 {
|
||||
return data
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Test value decoding
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
decoded, _ := decoder.decode(tt.chunk, []EncodedSegment{})
|
||||
assert.Equal(t, tt.expected, decoded)
|
||||
assert.Equal(t, tt.expected, fullDecode(tt.chunk))
|
||||
})
|
||||
}
|
||||
|
||||
// Percent encode the values to test percent decoding
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
encodedChunk := url.PathEscape(tt.chunk)
|
||||
assert.Equal(t, tt.expected, fullDecode(encodedChunk))
|
||||
})
|
||||
}
|
||||
|
||||
// Hex encode the values to test hex decoding
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
encodedChunk := hex.EncodeToString([]byte(tt.chunk))
|
||||
assert.Equal(t, tt.expected, fullDecode(encodedChunk))
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package codec
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
// encodingsRe is a regex built by combining all the encoding patterns
|
||||
// into named capture groups so that a single pass can detect multiple
|
||||
// encodings
|
||||
encodingsRe *regexp.Regexp
|
||||
// encodings contains all the encoding configurations for the detector.
|
||||
// The precedence is important. You want more specific encodings to
|
||||
// have a higher precedence or encodings that partially encode the
|
||||
// values (e.g. percent) unlike encodings that fully encode the string
|
||||
// (e.g. base64). If two encoding matches overlap the decoder will use
|
||||
// this order to determine which encoding should wait till the next pass.
|
||||
encodings = []*encoding{
|
||||
&encoding{
|
||||
kind: percentKind,
|
||||
pattern: `%[0-9A-Fa-f]{2}(?:.*%[0-9A-Fa-f]{2})?`,
|
||||
decode: decodePercent,
|
||||
},
|
||||
&encoding{
|
||||
kind: hexKind,
|
||||
pattern: `[0-9A-Fa-f]{32,}`,
|
||||
decode: decodeHex,
|
||||
},
|
||||
&encoding{
|
||||
kind: base64Kind,
|
||||
pattern: `[\w\/+-]{16,}={0,2}`,
|
||||
decode: decodeBase64,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
// encodingNames is used to map the encodingKinds to their name
|
||||
var encodingNames = []string{
|
||||
"percent",
|
||||
"hex",
|
||||
"base64",
|
||||
}
|
||||
|
||||
// encodingKind can be or'd together to capture all of the unique encodings
|
||||
// that were present in a segment
|
||||
type encodingKind int
|
||||
|
||||
var (
|
||||
// make sure these go up by powers of 2
|
||||
percentKind = encodingKind(1)
|
||||
hexKind = encodingKind(2)
|
||||
base64Kind = encodingKind(4)
|
||||
)
|
||||
|
||||
func (e encodingKind) String() string {
|
||||
i := int(math.Log2(float64(e)))
|
||||
if i >= len(encodingNames) {
|
||||
return ""
|
||||
}
|
||||
return encodingNames[i]
|
||||
}
|
||||
|
||||
// kinds returns a list of encodingKinds combined in this one
|
||||
func (e encodingKind) kinds() []encodingKind {
|
||||
kinds := []encodingKind{}
|
||||
|
||||
for i := 0; i < len(encodingNames); i++ {
|
||||
if kind := int(e) & int(math.Pow(2, float64(i))); kind != 0 {
|
||||
kinds = append(kinds, encodingKind(kind))
|
||||
}
|
||||
}
|
||||
|
||||
return kinds
|
||||
}
|
||||
|
||||
// encodingMatch represents a match of an encoding in the text
|
||||
type encodingMatch struct {
|
||||
encoding *encoding
|
||||
startEnd
|
||||
}
|
||||
|
||||
// encoding represent a type of coding supported by the decoder.
|
||||
type encoding struct {
|
||||
// the kind of decoding (e.g. base64, etc)
|
||||
kind encodingKind
|
||||
// the regex pattern that matches the encoding format
|
||||
pattern string
|
||||
// take the match and return the decoded value
|
||||
decode func(string) string
|
||||
// determine which encoding should win out when two overlap
|
||||
precedence int
|
||||
}
|
||||
|
||||
func init() {
|
||||
count := len(encodings)
|
||||
namedPatterns := make([]string, count)
|
||||
for i, encoding := range encodings {
|
||||
encoding.precedence = count - i
|
||||
namedPatterns[i] = fmt.Sprintf(
|
||||
"(?P<%s>%s)",
|
||||
encoding.kind,
|
||||
encoding.pattern,
|
||||
)
|
||||
}
|
||||
encodingsRe = regexp.MustCompile(strings.Join(namedPatterns, "|"))
|
||||
}
|
||||
|
||||
// findEncodingMatches finds as many encodings as it can for this pass
|
||||
func findEncodingMatches(data string) []encodingMatch {
|
||||
var all []encodingMatch
|
||||
for _, matchIndex := range encodingsRe.FindAllStringSubmatchIndex(data, -1) {
|
||||
// Add the encodingMatch with its proper encoding
|
||||
for i, j := 2, 0; i < len(matchIndex); i, j = i+2, j+1 {
|
||||
if matchIndex[i] > -1 {
|
||||
all = append(all, encodingMatch{
|
||||
encoding: encodings[j],
|
||||
startEnd: startEnd{
|
||||
start: matchIndex[i],
|
||||
end: matchIndex[i+1],
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
totalMatches := len(all)
|
||||
if totalMatches == 1 {
|
||||
return all
|
||||
}
|
||||
|
||||
// filter out lower precedence ones that overlap their neigbors
|
||||
filtered := make([]encodingMatch, 0, len(all))
|
||||
for i, m := range all {
|
||||
if i > 0 {
|
||||
prev := all[i-1]
|
||||
if m.overlaps(prev.startEnd) && prev.encoding.precedence > m.encoding.precedence {
|
||||
continue // skip this one
|
||||
}
|
||||
}
|
||||
if i+1 < totalMatches {
|
||||
next := all[i+1]
|
||||
if m.overlaps(next.startEnd) && next.encoding.precedence > m.encoding.precedence {
|
||||
continue // skip this one
|
||||
}
|
||||
}
|
||||
filtered = append(filtered, m)
|
||||
}
|
||||
|
||||
return filtered
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package codec
|
||||
|
||||
// hexMap is a precalculated map of hex nibbles
|
||||
const hexMap = "" +
|
||||
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" +
|
||||
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" +
|
||||
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" +
|
||||
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\xff\xff\xff\xff\xff\xff" +
|
||||
"\xff\x0a\x0b\x0c\x0d\x0e\x0f\xff\xff\xff\xff\xff\xff\xff\xff\xff" +
|
||||
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" +
|
||||
"\xff\x0a\x0b\x0c\x0d\x0e\x0f\xff\xff\xff\xff\xff\xff\xff\xff\xff" +
|
||||
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" +
|
||||
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" +
|
||||
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" +
|
||||
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" +
|
||||
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" +
|
||||
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" +
|
||||
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" +
|
||||
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" +
|
||||
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
|
||||
|
||||
// likelyHexChars is a set of characters that you would expect to find at
|
||||
// least one of in hex encoded data. This risks missing some hex data that
|
||||
// doesn't contain these characters, but gives you the performance gain of not
|
||||
// trying to decode a lot of long symbols in code.
|
||||
var likelyHexChars = make([]bool, 256)
|
||||
|
||||
func init() {
|
||||
for _, c := range `0123456789` {
|
||||
likelyHexChars[c] = true
|
||||
}
|
||||
}
|
||||
|
||||
// decodeHex decodes hex data
|
||||
func decodeHex(encodedValue string) string {
|
||||
size := len(encodedValue)
|
||||
// hex should have two characters per byte
|
||||
if size%2 != 0 {
|
||||
return ""
|
||||
}
|
||||
if !hasByte(encodedValue, likelyHexChars) {
|
||||
return ""
|
||||
}
|
||||
|
||||
decodedValue := make([]byte, size/2)
|
||||
for i := 0; i < size; i += 2 {
|
||||
n1 := hexMap[encodedValue[i]]
|
||||
n2 := hexMap[encodedValue[i+1]]
|
||||
if n1|n2 == '\xff' {
|
||||
return ""
|
||||
}
|
||||
b := byte(n1<<4 | n2)
|
||||
if !printableASCII[b] {
|
||||
return ""
|
||||
}
|
||||
decodedValue[i/2] = b
|
||||
}
|
||||
|
||||
return string(decodedValue)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package codec
|
||||
|
||||
// decodePercent decodes percent encoded strings
|
||||
func decodePercent(encodedValue string) string {
|
||||
encLen := len(encodedValue)
|
||||
decodedValue := make([]byte, encLen)
|
||||
decIndex := 0
|
||||
encIndex := 0
|
||||
|
||||
for encIndex < encLen {
|
||||
if encodedValue[encIndex] == '%' && encIndex+2 < encLen {
|
||||
n1 := hexMap[encodedValue[encIndex+1]]
|
||||
n2 := hexMap[encodedValue[encIndex+2]]
|
||||
// Make sure they're hex characters
|
||||
if n1|n2 != '\xff' {
|
||||
b := byte(n1<<4 | n2)
|
||||
if !printableASCII[b] {
|
||||
return ""
|
||||
}
|
||||
|
||||
decodedValue[decIndex] = b
|
||||
encIndex += 3
|
||||
decIndex += 1
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
decodedValue[decIndex] = encodedValue[encIndex]
|
||||
encIndex += 1
|
||||
decIndex += 1
|
||||
}
|
||||
|
||||
return string(decodedValue[:decIndex])
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package codec
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// EncodedSegment represents a portion of text that is encoded in some way.
|
||||
type EncodedSegment struct {
|
||||
// predecessors are all of the segments from the previous decoding pass
|
||||
predecessors []*EncodedSegment
|
||||
|
||||
// original start/end indices before decoding
|
||||
original startEnd
|
||||
|
||||
// encoded start/end indices relative to the previous decoding pass.
|
||||
// If it's a top level segment, original and encoded will be the
|
||||
// same.
|
||||
encoded startEnd
|
||||
|
||||
// decoded start/end indices in this pass after decoding
|
||||
decoded startEnd
|
||||
|
||||
// decodedValue contains the decoded string for this segment
|
||||
decodedValue string
|
||||
|
||||
// encodings is the encodings that make up this segment. encodingKind
|
||||
// can be or'd together to hold multiple encodings
|
||||
encodings encodingKind
|
||||
|
||||
// depth is how many decoding passes it took to decode this segment
|
||||
depth int
|
||||
}
|
||||
|
||||
// Tags returns additional meta data tags related to the types of segments
|
||||
func Tags(segments []*EncodedSegment) []string {
|
||||
// Return an empty list if we don't have any segments
|
||||
if len(segments) == 0 {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
// Since decoding is done in passes, the depth of all the segments
|
||||
// should be the same
|
||||
depth := segments[0].depth
|
||||
|
||||
// Collect the encodings from the segments
|
||||
encodings := segments[0].encodings
|
||||
for i := 1; i < len(segments); i++ {
|
||||
encodings |= segments[i].encodings
|
||||
}
|
||||
|
||||
kinds := encodings.kinds()
|
||||
tags := make([]string, len(kinds)+1)
|
||||
|
||||
tags[len(tags)-1] = fmt.Sprintf("decode-depth:%d", depth)
|
||||
for i, kind := range kinds {
|
||||
tags[i] = fmt.Sprintf("decoded:%s", kind)
|
||||
}
|
||||
|
||||
return tags
|
||||
}
|
||||
|
||||
// CurrentLine returns from the start of the line containing the segments
|
||||
// to the end of the line where the segment ends.
|
||||
func CurrentLine(segments []*EncodedSegment, currentRaw string) string {
|
||||
// Return the whole thing if no segments are provided
|
||||
if len(segments) == 0 {
|
||||
return currentRaw
|
||||
}
|
||||
|
||||
start := 0
|
||||
end := len(currentRaw)
|
||||
|
||||
// Merge the ranges together into a single decoded value
|
||||
decoded := segments[0].decoded
|
||||
for i := 1; i < len(segments); i++ {
|
||||
decoded = decoded.merge(segments[i].decoded)
|
||||
}
|
||||
|
||||
// Find the start of the range
|
||||
for i := decoded.start; i > -1; i-- {
|
||||
c := currentRaw[i]
|
||||
if c == '\n' {
|
||||
start = i
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Find the end of the range
|
||||
for i := decoded.end; i < end; i++ {
|
||||
c := currentRaw[i]
|
||||
if c == '\n' {
|
||||
end = i
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return currentRaw[start:end]
|
||||
}
|
||||
|
||||
// AdjustMatchIndex maps a match index from the current decode pass back to
|
||||
// its location in the original text
|
||||
func AdjustMatchIndex(segments []*EncodedSegment, matchIndex []int) []int {
|
||||
// Don't adjust if we're not provided any segments
|
||||
if len(segments) == 0 {
|
||||
return matchIndex
|
||||
}
|
||||
|
||||
// Map the match to the location in the original text
|
||||
match := startEnd{matchIndex[0], matchIndex[1]}
|
||||
|
||||
// Map the match to its orignal location
|
||||
adjusted := toOriginal(segments, match)
|
||||
|
||||
// Return the adjusted match index
|
||||
return []int{
|
||||
adjusted.start,
|
||||
adjusted.end,
|
||||
}
|
||||
}
|
||||
|
||||
// SegmentsWithDecodedOverlap the segments where the start and end overlap its
|
||||
// decoded range
|
||||
func SegmentsWithDecodedOverlap(segments []*EncodedSegment, start, end int) []*EncodedSegment {
|
||||
se := startEnd{start, end}
|
||||
overlaps := []*EncodedSegment{}
|
||||
|
||||
for _, segment := range segments {
|
||||
if segment.decoded.overlaps(se) {
|
||||
overlaps = append(overlaps, segment)
|
||||
}
|
||||
}
|
||||
|
||||
return overlaps
|
||||
}
|
||||
|
||||
// toOriginal maps a start/end to its start/end in the original text
|
||||
// the provided start/end should be relative to the segment's decoded value
|
||||
func toOriginal(predecessors []*EncodedSegment, decoded startEnd) startEnd {
|
||||
if len(predecessors) == 0 {
|
||||
return decoded
|
||||
}
|
||||
|
||||
// Map the decoded value one level up where it was encoded
|
||||
encoded := startEnd{}
|
||||
|
||||
for _, p := range predecessors {
|
||||
if !p.decoded.overlaps(decoded) {
|
||||
continue // Not in scope
|
||||
}
|
||||
|
||||
// If fully contained, return the segments original start/end
|
||||
if p.decoded.contains(decoded) {
|
||||
return p.original
|
||||
}
|
||||
|
||||
// Map the value to be relative to the predecessors's decoded values
|
||||
if encoded.end == 0 {
|
||||
encoded = p.encoded.add(p.decoded.overflow(decoded))
|
||||
} else {
|
||||
encoded = encoded.merge(p.encoded.add(p.decoded.overflow(decoded)))
|
||||
}
|
||||
}
|
||||
|
||||
// Should only get here if the thing passed in wasn't in a decoded
|
||||
// value. This shouldn't be the case
|
||||
if encoded.end == 0 {
|
||||
return decoded
|
||||
}
|
||||
|
||||
// Climb up another level
|
||||
// (NOTE: each segment references all the predecessors)
|
||||
return toOriginal(predecessors[0].predecessors, encoded)
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package codec
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// startEnd represents the start and end of some data. It mainly exists as a
|
||||
// helper when referencing the values
|
||||
type startEnd struct {
|
||||
start int
|
||||
end int
|
||||
}
|
||||
|
||||
// sub subtracts the values of two startEnds
|
||||
func (s startEnd) sub(o startEnd) startEnd {
|
||||
return startEnd{
|
||||
s.start - o.start,
|
||||
s.end - o.end,
|
||||
}
|
||||
}
|
||||
|
||||
// add adds the values of two startEnds
|
||||
func (s startEnd) add(o startEnd) startEnd {
|
||||
return startEnd{
|
||||
s.start + o.start,
|
||||
s.end + o.end,
|
||||
}
|
||||
}
|
||||
|
||||
// overlaps returns true if two startEnds overlap
|
||||
func (s startEnd) overlaps(o startEnd) bool {
|
||||
return o.start <= s.end && o.end >= s.start
|
||||
}
|
||||
|
||||
// contains returns true if the other is fully contained within this one
|
||||
func (s startEnd) contains(o startEnd) bool {
|
||||
return s.start <= o.start && o.end <= s.end
|
||||
}
|
||||
|
||||
// overflow returns a startEnd that tells how much the other goes outside the
|
||||
// bounds of this one
|
||||
func (s startEnd) overflow(o startEnd) startEnd {
|
||||
return s.merge(o).sub(s)
|
||||
}
|
||||
|
||||
// merge takes two start/ends and returns a single one that encompases both
|
||||
func (s startEnd) merge(o startEnd) startEnd {
|
||||
return startEnd{
|
||||
min(s.start, o.start),
|
||||
max(s.end, o.end),
|
||||
}
|
||||
}
|
||||
|
||||
// String returns a string representation for clearer debugging
|
||||
func (s startEnd) String() string {
|
||||
return fmt.Sprintf("[%d,%d]", s.start, s.end)
|
||||
}
|
||||
@@ -1,306 +0,0 @@
|
||||
package detect
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"unicode"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/logging"
|
||||
)
|
||||
|
||||
var b64LikelyChars [128]byte
|
||||
var b64Regexp = regexp.MustCompile(`[\w/+-]{16,}={0,3}`)
|
||||
var decoders = []func(string) ([]byte, error){
|
||||
base64.StdEncoding.DecodeString,
|
||||
base64.RawURLEncoding.DecodeString,
|
||||
}
|
||||
|
||||
func init() {
|
||||
// Basically look for anything that isn't just letters
|
||||
for _, c := range `0123456789+/-_` {
|
||||
b64LikelyChars[c] = 1
|
||||
}
|
||||
}
|
||||
|
||||
// EncodedSegment represents a portion of text that is encoded in some way.
|
||||
// `decode` supports recusive decoding and can result in "segment trees".
|
||||
// There can be multiple segments in the original text, so each can be thought
|
||||
// of as its own tree with the root being the original segment.
|
||||
type EncodedSegment struct {
|
||||
// The parent segment in a segment tree. If nil, it is a root segment
|
||||
parent *EncodedSegment
|
||||
|
||||
// Relative start/end are the bounds of the encoded value in the current pass.
|
||||
relativeStart int
|
||||
relativeEnd int
|
||||
|
||||
// Absolute start/end refer to the bounds of the root segment in this segment
|
||||
// tree
|
||||
absoluteStart int
|
||||
absoluteEnd int
|
||||
|
||||
// Decoded start/end refer to the bounds of the decoded value in the current
|
||||
// pass. These can differ from relative values because decoding can shrink
|
||||
// or grow the size of the segment.
|
||||
decodedStart int
|
||||
decodedEnd int
|
||||
|
||||
// This is the actual decoded content in the segment
|
||||
decodedValue string
|
||||
|
||||
// This is the type of encoding
|
||||
encoding string
|
||||
}
|
||||
|
||||
// isChildOf inspects the bounds of two segments to determine
|
||||
// if one should be the child of another
|
||||
func (s EncodedSegment) isChildOf(parent EncodedSegment) bool {
|
||||
return parent.decodedStart <= s.relativeStart && parent.decodedEnd >= s.relativeEnd
|
||||
}
|
||||
|
||||
// decodedOverlaps checks if the decoded bounds of the segment overlaps a range
|
||||
func (s EncodedSegment) decodedOverlaps(start, end int) bool {
|
||||
return start <= s.decodedEnd && end >= s.decodedStart
|
||||
}
|
||||
|
||||
// adjustMatchIndex takes the matchIndex from the current decoding pass and
|
||||
// updates it to match the absolute matchIndex in the original text.
|
||||
func (s EncodedSegment) adjustMatchIndex(matchIndex []int) []int {
|
||||
// The match is within the bounds of the segment so we just return
|
||||
// the absolute start and end of the root segment.
|
||||
if s.decodedStart <= matchIndex[0] && matchIndex[1] <= s.decodedEnd {
|
||||
return []int{
|
||||
s.absoluteStart,
|
||||
s.absoluteEnd,
|
||||
}
|
||||
}
|
||||
|
||||
// Since it overlaps one side and/or the other, we're going to have to adjust
|
||||
// and climb parents until we're either at the root or we've determined
|
||||
// we're fully inside one of the parent segments.
|
||||
adjustedMatchIndex := make([]int, 2)
|
||||
|
||||
if matchIndex[0] < s.decodedStart {
|
||||
// It starts before the encoded segment so adjust the start to match
|
||||
// the location before it was decoded
|
||||
matchStartDelta := s.decodedStart - matchIndex[0]
|
||||
adjustedMatchIndex[0] = s.relativeStart - matchStartDelta
|
||||
} else {
|
||||
// It starts within the encoded segment so set the bound to the
|
||||
// relative start
|
||||
adjustedMatchIndex[0] = s.relativeStart
|
||||
}
|
||||
|
||||
if matchIndex[1] > s.decodedEnd {
|
||||
// It ends after the encoded segment so adjust the end to match
|
||||
// the location before it was decoded
|
||||
matchEndDelta := matchIndex[1] - s.decodedEnd
|
||||
adjustedMatchIndex[1] = s.relativeEnd + matchEndDelta
|
||||
} else {
|
||||
// It ends within the encoded segment so set the bound to the relative end
|
||||
adjustedMatchIndex[1] = s.relativeEnd
|
||||
}
|
||||
|
||||
// We're still not at a root segment so we'll need to keep on adjusting
|
||||
if s.parent != nil {
|
||||
return s.parent.adjustMatchIndex(adjustedMatchIndex)
|
||||
}
|
||||
|
||||
return adjustedMatchIndex
|
||||
}
|
||||
|
||||
// depth reports how many levels of decoding needed to be done (default is 1)
|
||||
func (s EncodedSegment) depth() int {
|
||||
depth := 1
|
||||
|
||||
// Climb the tree and increment the depth
|
||||
for current := &s; current.parent != nil; current = current.parent {
|
||||
depth++
|
||||
}
|
||||
|
||||
return depth
|
||||
}
|
||||
|
||||
// tags returns additional meta data tags related to the types of segments
|
||||
func (s EncodedSegment) tags() []string {
|
||||
return []string{
|
||||
fmt.Sprintf("decoded:%s", s.encoding),
|
||||
fmt.Sprintf("decode-depth:%d", s.depth()),
|
||||
}
|
||||
}
|
||||
|
||||
// Decoder decodes various types of data in place
|
||||
type Decoder struct {
|
||||
decodedMap map[string]string
|
||||
}
|
||||
|
||||
// NewDecoder creates a default decoder struct
|
||||
func NewDecoder() *Decoder {
|
||||
return &Decoder{
|
||||
decodedMap: make(map[string]string),
|
||||
}
|
||||
}
|
||||
|
||||
// decode returns the data with the values decoded in-place
|
||||
func (d *Decoder) decode(data string, parentSegments []EncodedSegment) (string, []EncodedSegment) {
|
||||
segments := d.findEncodedSegments(data, parentSegments)
|
||||
|
||||
if len(segments) > 0 {
|
||||
result := bytes.NewBuffer(make([]byte, 0, len(data)))
|
||||
|
||||
relativeStart := 0
|
||||
for _, segment := range segments {
|
||||
result.WriteString(data[relativeStart:segment.relativeStart])
|
||||
result.WriteString(segment.decodedValue)
|
||||
relativeStart = segment.relativeEnd
|
||||
}
|
||||
result.WriteString(data[relativeStart:])
|
||||
|
||||
return result.String(), segments
|
||||
}
|
||||
|
||||
return data, segments
|
||||
}
|
||||
|
||||
// findEncodedSegments finds the encoded segments in the data and updates the
|
||||
// segment tree for this pass
|
||||
func (d *Decoder) findEncodedSegments(data string, parentSegments []EncodedSegment) []EncodedSegment {
|
||||
if len(data) == 0 {
|
||||
return []EncodedSegment{}
|
||||
}
|
||||
|
||||
matchIndices := b64Regexp.FindAllStringIndex(data, -1)
|
||||
if matchIndices == nil {
|
||||
return []EncodedSegment{}
|
||||
}
|
||||
|
||||
segments := make([]EncodedSegment, 0, len(matchIndices))
|
||||
|
||||
// Keeps up with offsets from the text changing size as things are decoded
|
||||
decodedShift := 0
|
||||
|
||||
for _, matchIndex := range matchIndices {
|
||||
encodedValue := data[matchIndex[0]:matchIndex[1]]
|
||||
|
||||
if !isLikelyB64(encodedValue) {
|
||||
d.decodedMap[encodedValue] = ""
|
||||
continue
|
||||
}
|
||||
|
||||
decodedValue, alreadyDecoded := d.decodedMap[encodedValue]
|
||||
|
||||
// We haven't decoded this yet, so go ahead and decode it
|
||||
if !alreadyDecoded {
|
||||
decodedValue = decodeValue(encodedValue)
|
||||
d.decodedMap[encodedValue] = decodedValue
|
||||
}
|
||||
|
||||
// Skip this segment because there was nothing to check
|
||||
if len(decodedValue) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
// Create a segment for the encoded data
|
||||
segment := EncodedSegment{
|
||||
relativeStart: matchIndex[0],
|
||||
relativeEnd: matchIndex[1],
|
||||
absoluteStart: matchIndex[0],
|
||||
absoluteEnd: matchIndex[1],
|
||||
decodedStart: matchIndex[0] + decodedShift,
|
||||
decodedEnd: matchIndex[0] + decodedShift + len(decodedValue),
|
||||
decodedValue: decodedValue,
|
||||
encoding: "base64",
|
||||
}
|
||||
|
||||
// Shift decoded start and ends based on size changes
|
||||
decodedShift += len(decodedValue) - len(encodedValue)
|
||||
|
||||
// Adjust the absolute position of segments contained in parent segments
|
||||
for _, parentSegment := range parentSegments {
|
||||
if segment.isChildOf(parentSegment) {
|
||||
segment.absoluteStart = parentSegment.absoluteStart
|
||||
segment.absoluteEnd = parentSegment.absoluteEnd
|
||||
segment.parent = &parentSegment
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
logging.Debug().Msgf("segment found: %#v", segment)
|
||||
segments = append(segments, segment)
|
||||
}
|
||||
|
||||
return segments
|
||||
}
|
||||
|
||||
// decoders tries a list of decoders and returns the first successful one
|
||||
func decodeValue(encodedValue string) string {
|
||||
for _, decoder := range decoders {
|
||||
decodedValue, err := decoder(encodedValue)
|
||||
|
||||
if err == nil && len(decodedValue) > 0 && isASCII(decodedValue) {
|
||||
return string(decodedValue)
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
func isASCII(b []byte) bool {
|
||||
for i := 0; i < len(b); i++ {
|
||||
if b[i] > unicode.MaxASCII || b[i] < '\t' {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Skip a lot of method signatures and things at the risk of missing about
|
||||
// 1% of base64
|
||||
func isLikelyB64(s string) bool {
|
||||
for _, c := range s {
|
||||
if b64LikelyChars[c] != 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// Find a segment where the decoded bounds overlaps a range
|
||||
func segmentWithDecodedOverlap(encodedSegments []EncodedSegment, start, end int) *EncodedSegment {
|
||||
for _, segment := range encodedSegments {
|
||||
if segment.decodedOverlaps(start, end) {
|
||||
return &segment
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s EncodedSegment) currentLine(currentRaw string) string {
|
||||
start := 0
|
||||
end := len(currentRaw)
|
||||
|
||||
// Find the start of the range
|
||||
for i := s.decodedStart; i > -1; i-- {
|
||||
c := currentRaw[i]
|
||||
if c == '\n' {
|
||||
start = i
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Find the end of the range
|
||||
for i := s.decodedEnd; i < end; i++ {
|
||||
c := currentRaw[i]
|
||||
if c == '\n' {
|
||||
end = i
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return currentRaw[start:end]
|
||||
}
|
||||
+33
-32
@@ -9,8 +9,10 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"github.com/zricethezav/gitleaks/v8/detect/codec"
|
||||
"github.com/zricethezav/gitleaks/v8/logging"
|
||||
"github.com/zricethezav/gitleaks/v8/regexp"
|
||||
"github.com/zricethezav/gitleaks/v8/report"
|
||||
@@ -25,13 +27,26 @@ import (
|
||||
const (
|
||||
gitleaksAllowSignature = "gitleaks:allow"
|
||||
chunkSize = 100 * 1_000 // 100kb
|
||||
|
||||
// SlowWarningThreshold is the amount of time to wait before logging that a file is slow.
|
||||
// This is useful for identifying problematic files and tuning the allowlist.
|
||||
SlowWarningThreshold = 5 * time.Second
|
||||
)
|
||||
|
||||
var (
|
||||
newLineRegexp = regexp.MustCompile("\n")
|
||||
isWindows = runtime.GOOS == "windows"
|
||||
tmpDir string
|
||||
)
|
||||
|
||||
func init() {
|
||||
var err error
|
||||
tmpDir, err = os.MkdirTemp("", "gitleaks-*")
|
||||
if err != nil {
|
||||
logging.Fatal().Err(err).Msg("failed to create temp dir for archive extraction")
|
||||
}
|
||||
}
|
||||
|
||||
// Detector is the main detector struct
|
||||
type Detector struct {
|
||||
// Config is the configuration for the detector
|
||||
@@ -96,27 +111,12 @@ type Detector struct {
|
||||
TotalBytes atomic.Uint64
|
||||
}
|
||||
|
||||
// Fragment contains the data to be scanned
|
||||
type Fragment struct {
|
||||
// Raw is the raw content of the fragment
|
||||
Raw string
|
||||
|
||||
Bytes []byte
|
||||
|
||||
// FilePath is the path to the file, if applicable.
|
||||
// The path separator MUST be normalized to `/`.
|
||||
FilePath string
|
||||
SymlinkFile string
|
||||
// WindowsFilePath is the path with the original separator.
|
||||
// This provides a backwards-compatible solution to https://github.com/gitleaks/gitleaks/issues/1565.
|
||||
WindowsFilePath string `json:"-"` // TODO: remove this in v9.
|
||||
|
||||
// CommitSHA is the SHA of the commit if applicable
|
||||
CommitSHA string
|
||||
|
||||
// newlineIndices is a list of indices of newlines in the raw content.
|
||||
// This is used to calculate the line location of a finding
|
||||
newlineIndices [][]int
|
||||
func (d *Detector) Cleanup() {
|
||||
if tmpDir != "" {
|
||||
if err := os.RemoveAll(tmpDir); err != nil {
|
||||
logging.Warn().Err(err).Msg("failed to remove temp dir for archive extraction")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewDetector creates a new detector with the given config
|
||||
@@ -242,9 +242,9 @@ func (d *Detector) Detect(fragment Fragment) []report.Finding {
|
||||
|
||||
// setup variables to handle different decoding passes
|
||||
currentRaw := fragment.Raw
|
||||
encodedSegments := []EncodedSegment{}
|
||||
encodedSegments := []*codec.EncodedSegment{}
|
||||
currentDecodeDepth := 0
|
||||
decoder := NewDecoder()
|
||||
decoder := codec.NewDecoder()
|
||||
|
||||
for {
|
||||
// build keyword map for prefiltering rules
|
||||
@@ -281,7 +281,7 @@ func (d *Detector) Detect(fragment Fragment) []report.Finding {
|
||||
}
|
||||
|
||||
// decode the currentRaw for the next pass
|
||||
currentRaw, encodedSegments = decoder.decode(currentRaw, encodedSegments)
|
||||
currentRaw, encodedSegments = decoder.Decode(currentRaw, encodedSegments)
|
||||
|
||||
// stop the loop when there's nothing else to decode
|
||||
if len(encodedSegments) == 0 {
|
||||
@@ -293,7 +293,7 @@ func (d *Detector) Detect(fragment Fragment) []report.Finding {
|
||||
}
|
||||
|
||||
// detectRule scans the given fragment for the given rule and returns a list of findings
|
||||
func (d *Detector) detectRule(fragment Fragment, currentRaw string, r config.Rule, encodedSegments []EncodedSegment) []report.Finding {
|
||||
func (d *Detector) detectRule(fragment Fragment, currentRaw string, r config.Rule, encodedSegments []*codec.EncodedSegment) []report.Finding {
|
||||
var (
|
||||
findings []report.Finding
|
||||
logger = func() zerolog.Logger {
|
||||
@@ -365,14 +365,15 @@ func (d *Detector) detectRule(fragment Fragment, currentRaw string, r config.Rul
|
||||
// Check if the decoded portions of the segment overlap with the match
|
||||
// to see if its potentially a new match
|
||||
if len(encodedSegments) > 0 {
|
||||
if segment := segmentWithDecodedOverlap(encodedSegments, matchIndex[0], matchIndex[1]); segment != nil {
|
||||
matchIndex = segment.adjustMatchIndex(matchIndex)
|
||||
metaTags = append(metaTags, segment.tags()...)
|
||||
currentLine = segment.currentLine(currentRaw)
|
||||
} else {
|
||||
segments := codec.SegmentsWithDecodedOverlap(encodedSegments, matchIndex[0], matchIndex[1])
|
||||
if len(segments) == 0 {
|
||||
// This item has already been added to a finding
|
||||
continue
|
||||
}
|
||||
|
||||
matchIndex = codec.AdjustMatchIndex(segments, matchIndex)
|
||||
metaTags = append(metaTags, codec.Tags(segments)...)
|
||||
currentLine = codec.CurrentLine(segments, currentRaw)
|
||||
} else {
|
||||
// Fixes: https://github.com/gitleaks/gitleaks/issues/1352
|
||||
// removes the incorrectly following line that was detected by regex expression '\n'
|
||||
@@ -547,10 +548,10 @@ func checkCommitOrPathAllowed(
|
||||
}
|
||||
// These will be checked later.
|
||||
if len(a.Regexes) > 0 {
|
||||
return false, nil
|
||||
continue
|
||||
}
|
||||
if len(a.StopWords) > 0 {
|
||||
return false, nil
|
||||
continue
|
||||
}
|
||||
|
||||
isAllowed = allTrue(allowlistChecks)
|
||||
|
||||
+267
-49
@@ -17,6 +17,7 @@ import (
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/scm"
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
"github.com/zricethezav/gitleaks/v8/detect/codec"
|
||||
"github.com/zricethezav/gitleaks/v8/logging"
|
||||
"github.com/zricethezav/gitleaks/v8/regexp"
|
||||
"github.com/zricethezav/gitleaks/v8/report"
|
||||
@@ -26,7 +27,7 @@ import (
|
||||
const maxDecodeDepth = 8
|
||||
const configPath = "../testdata/config/"
|
||||
const repoBasePath = "../testdata/repos/"
|
||||
const b64TestValues = `
|
||||
const encodedTestValues = `
|
||||
# Decoded
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
135f/bRUBHrbHqLY/xS3I7Oth+8rgG+0tBwfMcbk05Sgxq6QUzSYIQAop+WvsTwk2sR+C38g0Mnb
|
||||
@@ -44,12 +45,43 @@ eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwiY29uZmlnIjoiVzJ
|
||||
c21hbGwtc2VjcmV0
|
||||
|
||||
# This tests how it handles when the match bounds go outside the decoded value
|
||||
secret=ZGVjb2RlZC1zZWNyZXQtdmFsdWU=
|
||||
secret=ZGVjb2RlZC1zZWNyZXQtdmFsdWUwMA==
|
||||
# The above encoded again
|
||||
c2VjcmV0PVpHVmpiMlJsWkMxelpXTnlaWFF0ZG1Gc2RXVT0=
|
||||
|
||||
# Confirm you can ignore on the decoded value
|
||||
password="bFJxQkstejVrZjQtcGxlYXNlLWlnbm9yZS1tZS1YLVhJSk0yUGRkdw=="
|
||||
|
||||
# This tests that it can do hex encoded data
|
||||
secret=6465636F6465642D7365637265742D76616C756576484558
|
||||
|
||||
# This tests that it can do percent encoded data
|
||||
## partial encoded data
|
||||
secret=decoded-%73%65%63%72%65%74-valuev2
|
||||
## scattered encoded
|
||||
secret=%64%65coded-%73%65%63%72%65%74-valuev3
|
||||
|
||||
# Test multi levels of encoding where the source is a partal encoding
|
||||
# it is important that the bounds of the predecessors are properly
|
||||
# considered
|
||||
## single percent encoding in the middle of multi layer b64
|
||||
c2VjcmV0PVpHVmpiMl%4AsWkMxelpXTnlaWFF0ZG1Gc2RXVjJOQT09
|
||||
## single percent encoding at the beginning of hex
|
||||
secret%3d6465636F6465642D7365637265742D76616C75657635
|
||||
## multiple percent encodings in a single layer base64
|
||||
secret=ZGVjb2%52lZC1zZWNyZXQtdm%46sdWV4ODY= # ends in x86
|
||||
## base64 encoded partially percent encoded value
|
||||
secret=ZGVjb2RlZC0lNzMlNjUlNjMlNzIlNjUlNzQtdmFsdWU=
|
||||
## one of the lines above that went through... a lot
|
||||
## and there's surrounding text around it
|
||||
Look at this value: %4EjMzMjU2NkE2MzZENTYzMDUwNTY3MDQ4%4eTY2RDcwNjk0RDY5NTUzMTRENkQ3ODYx%25%34%65TE3QTQ2MzY1NzZDNjQ0RjY1NTY3MDU5NTU1ODUyNkI2MjUzNTUzMDRFNkU0RTZCNTYzMTU1MzkwQQ== # isn't it crazy?
|
||||
## Multi percent encode two random characters close to the bounds of the base64
|
||||
## encoded data to make sure that the bounds are still correctly calculated
|
||||
secret=ZG%25%32%35%25%33%32%25%33%35%25%32%35%25%33%33%25%33%35%25%32%35%25%33%33%25%33%36%25%32%35%25%33%32%25%33%35%25%32%35%25%33%33%25%33%36%25%32%35%25%33%36%25%33%31%25%32%35%25%33%32%25%33%35%25%32%35%25%33%33%25%33%36%25%32%35%25%33%33%25%33%322RlZC1zZWNyZXQtd%25%36%64%25%34%36%25%37%33dWU=
|
||||
## The similar to the above but also touching the edge of the base64
|
||||
secret=%25%35%61%25%34%37%25%35%36jb2RlZC1zZWNyZXQtdmFsdWU%25%32%35%25%33%33%25%36%34
|
||||
## The similar to the above but also touching and overlapping the base64
|
||||
secret%3D%25%35%61%25%34%37%25%35%36jb2RlZC1zZWNyZXQtdmFsdWU%25%32%35%25%33%33%25%36%34
|
||||
`
|
||||
|
||||
func TestDetect(t *testing.T) {
|
||||
@@ -376,6 +408,13 @@ const token = "mockSecret";
|
||||
FilePath: "tmp.go",
|
||||
},
|
||||
},
|
||||
"allowlist - ignore path when extending": {
|
||||
cfgName: "valid/allowlist_rule_extend_default",
|
||||
fragment: Fragment{
|
||||
Raw: `token = "aebfab88-7596-481d-82e8-c60c8f7de0c0"`,
|
||||
FilePath: "path/to/your/problematic/file.js",
|
||||
},
|
||||
},
|
||||
"allowlist - ignore regex": {
|
||||
cfgName: "valid/allowlist_rule_regex",
|
||||
fragment: Fragment{
|
||||
@@ -383,12 +422,11 @@ const token = "mockSecret";
|
||||
FilePath: "tmp.go",
|
||||
},
|
||||
},
|
||||
|
||||
// Base64-decoding
|
||||
"detect base64": {
|
||||
cfgName: "base64_encoded",
|
||||
// Decoding
|
||||
"detect encoded": {
|
||||
cfgName: "encoded",
|
||||
fragment: Fragment{
|
||||
Raw: b64TestValues,
|
||||
Raw: encodedTestValues,
|
||||
FilePath: "tmp.go",
|
||||
},
|
||||
expectedFindings: []report.Finding{
|
||||
@@ -434,6 +472,90 @@ const token = "mockSecret";
|
||||
EndColumn: 207,
|
||||
Entropy: 5.350665,
|
||||
},
|
||||
{ // Encoded Small secret at the end to make sure it's picked up by the decoding
|
||||
Description: "Small Secret",
|
||||
Secret: "small-secret",
|
||||
Match: "small-secret",
|
||||
File: "tmp.go",
|
||||
Line: "\nc21hbGwtc2VjcmV0",
|
||||
RuleID: "small-secret",
|
||||
Tags: []string{"small", "secret", "decoded:base64", "decode-depth:1"},
|
||||
StartLine: 15,
|
||||
EndLine: 15,
|
||||
StartColumn: 2,
|
||||
EndColumn: 17,
|
||||
Entropy: 3.0849626,
|
||||
},
|
||||
{ // Secret where the decoded match goes outside the encoded value
|
||||
Description: "Overlapping",
|
||||
Secret: "decoded-secret-value00",
|
||||
Match: "secret=decoded-secret-value00",
|
||||
File: "tmp.go",
|
||||
Line: "\nsecret=ZGVjb2RlZC1zZWNyZXQtdmFsdWUwMA==",
|
||||
RuleID: "overlapping",
|
||||
Tags: []string{"overlapping", "decoded:base64", "decode-depth:1"},
|
||||
StartLine: 18,
|
||||
EndLine: 18,
|
||||
StartColumn: 2,
|
||||
EndColumn: 40,
|
||||
Entropy: 3.4428623,
|
||||
},
|
||||
{ // This just confirms that with no allowlist the pattern is detected (i.e. the regex is good)
|
||||
Description: "Make sure this would be detected with no allowlist",
|
||||
Secret: "lRqBK-z5kf4-please-ignore-me-X-XIJM2Pddw",
|
||||
Match: "password=\"lRqBK-z5kf4-please-ignore-me-X-XIJM2Pddw\"",
|
||||
File: "tmp.go",
|
||||
Line: "\npassword=\"bFJxQkstejVrZjQtcGxlYXNlLWlnbm9yZS1tZS1YLVhJSk0yUGRkdw==\"",
|
||||
RuleID: "decoded-password-dont-ignore",
|
||||
Tags: []string{"decode-ignore", "decoded:base64", "decode-depth:1"},
|
||||
StartLine: 23,
|
||||
EndLine: 23,
|
||||
StartColumn: 2,
|
||||
EndColumn: 68,
|
||||
Entropy: 4.5841837,
|
||||
},
|
||||
{ // Hex encoded data check
|
||||
Description: "Overlapping",
|
||||
Secret: "decoded-secret-valuevHEX",
|
||||
Match: "secret=decoded-secret-valuevHEX",
|
||||
File: "tmp.go",
|
||||
Line: "\nsecret=6465636F6465642D7365637265742D76616C756576484558",
|
||||
RuleID: "overlapping",
|
||||
Tags: []string{"overlapping", "decoded:hex", "decode-depth:1"},
|
||||
StartLine: 26,
|
||||
EndLine: 26,
|
||||
StartColumn: 2,
|
||||
EndColumn: 56,
|
||||
Entropy: 3.6531072,
|
||||
},
|
||||
{ // handle partial encoded percent data
|
||||
Description: "Overlapping",
|
||||
Secret: "decoded-secret-valuev2",
|
||||
Match: "secret=decoded-secret-valuev2",
|
||||
File: "tmp.go",
|
||||
Line: "\nsecret=decoded-%73%65%63%72%65%74-valuev2",
|
||||
RuleID: "overlapping",
|
||||
Tags: []string{"overlapping", "decoded:percent", "decode-depth:1"},
|
||||
StartLine: 30,
|
||||
EndLine: 30,
|
||||
StartColumn: 2,
|
||||
EndColumn: 42,
|
||||
Entropy: 3.4428623,
|
||||
},
|
||||
{ // handle partial encoded percent data
|
||||
Description: "Overlapping",
|
||||
Secret: "decoded-secret-valuev3",
|
||||
Match: "secret=decoded-secret-valuev3",
|
||||
File: "tmp.go",
|
||||
Line: "\nsecret=%64%65coded-%73%65%63%72%65%74-valuev3",
|
||||
RuleID: "overlapping",
|
||||
Tags: []string{"overlapping", "decoded:percent", "decode-depth:1"},
|
||||
StartLine: 32,
|
||||
EndLine: 32,
|
||||
StartColumn: 2,
|
||||
EndColumn: 46,
|
||||
Entropy: 3.4428623,
|
||||
},
|
||||
{ // Encoded AWS config with a access key id inside a JWT
|
||||
Description: "AWS IAM Unique Identifier",
|
||||
Secret: "ASIAIOSFODNN7LXM10JI",
|
||||
@@ -462,34 +584,6 @@ const token = "mockSecret";
|
||||
EndColumn: 344,
|
||||
Entropy: 4.721928,
|
||||
},
|
||||
{ // Encoded Small secret at the end to make sure it's picked up by the decoding
|
||||
Description: "Small Secret",
|
||||
Secret: "small-secret",
|
||||
Match: "small-secret",
|
||||
File: "tmp.go",
|
||||
Line: "\nc21hbGwtc2VjcmV0",
|
||||
RuleID: "small-secret",
|
||||
Tags: []string{"small", "secret", "decoded:base64", "decode-depth:1"},
|
||||
StartLine: 15,
|
||||
EndLine: 15,
|
||||
StartColumn: 2,
|
||||
EndColumn: 17,
|
||||
Entropy: 3.0849626,
|
||||
},
|
||||
{ // Secret where the decoded match goes outside the encoded value
|
||||
Description: "Overlapping",
|
||||
Secret: "decoded-secret-value",
|
||||
Match: "secret=decoded-secret-value",
|
||||
File: "tmp.go",
|
||||
Line: "\nsecret=ZGVjb2RlZC1zZWNyZXQtdmFsdWU=",
|
||||
RuleID: "overlapping",
|
||||
Tags: []string{"overlapping", "decoded:base64", "decode-depth:1"},
|
||||
StartLine: 18,
|
||||
EndLine: 18,
|
||||
StartColumn: 2,
|
||||
EndColumn: 36,
|
||||
Entropy: 3.3037016,
|
||||
},
|
||||
{ // Secret where the decoded match goes outside the encoded value and then encoded again
|
||||
Description: "Overlapping",
|
||||
Secret: "decoded-secret-value",
|
||||
@@ -504,19 +598,117 @@ const token = "mockSecret";
|
||||
EndColumn: 49,
|
||||
Entropy: 3.3037016,
|
||||
},
|
||||
{ // This just confirms that with no allowlist the pattern is detected (i.e. the regex is good)
|
||||
Description: "Make sure this would be detected with no allowlist",
|
||||
Secret: "lRqBK-z5kf4-please-ignore-me-X-XIJM2Pddw",
|
||||
Match: "password=\"lRqBK-z5kf4-please-ignore-me-X-XIJM2Pddw\"",
|
||||
{ // handle encodings that touch eachother
|
||||
Description: "Overlapping",
|
||||
Secret: "decoded-secret-valuev5",
|
||||
Match: "secret=decoded-secret-valuev5",
|
||||
File: "tmp.go",
|
||||
Line: "\npassword=\"bFJxQkstejVrZjQtcGxlYXNlLWlnbm9yZS1tZS1YLVhJSk0yUGRkdw==\"",
|
||||
RuleID: "decoded-password-dont-ignore",
|
||||
Tags: []string{"decode-ignore", "decoded:base64", "decode-depth:1"},
|
||||
StartLine: 23,
|
||||
EndLine: 23,
|
||||
Line: "\nsecret%3d6465636F6465642D7365637265742D76616C75657635",
|
||||
RuleID: "overlapping",
|
||||
Tags: []string{"overlapping", "decoded:percent", "decoded:hex", "decode-depth:2"},
|
||||
StartLine: 40,
|
||||
EndLine: 40,
|
||||
StartColumn: 2,
|
||||
EndColumn: 68,
|
||||
Entropy: 4.5841837,
|
||||
EndColumn: 54,
|
||||
Entropy: 3.4428623,
|
||||
},
|
||||
{ // handle partial encoded percent data465642D7365637265742D76616C75657635
|
||||
Description: "Overlapping",
|
||||
Secret: "decoded-secret-valuev4",
|
||||
Match: "secret=decoded-secret-valuev4",
|
||||
File: "tmp.go",
|
||||
Line: "\nc2VjcmV0PVpHVmpiMl%4AsWkMxelpXTnlaWFF0ZG1Gc2RXVjJOQT09",
|
||||
RuleID: "overlapping",
|
||||
Tags: []string{"overlapping", "decoded:percent", "decoded:base64", "decode-depth:3"},
|
||||
StartLine: 38,
|
||||
EndLine: 38,
|
||||
StartColumn: 2,
|
||||
EndColumn: 55,
|
||||
Entropy: 3.4428623,
|
||||
},
|
||||
{ // multiple percent encodings in a single layer base64
|
||||
Description: "Overlapping",
|
||||
Secret: "decoded-secret-valuex86",
|
||||
Match: "secret=decoded-secret-valuex86",
|
||||
File: "tmp.go",
|
||||
Line: "\nsecret=ZGVjb2%52lZC1zZWNyZXQtdm%46sdWV4ODY= # ends in x86",
|
||||
RuleID: "overlapping",
|
||||
Tags: []string{"overlapping", "decoded:percent", "decoded:base64", "decode-depth:2"},
|
||||
StartLine: 42,
|
||||
EndLine: 42,
|
||||
StartColumn: 2,
|
||||
EndColumn: 44,
|
||||
Entropy: 3.6381476,
|
||||
},
|
||||
{ // base64 encoded partially percent encoded value
|
||||
Description: "Overlapping",
|
||||
Secret: "decoded-secret-value",
|
||||
Match: "secret=decoded-secret-value",
|
||||
File: "tmp.go",
|
||||
Line: "\nsecret=ZGVjb2RlZC0lNzMlNjUlNjMlNzIlNjUlNzQtdmFsdWU=",
|
||||
RuleID: "overlapping",
|
||||
Tags: []string{"overlapping", "decoded:percent", "decoded:base64", "decode-depth:2"},
|
||||
StartLine: 44,
|
||||
EndLine: 44,
|
||||
StartColumn: 2,
|
||||
EndColumn: 52,
|
||||
Entropy: 3.3037016,
|
||||
},
|
||||
{ // one of the lines above that went through... a lot
|
||||
Description: "Overlapping",
|
||||
Secret: "decoded-secret-value",
|
||||
Match: "secret=decoded-secret-value",
|
||||
File: "tmp.go",
|
||||
Line: "\nLook at this value: %4EjMzMjU2NkE2MzZENTYzMDUwNTY3MDQ4%4eTY2RDcwNjk0RDY5NTUzMTRENkQ3ODYx%25%34%65TE3QTQ2MzY1NzZDNjQ0RjY1NTY3MDU5NTU1ODUyNkI2MjUzNTUzMDRFNkU0RTZCNTYzMTU1MzkwQQ== # isn't it crazy?",
|
||||
RuleID: "overlapping",
|
||||
Tags: []string{"overlapping", "decoded:percent", "decoded:hex", "decoded:base64", "decode-depth:7"},
|
||||
StartLine: 47,
|
||||
EndLine: 47,
|
||||
StartColumn: 22,
|
||||
EndColumn: 177,
|
||||
Entropy: 3.3037016,
|
||||
},
|
||||
{ // Multi percent encode two random characters close to the bounds of the base64
|
||||
Description: "Overlapping",
|
||||
Secret: "decoded-secret-value",
|
||||
Match: "secret=decoded-secret-value",
|
||||
File: "tmp.go",
|
||||
Line: "\nsecret=ZG%25%32%35%25%33%32%25%33%35%25%32%35%25%33%33%25%33%35%25%32%35%25%33%33%25%33%36%25%32%35%25%33%32%25%33%35%25%32%35%25%33%33%25%33%36%25%32%35%25%33%36%25%33%31%25%32%35%25%33%32%25%33%35%25%32%35%25%33%33%25%33%36%25%32%35%25%33%33%25%33%322RlZC1zZWNyZXQtd%25%36%64%25%34%36%25%37%33dWU=",
|
||||
RuleID: "overlapping",
|
||||
Tags: []string{"overlapping", "decoded:percent", "decoded:base64", "decode-depth:5"},
|
||||
StartLine: 50,
|
||||
EndLine: 50,
|
||||
StartColumn: 2,
|
||||
EndColumn: 300,
|
||||
Entropy: 3.3037016,
|
||||
},
|
||||
{ // The similar to the above but also touching the edge of the base64
|
||||
Description: "Overlapping",
|
||||
Secret: "decoded-secret-value",
|
||||
Match: "secret=decoded-secret-value",
|
||||
File: "tmp.go",
|
||||
Line: "\nsecret=%25%35%61%25%34%37%25%35%36jb2RlZC1zZWNyZXQtdmFsdWU%25%32%35%25%33%33%25%36%34",
|
||||
RuleID: "overlapping",
|
||||
Tags: []string{"overlapping", "decoded:percent", "decoded:base64", "decode-depth:4"},
|
||||
StartLine: 52,
|
||||
EndLine: 52,
|
||||
StartColumn: 2,
|
||||
EndColumn: 86,
|
||||
Entropy: 3.3037016,
|
||||
},
|
||||
{ // The similar to the above but also touching and overlapping the base64
|
||||
Description: "Overlapping",
|
||||
Secret: "decoded-secret-value",
|
||||
Match: "secret=decoded-secret-value",
|
||||
File: "tmp.go",
|
||||
Line: "\nsecret%3D%25%35%61%25%34%37%25%35%36jb2RlZC1zZWNyZXQtdmFsdWU%25%32%35%25%33%33%25%36%34",
|
||||
RuleID: "overlapping",
|
||||
Tags: []string{"overlapping", "decoded:percent", "decoded:base64", "decode-depth:4"},
|
||||
StartLine: 54,
|
||||
EndLine: 54,
|
||||
StartColumn: 2,
|
||||
EndColumn: 88,
|
||||
Entropy: 3.3037016,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -831,10 +1023,36 @@ func TestFromFiles(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
source: filepath.Join(repoBasePath, "archive"),
|
||||
cfgName: "simple",
|
||||
expectedFindings: []report.Finding{
|
||||
{
|
||||
RuleID: "aws-access-key",
|
||||
Description: "AWS Access Key",
|
||||
StartLine: 20,
|
||||
EndLine: 20,
|
||||
StartColumn: 16,
|
||||
EndColumn: 35,
|
||||
Line: "\n\tawsToken := \"AKIALALEMEL33243OLIA\"",
|
||||
Match: "AKIALALEMEL33243OLIA",
|
||||
Secret: "AKIALALEMEL33243OLIA",
|
||||
File: "archive.zip/main.go",
|
||||
SymlinkFile: "",
|
||||
Tags: []string{"key", "AWS"},
|
||||
Entropy: 3.0841837,
|
||||
Fingerprint: "archive.zip/main.go:aws-access-key:20",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.cfgName+" - "+tt.source, func(t *testing.T) {
|
||||
if strings.Contains(tt.source, "archive") && runtime.GOOS == "windows" {
|
||||
t.Skipf("TODO: this test fails on windows")
|
||||
}
|
||||
|
||||
viper.AddConfigPath(configPath)
|
||||
viper.SetConfigName(tt.cfgName)
|
||||
viper.SetConfigType("toml")
|
||||
@@ -1167,7 +1385,7 @@ let password = 'Summer2024!';`
|
||||
|
||||
f := tc.fragment
|
||||
f.Raw = raw
|
||||
actual := d.detectRule(f, raw, rule, []EncodedSegment{})
|
||||
actual := d.detectRule(f, raw, rule, []*codec.EncodedSegment{})
|
||||
if diff := cmp.Diff(tc.expected, actual); diff != "" {
|
||||
t.Errorf("diff: (-want +got)\n%s", diff)
|
||||
}
|
||||
@@ -1328,7 +1546,7 @@ func TestWindowsFileSeparator_RulePath(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
for name, test := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
actual := d.detectRule(test.fragment, test.fragment.Raw, test.rule, []EncodedSegment{})
|
||||
actual := d.detectRule(test.fragment, test.fragment.Raw, test.rule, []*codec.EncodedSegment{})
|
||||
if diff := cmp.Diff(test.expected, actual); diff != "" {
|
||||
t.Errorf("diff: (-want +got)\n%s", diff)
|
||||
}
|
||||
@@ -1514,7 +1732,7 @@ func TestWindowsFileSeparator_RuleAllowlistPaths(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
for name, test := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
actual := d.detectRule(test.fragment, test.fragment.Raw, test.rule, []EncodedSegment{})
|
||||
actual := d.detectRule(test.fragment, test.fragment.Raw, test.rule, []*codec.EncodedSegment{})
|
||||
if diff := cmp.Diff(test.expected, actual); diff != "" {
|
||||
t.Errorf("diff: (-want +got)\n%s", diff)
|
||||
}
|
||||
|
||||
+157
-94
@@ -17,112 +17,175 @@ import (
|
||||
|
||||
const maxPeekSize = 25 * 1_000 // 10kb
|
||||
|
||||
// DetectFiles schedules each ScanTarget—file or archive—for concurrent scanning.
|
||||
func (d *Detector) DetectFiles(paths <-chan sources.ScanTarget) ([]report.Finding, error) {
|
||||
for pa := range paths {
|
||||
d.Sema.Go(func() error {
|
||||
logger := logging.With().Str("path", pa.Path).Logger()
|
||||
logger.Trace().Msg("Scanning path")
|
||||
|
||||
f, err := os.Open(pa.Path)
|
||||
if err != nil {
|
||||
if os.IsPermission(err) {
|
||||
logger.Warn().Msg("Skipping file: permission denied")
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
_ = f.Close()
|
||||
}()
|
||||
|
||||
// Get file size
|
||||
fileInfo, err := f.Stat()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fileSize := fileInfo.Size()
|
||||
if d.MaxTargetMegaBytes > 0 {
|
||||
rawLength := fileSize / 1000000
|
||||
if rawLength > int64(d.MaxTargetMegaBytes) {
|
||||
logger.Debug().
|
||||
Int64("size", rawLength).
|
||||
Msg("Skipping file: exceeds --max-target-megabytes")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
// Buffer to hold file chunks
|
||||
reader = bufio.NewReaderSize(f, chunkSize)
|
||||
buf = make([]byte, chunkSize)
|
||||
totalLines = 0
|
||||
)
|
||||
for {
|
||||
n, err := reader.Read(buf)
|
||||
|
||||
// "Callers should always process the n > 0 bytes returned before considering the error err."
|
||||
// https://pkg.go.dev/io#Reader
|
||||
if n > 0 {
|
||||
// Only check the filetype at the start of file.
|
||||
if totalLines == 0 {
|
||||
// TODO: could other optimizations be introduced here?
|
||||
if mimetype, err := filetype.Match(buf[:n]); err != nil {
|
||||
return nil
|
||||
} else if mimetype.MIME.Type == "application" {
|
||||
return nil // skip binary files
|
||||
}
|
||||
}
|
||||
|
||||
// Try to split chunks across large areas of whitespace, if possible.
|
||||
peekBuf := bytes.NewBuffer(buf[:n])
|
||||
if readErr := readUntilSafeBoundary(reader, n, maxPeekSize, peekBuf); readErr != nil {
|
||||
return readErr
|
||||
}
|
||||
|
||||
// Count the number of newlines in this chunk
|
||||
chunk := peekBuf.String()
|
||||
linesInChunk := strings.Count(chunk, "\n")
|
||||
totalLines += linesInChunk
|
||||
fragment := Fragment{
|
||||
Raw: chunk,
|
||||
Bytes: peekBuf.Bytes(),
|
||||
}
|
||||
if pa.Symlink != "" {
|
||||
fragment.SymlinkFile = pa.Symlink
|
||||
}
|
||||
if isWindows {
|
||||
fragment.FilePath = filepath.ToSlash(pa.Path)
|
||||
fragment.SymlinkFile = filepath.ToSlash(fragment.SymlinkFile)
|
||||
fragment.WindowsFilePath = pa.Path
|
||||
} else {
|
||||
fragment.FilePath = pa.Path
|
||||
}
|
||||
|
||||
for _, finding := range d.Detect(fragment) {
|
||||
// need to add 1 since line counting starts at 1
|
||||
finding.StartLine += (totalLines - linesInChunk) + 1
|
||||
finding.EndLine += (totalLines - linesInChunk) + 1
|
||||
d.AddFinding(finding)
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
return d.detectScanTarget(pa)
|
||||
})
|
||||
}
|
||||
|
||||
if err := d.Sema.Wait(); err != nil {
|
||||
return d.findings, err
|
||||
}
|
||||
|
||||
return d.findings, nil
|
||||
}
|
||||
|
||||
// detectScanTarget handles one ScanTarget: it unpacks archives recursively
|
||||
// or scans a regular file, always using VirtualPath for reporting.
|
||||
func (d *Detector) detectScanTarget(scanTarget sources.ScanTarget) error {
|
||||
// Choose display path: either VirtualPath (archive chain) or on-disk path.
|
||||
display := scanTarget.Path
|
||||
if scanTarget.VirtualPath != "" {
|
||||
display = scanTarget.VirtualPath
|
||||
}
|
||||
logger := logging.With().Str("path", display).Logger()
|
||||
logger.Trace().Msg("Scanning path")
|
||||
|
||||
if isArchive(scanTarget.Path) {
|
||||
logger.Debug().Msg("Found archive")
|
||||
|
||||
targets, tmpArchiveDir, err := extractArchive(scanTarget.Path)
|
||||
if err != nil {
|
||||
logger.Warn().Err(err).Msg("Failed to extract archive")
|
||||
return nil
|
||||
}
|
||||
// Schedule each extracted file for its own scan, carrying forward VirtualPath.
|
||||
for _, t := range targets {
|
||||
t := t
|
||||
// compute path INSIDE this archive
|
||||
rel, rerr := filepath.Rel(tmpArchiveDir, t.Path)
|
||||
if rerr != nil {
|
||||
rel = filepath.Base(t.Path)
|
||||
}
|
||||
rel = filepath.ToSlash(rel)
|
||||
|
||||
// prepend existing chain or archive base name
|
||||
if scanTarget.VirtualPath != "" {
|
||||
t.VirtualPath = scanTarget.VirtualPath + "/" + rel
|
||||
} else {
|
||||
t.VirtualPath = filepath.Base(scanTarget.Path) + "/" + rel
|
||||
}
|
||||
|
||||
d.Sema.Go(func() error {
|
||||
return d.detectScanTarget(t)
|
||||
})
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// --- Regular file branch ---
|
||||
f, err := os.Open(scanTarget.Path)
|
||||
if err != nil {
|
||||
if os.IsPermission(err) {
|
||||
logger.Warn().Msg("Skipping file: permission denied")
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
// Get file size
|
||||
fileInfo, err := f.Stat()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fileSize := fileInfo.Size()
|
||||
if d.MaxTargetMegaBytes > 0 {
|
||||
rawLength := fileSize / 1000000
|
||||
if rawLength > int64(d.MaxTargetMegaBytes) {
|
||||
logger.Debug().
|
||||
Int64("size", rawLength).
|
||||
Msg("Skipping file: exceeds --max-target-megabytes")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// Skip binary files by sniffing header
|
||||
head := make([]byte, 261)
|
||||
if n, _ := io.ReadFull(f, head); n > 0 {
|
||||
if kind, _ := filetype.Match(head[:n]); kind != filetype.Unknown {
|
||||
logger.Debug().Str("kind", kind.Extension).Msg("Skipping binary")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
if _, err := f.Seek(0, io.SeekStart); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
reader := bufio.NewReader(f)
|
||||
buf := make([]byte, chunkSize)
|
||||
totalLines := 0
|
||||
|
||||
for {
|
||||
n, err := reader.Read(buf)
|
||||
if n > 0 {
|
||||
// Only check the filetype at the start of file.
|
||||
if totalLines == 0 {
|
||||
// TODO: could other optimizations be introduced here?
|
||||
if mimetype, err := filetype.Match(buf[:n]); err != nil {
|
||||
return nil
|
||||
} else if mimetype.MIME.Type == "application" {
|
||||
return nil // skip binary files
|
||||
}
|
||||
}
|
||||
|
||||
peekBuf := bytes.NewBuffer(buf[:n])
|
||||
if readErr := readUntilSafeBoundary(reader, n, maxPeekSize, peekBuf); readErr != nil {
|
||||
return readErr
|
||||
}
|
||||
|
||||
chunk := peekBuf.String()
|
||||
linesInChunk := strings.Count(chunk, "\n")
|
||||
|
||||
// build fragment and set FilePath to our display chain
|
||||
fragment := Fragment{
|
||||
Raw: chunk,
|
||||
Bytes: peekBuf.Bytes(),
|
||||
}
|
||||
fragment.FilePath = display
|
||||
|
||||
// if this file was itself a symlink
|
||||
if scanTarget.Symlink != "" {
|
||||
fragment.SymlinkFile = scanTarget.Symlink
|
||||
}
|
||||
|
||||
if isWindows {
|
||||
fragment.FilePath = filepath.ToSlash(scanTarget.Path)
|
||||
fragment.SymlinkFile = filepath.ToSlash(fragment.SymlinkFile)
|
||||
fragment.WindowsFilePath = scanTarget.Path
|
||||
}
|
||||
|
||||
// run detection and adjust line numbers
|
||||
for _, finding := range d.Detect(fragment) {
|
||||
finding.StartLine += totalLines + 1
|
||||
finding.EndLine += totalLines + 1
|
||||
|
||||
// We have to augment the finding if the source is coming
|
||||
// from a archive committed in Git
|
||||
if scanTarget.Source == "github-archive" {
|
||||
finding.Author = scanTarget.GitInfo.Author
|
||||
finding.Commit = scanTarget.GitInfo.Commit
|
||||
finding.Email = scanTarget.GitInfo.Email
|
||||
finding.Date = scanTarget.GitInfo.Date
|
||||
finding.Message = scanTarget.GitInfo.Message
|
||||
}
|
||||
|
||||
d.AddFinding(finding)
|
||||
}
|
||||
totalLines += linesInChunk
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// readUntilSafeBoundary consumes |f| until it finds two consecutive `\n` characters, up to |maxPeekSize|.
|
||||
// This hopefully avoids splitting. (https://github.com/gitleaks/gitleaks/issues/1651)
|
||||
func readUntilSafeBoundary(r *bufio.Reader, n int, maxPeekSize int, peekBuf *bytes.Buffer) error {
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package detect
|
||||
|
||||
// Fragment contains the data to be scanned
|
||||
type Fragment struct {
|
||||
// Raw is the raw content of the fragment
|
||||
Raw string
|
||||
|
||||
Bytes []byte
|
||||
|
||||
// FilePath is the path to the file, if applicable.
|
||||
// The path separator MUST be normalized to `/`.
|
||||
FilePath string
|
||||
SymlinkFile string
|
||||
// WindowsFilePath is the path with the original separator.
|
||||
// This provides a backwards-compatible solution to https://github.com/gitleaks/gitleaks/issues/1565.
|
||||
WindowsFilePath string `json:"-"` // TODO: remove this in v9.
|
||||
|
||||
// CommitSHA is the SHA of the commit if applicable
|
||||
CommitSHA string
|
||||
|
||||
// newlineIndices is a list of indices of newlines in the raw content.
|
||||
// This is used to calculate the line location of a finding
|
||||
newlineIndices [][]int
|
||||
}
|
||||
+67
-7
@@ -5,9 +5,12 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gitleaks/go-gitdiff/gitdiff"
|
||||
|
||||
@@ -32,13 +35,6 @@ func (d *Detector) DetectGit(cmd *sources.GitCmd, remote *RemoteInfo) ([]report.
|
||||
diffFilesCh = nil
|
||||
break
|
||||
}
|
||||
|
||||
// skip binary files
|
||||
if gitdiffFile.IsBinary || gitdiffFile.IsDelete {
|
||||
continue
|
||||
}
|
||||
|
||||
// Check if commit is allowed
|
||||
commitSHA := ""
|
||||
if gitdiffFile.PatchHeader != nil {
|
||||
commitSHA = gitdiffFile.PatchHeader.SHA
|
||||
@@ -49,6 +45,60 @@ func (d *Detector) DetectGit(cmd *sources.GitCmd, remote *RemoteInfo) ([]report.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if isArchive(gitdiffFile.NewName) {
|
||||
// Check if commit is allowed
|
||||
d.Sema.Go(func() error {
|
||||
// Check out the archive blob to disk
|
||||
archivePath, err := cmd.CheckoutBlob(commitSHA, gitdiffFile.NewName)
|
||||
if err != nil {
|
||||
logging.Warn().Err(err).Str("file", gitdiffFile.NewName).Msg("failed to checkout blob")
|
||||
return nil
|
||||
}
|
||||
defer os.Remove(archivePath)
|
||||
|
||||
targets, tmpDir, err := extractArchive(archivePath)
|
||||
if err != nil {
|
||||
os.RemoveAll(tmpDir)
|
||||
logging.Warn().Err(err).Msg("failed to extract archive")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Scan each extracted file just as you would in directory mode
|
||||
for _, t := range targets {
|
||||
// build the “inside-archive” path
|
||||
rel, _ := filepath.Rel(tmpDir, t.Path)
|
||||
rel = filepath.ToSlash(rel)
|
||||
// chain onto any existing VirtualPath (nested archives)
|
||||
if t.VirtualPath != "" {
|
||||
t.VirtualPath = t.VirtualPath + "/" + rel
|
||||
} else {
|
||||
t.VirtualPath = filepath.Base(gitdiffFile.NewName) + "/" + rel
|
||||
}
|
||||
|
||||
// TODO this isn't a great solution, and it would be nice to
|
||||
// have a better way to handle this.
|
||||
// update taget to include git information:
|
||||
t.Source = "github-archive"
|
||||
t.GitInfo.Author = gitdiffFile.PatchHeader.Author.Name
|
||||
t.GitInfo.Commit = commitSHA
|
||||
|
||||
t.GitInfo.Date = gitdiffFile.PatchHeader.AuthorDate.UTC().Format(time.RFC3339)
|
||||
t.GitInfo.Message = gitdiffFile.PatchHeader.Message()
|
||||
t.GitInfo.Email = gitdiffFile.PatchHeader.Author.Email
|
||||
|
||||
d.detectScanTarget(t)
|
||||
}
|
||||
os.RemoveAll(tmpDir)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// skip binary files
|
||||
if gitdiffFile.IsBinary || gitdiffFile.IsDelete {
|
||||
continue
|
||||
}
|
||||
|
||||
d.addCommit(commitSHA)
|
||||
|
||||
d.Sema.Go(func() error {
|
||||
@@ -63,9 +113,19 @@ func (d *Detector) DetectGit(cmd *sources.GitCmd, remote *RemoteInfo) ([]report.
|
||||
FilePath: gitdiffFile.NewName,
|
||||
}
|
||||
|
||||
timer := time.AfterFunc(SlowWarningThreshold, func() {
|
||||
logging.Debug().
|
||||
Str("commit", commitSHA[:7]).
|
||||
Str("path", fragment.FilePath).
|
||||
Msgf("Taking longer than %s to inspect fragment", SlowWarningThreshold.String())
|
||||
})
|
||||
for _, finding := range d.Detect(fragment) {
|
||||
d.AddFinding(augmentGitFinding(remote, finding, textFragment, gitdiffFile))
|
||||
}
|
||||
if timer != nil {
|
||||
timer.Stop()
|
||||
timer = nil
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -12,6 +12,7 @@ require (
|
||||
github.com/gitleaks/go-gitdiff v0.9.1
|
||||
github.com/google/go-cmp v0.6.0
|
||||
github.com/h2non/filetype v1.1.3
|
||||
github.com/mholt/archives v0.1.1
|
||||
github.com/rs/zerolog v1.33.0
|
||||
github.com/spf13/cobra v1.9.1
|
||||
github.com/spf13/viper v1.19.0
|
||||
@@ -23,26 +24,44 @@ require (
|
||||
dario.cat/mergo v1.0.1 // indirect
|
||||
github.com/Masterminds/goutils v1.1.1 // indirect
|
||||
github.com/Masterminds/semver/v3 v3.3.0 // indirect
|
||||
github.com/STARRY-S/zip v0.2.1 // indirect
|
||||
github.com/andybalholm/brotli v1.1.1 // indirect
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/bodgit/plumbing v1.3.0 // indirect
|
||||
github.com/bodgit/sevenzip v1.6.0 // indirect
|
||||
github.com/bodgit/windows v1.0.1 // indirect
|
||||
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||
github.com/huandu/xstrings v1.5.0 // indirect
|
||||
github.com/klauspost/compress v1.17.11 // indirect
|
||||
github.com/klauspost/pgzip v1.2.6 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.14 // indirect
|
||||
github.com/minio/minlz v1.0.0 // indirect
|
||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/muesli/reflow v0.2.1-0.20210115123740-9e1d0d53df68 // indirect
|
||||
github.com/muesli/termenv v0.15.1 // indirect
|
||||
github.com/nwaples/rardecode/v2 v2.1.0 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
|
||||
github.com/pierrec/lz4/v4 v4.1.21 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/sagikazarmark/locafero v0.7.0 // indirect
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||
github.com/shopspring/decimal v1.4.0 // indirect
|
||||
github.com/sorairolake/lzip-go v0.3.5 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/tetratelabs/wazero v1.9.0 // indirect
|
||||
github.com/therootcompany/xz v1.0.1 // indirect
|
||||
github.com/ulikunitz/xz v0.5.12 // indirect
|
||||
github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
|
||||
golang.org/x/crypto v0.32.0 // indirect
|
||||
)
|
||||
|
||||
|
||||
@@ -1,22 +1,62 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
|
||||
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
|
||||
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
|
||||
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
|
||||
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
|
||||
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
|
||||
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
||||
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
||||
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
||||
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
|
||||
dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s=
|
||||
dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
github.com/BobuSumisu/aho-corasick v1.0.3 h1:uuf+JHwU9CHP2Vx+wAy6jcksJThhJS9ehR8a+4nPE9g=
|
||||
github.com/BobuSumisu/aho-corasick v1.0.3/go.mod h1:hm4jLcvZKI2vRF2WDU1N4p/jpWtpOzp3nLmi9AzX/XE=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
|
||||
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
|
||||
github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0=
|
||||
github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
|
||||
github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs=
|
||||
github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0=
|
||||
github.com/STARRY-S/zip v0.2.1 h1:pWBd4tuSGm3wtpoqRZZ2EAwOmcHK6XFf7bU9qcJXyFg=
|
||||
github.com/STARRY-S/zip v0.2.1/go.mod h1:xNvshLODWtC4EJ702g7cTYn13G53o1+X9BWnPFpcWV4=
|
||||
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
|
||||
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
|
||||
github.com/bodgit/plumbing v1.3.0 h1:pf9Itz1JOQgn7vEOE7v7nlEfBykYqvUYioC61TwWCFU=
|
||||
github.com/bodgit/plumbing v1.3.0/go.mod h1:JOTb4XiRu5xfnmdnDJo6GmSbSbtSyufrsyZFByMtKEs=
|
||||
github.com/bodgit/sevenzip v1.6.0 h1:a4R0Wu6/P1o1pP/3VV++aEOcyeBxeO/xE2Y9NSTrr6A=
|
||||
github.com/bodgit/sevenzip v1.6.0/go.mod h1:zOBh9nJUof7tcrlqJFv1koWRrhz3LbDbUNngkuZxLMc=
|
||||
github.com/bodgit/windows v1.0.1 h1:tF7K6KOluPYygXa3Z2594zxlkbKPAOvqr97etrGNIz4=
|
||||
github.com/bodgit/windows v1.0.1/go.mod h1:a6JLwrB4KrTR5hBpp8FI9/9W9jJfeQ2h4XDXU74ZCdM=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/charmbracelet/lipgloss v0.5.0 h1:lulQHuVeodSgDez+3rGiuxlPVXSnhth442DATR2/8t8=
|
||||
github.com/charmbracelet/lipgloss v0.5.0/go.mod h1:EZLha/HbzEt7cYqdFPovlqy5FZPj0xFhg5SaqxScmgs=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 h1:2tV76y6Q9BB+NEBasnqvs7e49aEBFI8ejC89PSnWH+4=
|
||||
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707/go.mod h1:qssHWj60/X5sZFNxpG4HBPDHVqxNm4DfnCKgrbZOT+s=
|
||||
github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/fatih/semgroup v1.2.0 h1:h/OLXwEM+3NNyAdZEpMiH1OzfplU09i2qXPVThGZvyg=
|
||||
github.com/fatih/semgroup v1.2.0/go.mod h1:1KAD4iIYfXjE4U13B48VM4z9QUwV5Tt8O4rS879kgm8=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
@@ -25,21 +65,71 @@ github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/
|
||||
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
|
||||
github.com/gitleaks/go-gitdiff v0.9.1 h1:ni6z6/3i9ODT685OLCTf+s/ERlWUNWQF4x1pvoNICw0=
|
||||
github.com/gitleaks/go-gitdiff v0.9.1/go.mod h1:pKz0X4YzCKZs30BL+weqBIG7mx0jl4tF1uXV9ZyNvrA=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
||||
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/h2non/filetype v1.1.3 h1:FKkx9QbD7HR/zjK1Ia5XiBsq9zdLi5Kf3zGyFTAFkGg=
|
||||
github.com/h2non/filetype v1.1.3/go.mod h1:319b3zT68BvV+WRj7cwy856M2ehB3HqNOt6sy1HndBY=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI=
|
||||
github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
||||
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU=
|
||||
github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
||||
@@ -60,6 +150,10 @@ github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRC
|
||||
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
|
||||
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mholt/archives v0.1.1 h1:c7J3qXN1FB54y0qiUXiq9Bxk4eCUc8pdXWwOhZdRzeY=
|
||||
github.com/mholt/archives v0.1.1/go.mod h1:FQVz01Q2uXKB/35CXeW/QFO23xT+hSCGZHVtha78U4I=
|
||||
github.com/minio/minlz v1.0.0 h1:Kj7aJZ1//LlTP1DM8Jm7lNKvvJS2m74gyyXXn3+uJWQ=
|
||||
github.com/minio/minlz v1.0.0/go.mod h1:qT0aEB35q79LLornSzeDH75LBf3aH1MV+jB5w9Wasec=
|
||||
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
|
||||
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
@@ -71,26 +165,36 @@ github.com/muesli/reflow v0.2.1-0.20210115123740-9e1d0d53df68/go.mod h1:Xk+z4oIW
|
||||
github.com/muesli/termenv v0.11.1-0.20220204035834-5ac8409525e0/go.mod h1:Bd5NYQ7pd+SrtBSrSNoBBmXlcY8+Xj4BMJgh8qcZrvs=
|
||||
github.com/muesli/termenv v0.15.1 h1:UzuTb/+hhlBugQz28rpzey4ZuKcZ03MeKsoG7IJZIxs=
|
||||
github.com/muesli/termenv v0.15.1/go.mod h1:HeAQPTzpfs016yGtA4g00CsdYnVLJvxsS4ANqrZs2sQ=
|
||||
github.com/nwaples/rardecode/v2 v2.1.0 h1:JQl9ZoBPDy+nIZGb1mx8+anfHp/LV3NE2MjMiv0ct/U=
|
||||
github.com/nwaples/rardecode/v2 v2.1.0/go.mod h1:7uz379lSxPe6j9nvzxUZ+n7mnJNgjsRNb6IbvGVHRmw=
|
||||
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
|
||||
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
|
||||
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
|
||||
github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
|
||||
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd/go.mod h1:hPqNNc0+uJM6H+SuU8sEs5K5IQeKccPqeSjfgcKGgPk=
|
||||
github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo=
|
||||
github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
|
||||
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
|
||||
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
|
||||
github.com/sorairolake/lzip-go v0.3.5 h1:ms5Xri9o1JBIWvOFAorYtUNik6HI3HgBTkISiqu0Cwg=
|
||||
github.com/sorairolake/lzip-go v0.3.5/go.mod h1:N0KYq5iWrMXI0ZEXKXaS9hCyOjZUQdBDEIbXfoUwbdk=
|
||||
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
|
||||
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
|
||||
github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs=
|
||||
@@ -103,36 +207,218 @@ github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
|
||||
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
|
||||
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
|
||||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||
github.com/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I=
|
||||
github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM=
|
||||
github.com/therootcompany/xz v1.0.1 h1:CmOtsn1CbtmyYiusbfmhmkpAAETj0wBIH6kCYaX+xzw=
|
||||
github.com/therootcompany/xz v1.0.1/go.mod h1:3K3UH1yCKgBneZYhuQUvJ9HPD19UEXEI0BWbMn8qNMY=
|
||||
github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
||||
github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
|
||||
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
||||
github.com/wasilibs/go-re2 v1.9.0 h1:kjAd8qbNvV4Ve2Uf+zrpTCrDHtqH4dlsRXktywo73JQ=
|
||||
github.com/wasilibs/go-re2 v1.9.0/go.mod h1:0sRtscWgpUdNA137bmr1IUgrRX0Su4dcn9AEe61y+yI=
|
||||
github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 h1:OvLBa8SqJnZ6P+mjlzc2K7PM22rRUPE1x32G9DTPrC4=
|
||||
github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52/go.mod h1:jMeV4Vpbi8osrE/pKUxRZkVaA0EX7NZN0A9/oRzgpgY=
|
||||
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
|
||||
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go4.org v0.0.0-20230225012048-214862532bf5 h1:nifaUDeh+rPaBCMPMQHZmvJf+QdpLFnuQPwx+LxVmtc=
|
||||
go4.org v0.0.0-20230225012048-214862532bf5/go.mod h1:F57wTi5Lrj6WLyswp5EYV1ncrEbFGHD4hhz6S1ZYeaU=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
|
||||
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
|
||||
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
|
||||
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa h1:t2QcU6V556bFjYgu4L6C+6VrCPyJZ+eyRsABUPs1mz4=
|
||||
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa/go.mod h1:BHOTPb3L19zxehTsLoJXVaTktb06DFgmdW6Wb9s8jqk=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
||||
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
|
||||
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
||||
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
|
||||
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
||||
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
|
||||
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
||||
+13
-2
@@ -13,8 +13,19 @@ import (
|
||||
)
|
||||
|
||||
type ScanTarget struct {
|
||||
Path string
|
||||
Symlink string
|
||||
Path string
|
||||
Symlink string
|
||||
VirtualPath string
|
||||
|
||||
Source string
|
||||
|
||||
// The following items are only used for git archive scans
|
||||
// (since we have to treat them like regular dir scans)
|
||||
GitInfo GitInfo
|
||||
|
||||
// TODO one day use a single Metadata map
|
||||
// instead of git fields
|
||||
// Metadata map[string]string
|
||||
}
|
||||
|
||||
var isWindows = runtime.GOOS == "windows"
|
||||
|
||||
@@ -3,7 +3,9 @@ package sources
|
||||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
@@ -18,11 +20,22 @@ var quotedOptPattern = regexp.MustCompile(`^(?:"[^"]+"|'[^']+')$`)
|
||||
|
||||
// GitCmd helps to work with Git's output.
|
||||
type GitCmd struct {
|
||||
repoPath string
|
||||
cmd *exec.Cmd
|
||||
diffFilesCh <-chan *gitdiff.File
|
||||
errCh <-chan error
|
||||
}
|
||||
|
||||
type GitInfo struct {
|
||||
Source string
|
||||
Commit string
|
||||
Link string
|
||||
Author string
|
||||
Email string
|
||||
Date string
|
||||
Message string
|
||||
}
|
||||
|
||||
// NewGitLogCmd returns `*DiffFilesCmd` with two channels: `<-chan *gitdiff.File` and `<-chan error`.
|
||||
// Caller should read everything from channels until receiving a signal about their closure and call
|
||||
// the `func (*DiffFilesCmd) Wait()` error in order to release resources.
|
||||
@@ -75,6 +88,7 @@ func NewGitLogCmd(source string, logOpts string) (*GitCmd, error) {
|
||||
}
|
||||
|
||||
return &GitCmd{
|
||||
repoPath: sourceClean,
|
||||
cmd: cmd,
|
||||
diffFilesCh: gitdiffFiles,
|
||||
errCh: errCh,
|
||||
@@ -115,12 +129,43 @@ func NewGitDiffCmd(source string, staged bool) (*GitCmd, error) {
|
||||
}
|
||||
|
||||
return &GitCmd{
|
||||
repoPath: sourceClean,
|
||||
cmd: cmd,
|
||||
diffFilesCh: gitdiffFiles,
|
||||
errCh: errCh,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// CheckoutBlob writes the contents of the blob at commit:filepath into a temp file
|
||||
// and returns its path.
|
||||
func (g *GitCmd) CheckoutBlob(commit, filepathInRepo string) (string, error) {
|
||||
// Create a temp file with the same extension as the blob, if possible
|
||||
ext := filepath.Ext(filepathInRepo)
|
||||
// tmpDir, err := os.MkdirTemp("gitleaks", "archive-*")
|
||||
tmpFile, err := os.CreateTemp("", "gitleaks-blob-*"+ext)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("creating temp file for blob: %w", err)
|
||||
}
|
||||
tmpFilePath := tmpFile.Name()
|
||||
tmpFile.Close()
|
||||
|
||||
// git show <commit>:<path>
|
||||
gitArgs := []string{"-C", g.repoPath, "show", fmt.Sprintf("%s:%s", commit, filepathInRepo)}
|
||||
cmd := exec.Command("git", gitArgs...)
|
||||
cmd.Stdout, err = os.OpenFile(tmpFilePath, os.O_WRONLY, 0o644)
|
||||
if err != nil {
|
||||
os.Remove(tmpFilePath)
|
||||
return "", fmt.Errorf("opening temp file for write: %w", err)
|
||||
}
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
os.Remove(tmpFilePath)
|
||||
return "", fmt.Errorf("git show failed: %w", err)
|
||||
}
|
||||
|
||||
return tmpFilePath, nil
|
||||
}
|
||||
|
||||
// DiffFilesCh returns a channel with *gitdiff.File.
|
||||
func (c *GitCmd) DiffFilesCh() <-chan *gitdiff.File {
|
||||
return c.diffFilesCh
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
# goes outside the bounds of the encoded value
|
||||
id = 'overlapping'
|
||||
description = 'Overlapping'
|
||||
regex = '''secret=(decoded-secret-value)'''
|
||||
regex = '''secret=(decoded-secret-value\w*)'''
|
||||
tags = ['overlapping']
|
||||
secretGroup = 1
|
||||
|
||||
Vendored
+6
@@ -1,6 +1,12 @@
|
||||
title = "gitleaks config"
|
||||
# https://learnxinyminutes.com/docs/toml/ for toml reference
|
||||
|
||||
[[rules]]
|
||||
description = "1Password Secret Key"
|
||||
id = "1password-secret-key"
|
||||
regex = '''A3-[A-Z0-9]{6}-(?:(?:[A-Z0-9]{11})|(?:[A-Z0-9]{6}-[A-Z0-9]{5}))-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}'''
|
||||
tags = ["1Password"]
|
||||
|
||||
[[rules]]
|
||||
description = "AWS Access Key"
|
||||
id = "aws-access-key"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# https://github.com/gitleaks/gitleaks/issues/1844
|
||||
[extend]
|
||||
useDefault = true
|
||||
|
||||
[[rules]]
|
||||
id = "generic-api-key"
|
||||
[[rules.allowlists]]
|
||||
description = "Exclude a specific file from generic-api-key rule"
|
||||
paths = [
|
||||
'''^path/to/your/problematic/file\.js$'''
|
||||
]
|
||||
+1
@@ -0,0 +1 @@
|
||||
archive.zip/api.go:aws-access-key:20
|
||||
Vendored
BIN
Binary file not shown.
Reference in new issue
Block a user