Skip to content

Find, verify, and analyze leaked credentials

Update float detector with correct User-Agent and regex (#1061)

ahrav58b78b6a5a87
diff --git a/pkg/detectors/float/float.go b/pkg/detectors/float/float.go
index c3ce640f7..56c61939c 100644
--- a/pkg/detectors/float/float.go
+++ b/pkg/detectors/float/float.go
@@ -21,7 +21,7 @@ var (
client = common.SaneHttpClient()
// Make sure that your group is surrounded in boundary characters such as below to reduce false positives.
- keyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"float"}) + `\b([a-zA-Z0-9-._+=]{59,60})\b`)
+ keyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"float"}) + `\b([a-zA-Z0-9-._+=/]{59,60})\b`)
)
// Keywords are used for efficiently pre-filtering chunks.
@@ -53,6 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
continue
}
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))
+ req.Header.Add("User-Agent", "TruffleHog3 ([email protected])")
res, err := client.Do(req)
if err == nil {
defer res.Body.Close()
diff --git a/pkg/detectors/float/float_test.go b/pkg/detectors/float/float_test.go
index 020a8136b..dc7e38701 100644
--- a/pkg/detectors/float/float_test.go
+++ b/pkg/detectors/float/float_test.go
@@ -10,9 +10,9 @@ import (
"time"
"github.com/kylelemons/godebug/pretty"
- "github.com/trufflesecurity/trufflehog/v3/pkg/detectors"
"github.com/trufflesecurity/trufflehog/v3/pkg/common"
+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors"
"github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb"
)