diff --git a/cmd/detect.go b/cmd/detect.go index 833918be..74617493 100644 --- a/cmd/detect.go +++ b/cmd/detect.go @@ -1,18 +1,12 @@ package cmd import ( - "os" - "path/filepath" - "time" - "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/spf13/viper" "github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/detect" - "github.com/zricethezav/gitleaks/v8/git" - "github.com/zricethezav/gitleaks/v8/report" ) func init() { @@ -30,9 +24,9 @@ var detectCmd = &cobra.Command{ func runDetect(cmd *cobra.Command, args []string) { initConfig() var ( - vc config.ViperConfig - findings []report.Finding - err error + vc config.ViperConfig + // findings []report.Finding + err error ) viper.Unmarshal(&vc) @@ -42,52 +36,56 @@ func runDetect(cmd *cobra.Command, args []string) { } cfg.Path, _ = cmd.Flags().GetString("config") - source, _ := cmd.Flags().GetString("source") - logOpts, _ := cmd.Flags().GetString("log-opts") - verbose, _ := cmd.Flags().GetBool("verbose") - redact, _ := cmd.Flags().GetBool("redact") - noGit, _ := cmd.Flags().GetBool("no-git") - exitCode, _ := cmd.Flags().GetInt("exit-code") - if cfg.Path == "" { - cfg.Path = filepath.Join(source, ".gitleaks.toml") - } - start := time.Now() - if noGit { - if logOpts != "" { - log.Fatal().Err(err).Msg("--log-opts cannot be used with --no-git") - } - findings, err = detect.FromFiles(source, cfg, detect.Options{ - Verbose: verbose, - Redact: redact, - }) - if err != nil { - log.Fatal().Err(err).Msg("Failed to scan files") - } - } else { - files, err := git.GitLog(source, logOpts) - if err != nil { - log.Fatal().Err(err).Msg("Failed to get git log") - } + detector := detect.NewDetector(cfg) + detector.Start(cmd) - findings = detect.FromGit(files, cfg, detect.Options{Verbose: verbose, Redact: redact}) - } + // source, _ := cmd.Flags().GetString("source") + // logOpts, _ := cmd.Flags().GetString("log-opts") + // verbose, _ := cmd.Flags().GetBool("verbose") + // redact, _ := cmd.Flags().GetBool("redact") + // noGit, _ := cmd.Flags().GetBool("no-git") + // exitCode, _ := cmd.Flags().GetInt("exit-code") + // if cfg.Path == "" { + // cfg.Path = filepath.Join(source, ".gitleaks.toml") + // } + // start := time.Now() - if len(findings) != 0 { - log.Warn().Msgf("leaks found: %d", len(findings)) - } else { - log.Info().Msg("no leaks found") - } + // if noGit { + // if logOpts != "" { + // log.Fatal().Err(err).Msg("--log-opts cannot be used with --no-git") + // } + // findings, err = detect.FromFiles(source, cfg, detect.Options{ + // Verbose: verbose, + // Redact: redact, + // }) + // if err != nil { + // log.Fatal().Err(err).Msg("Failed to scan files") + // } + // } else { + // files, err := git.GitLog(source, logOpts) + // if err != nil { + // log.Fatal().Err(err).Msg("Failed to get git log") + // } - log.Info().Msgf("scan completed in %s", time.Since(start)) + // findings = detect.FromGit(files, cfg, detect.Options{Verbose: verbose, Redact: redact}) + // } - reportPath, _ := cmd.Flags().GetString("report-path") - ext, _ := cmd.Flags().GetString("report-format") - if reportPath != "" { - report.Write(findings, cfg, ext, reportPath) - } + // if len(findings) != 0 { + // log.Warn().Msgf("leaks found: %d", len(findings)) + // } else { + // log.Info().Msg("no leaks found") + // } - if len(findings) != 0 { - os.Exit(exitCode) - } + // log.Info().Msgf("scan completed in %s", time.Since(start)) + + // reportPath, _ := cmd.Flags().GetString("report-path") + // ext, _ := cmd.Flags().GetString("report-format") + // if reportPath != "" { + // report.Write(findings, cfg, ext, reportPath) + // } + + // if len(findings) != 0 { + // os.Exit(exitCode) + // } } diff --git a/cmd/protect.go b/cmd/protect.go index a8f51c80..7bd6c943 100644 --- a/cmd/protect.go +++ b/cmd/protect.go @@ -1,18 +1,11 @@ package cmd import ( - "os" - "path/filepath" - "time" - "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/spf13/viper" "github.com/zricethezav/gitleaks/v8/config" - "github.com/zricethezav/gitleaks/v8/detect" - "github.com/zricethezav/gitleaks/v8/git" - "github.com/zricethezav/gitleaks/v8/report" ) func init() { @@ -37,36 +30,36 @@ func runProtect(cmd *cobra.Command, args []string) { } cfg.Path, _ = cmd.Flags().GetString("config") - source, _ := cmd.Flags().GetString("source") - verbose, _ := cmd.Flags().GetBool("verbose") - redact, _ := cmd.Flags().GetBool("redact") - exitCode, _ := cmd.Flags().GetInt("exit-code") - staged, _ := cmd.Flags().GetBool("staged") - if cfg.Path == "" { - cfg.Path = filepath.Join(source, ".gitleaks.toml") - } - start := time.Now() + // source, _ := cmd.Flags().GetString("source") + // verbose, _ := cmd.Flags().GetBool("verbose") + // redact, _ := cmd.Flags().GetBool("redact") + // exitCode, _ := cmd.Flags().GetInt("exit-code") + // staged, _ := cmd.Flags().GetBool("staged") + // if cfg.Path == "" { + // cfg.Path = filepath.Join(source, ".gitleaks.toml") + // } + // start := time.Now() - files, err := git.GitDiff(source, staged) - if err != nil { - log.Fatal().Err(err).Msg("Failed to get git log") - } + // files, err := git.GitDiff(source, staged) + // if err != nil { + // log.Fatal().Err(err).Msg("Failed to get git log") + // } - findings := detect.FromGit(files, cfg, detect.Options{Verbose: verbose, Redact: redact}) - if len(findings) != 0 { - log.Warn().Msgf("leaks found: %d", len(findings)) - } else { - log.Info().Msg("no leaks found") - } + // findings := detect.FromGit(files, cfg, detect.Options{Verbose: verbose, Redact: redact}) + // if len(findings) != 0 { + // log.Warn().Msgf("leaks found: %d", len(findings)) + // } else { + // log.Info().Msg("no leaks found") + // } - log.Info().Msgf("scan duration: %s", time.Since(start)) + // log.Info().Msgf("scan duration: %s", time.Since(start)) - reportPath, _ := cmd.Flags().GetString("report-path") - ext, _ := cmd.Flags().GetString("report-format") - if reportPath != "" { - report.Write(findings, cfg, ext, reportPath) - } - if len(findings) != 0 { - os.Exit(exitCode) - } + // reportPath, _ := cmd.Flags().GetString("report-path") + // ext, _ := cmd.Flags().GetString("report-format") + // if reportPath != "" { + // report.Write(findings, cfg, ext, reportPath) + // } + // if len(findings) != 0 { + // os.Exit(exitCode) + // } } diff --git a/detect/detect.go b/detect/detect.go index 4f34c461..61a4bd0e 100644 --- a/detect/detect.go +++ b/detect/detect.go @@ -3,19 +3,21 @@ package detect import ( "context" "fmt" - "math" "os" "path/filepath" "regexp" "strings" "sync" + "time" + + "github.com/rs/zerolog/log" + "github.com/zricethezav/gitleaks/v8/config" + "github.com/zricethezav/gitleaks/v8/detect/git" + "github.com/zricethezav/gitleaks/v8/report" "github.com/fatih/semgroup" "github.com/gitleaks/go-gitdiff/gitdiff" "github.com/spf13/cobra" - "github.com/zricethezav/gitleaks/v8/config" - "github.com/zricethezav/gitleaks/v8/detect/git" - "github.com/zricethezav/gitleaks/v8/report" ) // Detector is the main detector struct @@ -27,8 +29,6 @@ type Detector struct { verbose bool - // maybe use cmd? - // commitMap is used to keep track of commits that have been scanned. // This is only used for logging purposes and git scans. commitMap map[string]bool @@ -60,7 +60,10 @@ type Fragment struct { func NewDetector(cfg config.Config) *Detector { return &Detector{ - cfg: cfg, + commitMap: make(map[string]bool), + findingMutex: &sync.Mutex{}, + findings: make([]report.Finding, 0), + cfg: cfg, } } @@ -77,6 +80,8 @@ func (d *Detector) Start(cmd *cobra.Command) ([]report.Finding, error) { err error ) + start := time.Now() + d.cfg.Path, err = cmd.Flags().GetString("config") if err != nil { return findings, err @@ -93,12 +98,16 @@ func (d *Detector) Start(cmd *cobra.Command) ([]report.Finding, error) { d.cfg.Path = filepath.Join(source, ".gitleaks.toml") } + // set verbose flag if d.verbose, err = cmd.Flags().GetBool("verbose"); err != nil { return findings, err } + + // set redact flag if d.redact, err = cmd.Flags().GetBool("redact"); err != nil { return findings, err } + noGit, err := cmd.Flags().GetBool("no-git") if err != nil { return findings, err @@ -113,15 +122,17 @@ func (d *Detector) Start(cmd *cobra.Command) ([]report.Finding, error) { return findings, err } // TODO abstract git log to "producer" or "pipe" - history, err := git.GitLog(d.cfg.Path, logOpts) + history, err := git.GitLog(source, logOpts) if err != nil { return findings, err } - findings = d.startGitScan(history) + d.startGitScan(history) } + log.Info().Msgf("scan completed in %s", time.Since(start)) + // TODO generate report, check exit code, etc - exitCode, err := cmd.Flags().GetInt("exit-code") + // exitCode, err := cmd.Flags().GetInt("exit-code") return findings, nil } @@ -154,7 +165,7 @@ func (d *Detector) Detect(fragment Fragment) []report.Finding { for _, rule := range d.cfg.Rules { findings = append(findings, d.detectRule(fragment, rule)...) } - return findings + return filter(findings, d.redact) } func (d *Detector) detectRule(fragment Fragment, rule *config.Rule) []report.Finding { @@ -231,15 +242,16 @@ func (d *Detector) detectRule(fragment Fragment, rule *config.Rule) []report.Fin // check entropy finding.Entropy = float32(shannonEntropy(secret)) if rule.EntropySet() && finding.Entropy < float32(rule.Entropy) { + // entropy is too low, skip this finding return findings } + + findings = append(findings, finding) } return findings } -func (d *Detector) startGitScan(gitdiffFiles <-chan *gitdiff.File) []report.Finding { - var findings []report.Finding - +func (d *Detector) startGitScan(gitdiffFiles <-chan *gitdiff.File) { s := semgroup.NewGroup(context.Background(), 4) for f := range gitdiffFiles { @@ -273,15 +285,16 @@ func (d *Detector) startGitScan(gitdiffFiles <-chan *gitdiff.File) []report.Find } for _, finding := range d.Detect(fragment) { - d.addFinding(augmentFinding(finding, textFragment, d.redact)) + d.addFinding(augmentGitFinding(finding, textFragment, f)) } } return nil }) - } - return findings + if err := s.Wait(); err != nil { + fmt.Println(err) + } } func (d *Detector) startFileScan(source string) []report.Finding { @@ -303,7 +316,6 @@ func (d *Detector) startFileScan(source string) []report.Finding { } return nil }) - return nil }) for pa := range paths { p := pa @@ -316,7 +328,9 @@ func (d *Detector) startFileScan(source string) []report.Finding { Raw: string(b), FilePath: p, } - d.Detect(fragment) + for _, finding := range d.Detect(fragment) { + d.addFinding(finding) + } return nil }) @@ -325,52 +339,17 @@ func (d *Detector) startFileScan(source string) []report.Finding { return findings } +// addFinding synchronously adds a finding to the findings slice func (d *Detector) addFinding(finding report.Finding) { d.findingMutex.Lock() d.findings = append(d.findings, finding) + if d.verbose { + printFinding(finding) + } d.findingMutex.Unlock() } +// addCommit synchronously adds a commit to the commit slice func (d *Detector) addCommit(commit string) { d.commitMap[commit] = true } - -func augmentFinding(finding report.Finding, textFragment *gitdiff.TextFragment, redact bool) report.Finding { - if !strings.HasPrefix(finding.Match, "file detected") { - finding.StartLine += int(textFragment.NewPosition) - finding.EndLine += int(textFragment.NewPosition) - } - - // TODO handle redact - - return finding -} - -// filter inspects each finding and removes the findings that are allowed (whether that be by the rule allowlist or global allowlist) -func (d *Detector) filter(findings []report.Finding) []report.Finding { - return findings -} - -// shannonEntropy calculates the entropy of data using the formula defined here: -// https://en.wiktionary.org/wiki/Shannon_entropy -// Another way to think about what this is doing is calculating the number of bits -// needed to on average encode the data. So, the higher the entropy, the more random the data, the -// more bits needed to encode that data. -func shannonEntropy(data string) (entropy float64) { - if data == "" { - return 0 - } - - charCounts := make(map[rune]int) - for _, char := range data { - charCounts[char]++ - } - - invLength := 1.0 / float64(len(data)) - for _, count := range charCounts { - freq := float64(count) * invLength - entropy -= freq * math.Log2(freq) - } - - return entropy -} diff --git a/detect/utils.go b/detect/utils.go new file mode 100644 index 00000000..6ea1efc3 --- /dev/null +++ b/detect/utils.go @@ -0,0 +1,96 @@ +package detect + +import ( + "encoding/json" + "fmt" + "math" + "strings" + "time" + + "github.com/zricethezav/gitleaks/v8/report" + + "github.com/gitleaks/go-gitdiff/gitdiff" + "github.com/rs/zerolog/log" +) + +// augmentGitFinding updates the start and end line numbers of a finding to include the +// delta from the git diff +func augmentGitFinding(finding report.Finding, textFragment *gitdiff.TextFragment, f *gitdiff.File) report.Finding { + if !strings.HasPrefix(finding.Match, "file detected") { + finding.StartLine += int(textFragment.NewPosition) + finding.EndLine += int(textFragment.NewPosition) + } + + if f.PatchHeader != nil { + finding.Commit = f.PatchHeader.SHA + finding.Message = f.PatchHeader.Message() + if f.PatchHeader.Author != nil { + finding.Author = f.PatchHeader.Author.Name + finding.Email = f.PatchHeader.Author.Email + } + finding.Date = f.PatchHeader.AuthorDate.UTC().Format(time.RFC3339) + } + return finding +} + +// shannonEntropy calculates the entropy of data using the formula defined here: +// https://en.wiktionary.org/wiki/Shannon_entropy +// Another way to think about what this is doing is calculating the number of bits +// needed to on average encode the data. So, the higher the entropy, the more random the data, the +// more bits needed to encode that data. +func shannonEntropy(data string) (entropy float64) { + if data == "" { + return 0 + } + + charCounts := make(map[rune]int) + for _, char := range data { + charCounts[char]++ + } + + invLength := 1.0 / float64(len(data)) + for _, count := range charCounts { + freq := float64(count) * invLength + entropy -= freq * math.Log2(freq) + } + + return entropy +} + +// filter will dedupe and redact findings +func filter(findings []report.Finding, redact bool) []report.Finding { + var retFindings []report.Finding + for _, f := range findings { + include := true + if strings.Contains(strings.ToLower(f.RuleID), "generic") { + for _, fPrime := range findings { + if f.StartLine == fPrime.StartLine && + f.EndLine == fPrime.EndLine && + f.Commit == fPrime.Commit && + f.RuleID != fPrime.RuleID && + strings.Contains(fPrime.Secret, f.Secret) && + !strings.Contains(strings.ToLower(fPrime.RuleID), "generic") { + + genericMatch := strings.Replace(f.Match, f.Secret, "REDACTED", -1) + betterMatch := strings.Replace(fPrime.Match, fPrime.Secret, "REDACTED", -1) + log.Debug().Msgf("skipping %s finding (%s), %s rule takes precendence (%s)", f.RuleID, genericMatch, fPrime.RuleID, betterMatch) + include = false + break + } + } + } + if redact { + f.Redact() + } + if include { + retFindings = append(retFindings, f) + } + } + return retFindings +} + +func printFinding(f report.Finding) { + var b []byte + b, _ = json.MarshalIndent(f, "", " ") + fmt.Println(string(b)) +} diff --git a/go.mod b/go.mod index 4e0dd2cc..7b5e3bdb 100644 --- a/go.mod +++ b/go.mod @@ -3,33 +3,25 @@ module github.com/zricethezav/gitleaks/v8 go 1.17 require ( - github.com/gitleaks/go-gitdiff v0.7.4 - github.com/rs/zerolog v1.25.0 - github.com/spf13/cobra v1.2.1 - github.com/spf13/viper v1.8.1 - github.com/stretchr/testify v1.7.0 - golang.org/x/sync v0.0.0-20210220032951-036812b2e83c -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect github.com/fatih/semgroup v1.2.0 // indirect github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/gitleaks/go-gitdiff v0.7.4 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/magiconair/properties v1.8.5 // indirect github.com/mitchellh/mapstructure v1.4.1 // indirect github.com/pelletier/go-toml v1.9.3 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rs/zerolog v1.26.1 // indirect github.com/spf13/afero v1.6.0 // indirect github.com/spf13/cast v1.3.1 // indirect + github.com/spf13/cobra v1.2.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.8.1 // indirect github.com/subosito/gotenv v1.2.0 // indirect + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/sys v0.0.0-20211110154304-99a53858aa08 // indirect - golang.org/x/text v0.3.5 // indirect - gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect + golang.org/x/text v0.3.6 // indirect gopkg.in/ini.v1 v1.62.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/go.sum b/go.sum index 61db2106..a0bf6528 100644 --- a/go.sum +++ b/go.sum @@ -57,7 +57,6 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -140,7 +139,6 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.1.2/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/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= @@ -171,15 +169,12 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= 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/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= @@ -204,22 +199,19 @@ github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCko github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.25.0 h1:Rj7XygbUHKUlDPcVdoLyR91fJBsduXj5fRxyqIQj/II= -github.com/rs/zerolog v1.25.0/go.mod h1:7KHcEGe0QZPOm2IE4Kpb5rTh6n1h2hIgS5OOnu1rUaI= +github.com/rs/zerolog v1.26.1 h1:/ihwxqH+4z8UxyI70wM1z9yCvkWcfz/a3mj48k/Zngc= +github.com/rs/zerolog v1.26.1/go.mod h1:/wSSJWX7lVrsOwlbyTRSOJvqRlc+WjWlfes+CiJ+tmc= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= @@ -239,7 +231,6 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= @@ -248,6 +239,9 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/zricethezav/gitleaks/v8 v8.3.0 h1:3Pw5kSbypWCLXCvPeKdXM66hLNg10nSbBJNzNPfwgfI= +github.com/zricethezav/gitleaks/v8 v8.3.0/go.mod h1:dqPs8vOMHWGj6iJyhQbkAosZuSDHtwxpkbdjfZ+qd4U= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= @@ -268,6 +262,7 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= 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= @@ -339,6 +334,7 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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= @@ -403,7 +399,9 @@ golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211110154304-99a53858aa08 h1:WecRHqgE09JBkh/584XIE6PMz5KKE/vER4izNUi30AQ= golang.org/x/sys v0.0.0-20211110154304-99a53858aa08/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -413,8 +411,9 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 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.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 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/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -469,7 +468,7 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= 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= @@ -578,8 +577,6 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= 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.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -589,7 +586,6 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/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=