From 991223ababf9675cb7d92f55ee46b08762822581 Mon Sep 17 00:00:00 2001 From: Zachary Rice Date: Fri, 7 Jan 2022 10:59:51 -0600 Subject: [PATCH] remove godoc text filtering (#763) --- detect/files.go | 5 ----- detect/git.go | 5 ----- 2 files changed, 10 deletions(-) diff --git a/detect/files.go b/detect/files.go index cd51c2439..3ab1b6aed 100644 --- a/detect/files.go +++ b/detect/files.go @@ -7,7 +7,6 @@ import ( "sync" "golang.org/x/sync/errgroup" - godocutil "golang.org/x/tools/godoc/util" "github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/report" @@ -50,10 +49,6 @@ func FromFiles(source string, cfg config.Config, outputOptions Options) ([]repor if err != nil { return err } - - if !godocutil.IsText(b) { - return nil - } fis := DetectFindings(cfg, b, p, "") for _, fi := range fis { // need to add 1 since line counting starts at 1 diff --git a/detect/git.go b/detect/git.go index 754e8014c..69ae08406 100644 --- a/detect/git.go +++ b/detect/git.go @@ -9,7 +9,6 @@ import ( "github.com/rs/zerolog/log" "github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/report" - godocutil "golang.org/x/tools/godoc/util" ) // FromGit accepts a gitdiff.File channel (structure output from `git log -p`) and a configuration @@ -58,10 +57,6 @@ func FromGit(files <-chan *gitdiff.File, cfg config.Config, outputOptions Option continue } - if !godocutil.IsText([]byte(tf.Raw(gitdiff.OpAdd))) { - continue - } - for _, fi := range DetectFindings(cfg, []byte(tf.Raw(gitdiff.OpAdd)), f.NewName, commitSHA) { // don't add to start/end lines if finding is from a file only rule if !strings.HasPrefix(fi.Match, "file detected") {