Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
remove path for deduping URI
Dustin Decker5f0964add816
diff --git a/pkg/detectors/uri/uri.go b/pkg/detectors/uri/uri.goindex 9112eaed7..430fa0110 100644--- a/pkg/detectors/uri/uri.go+++ b/pkg/detectors/uri/uri.go@@ -69,11 +69,14 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultcontinue}- redact := strings.TrimSpace(strings.Replace(urlMatch, password, strings.Repeat("*", len(password)), -1))+ rawURL, _ := url.Parse(urlMatch)+ rawURL.Path = ""++ redact := strings.TrimSpace(strings.Replace(rawURL.String(), password, strings.Repeat("*", len(password)), -1))s := detectors.Result{DetectorType: detectorspb.DetectorType_URI,- Raw: []byte(urlMatch),+ Raw: []byte(rawURL.String()),Redacted: redact,}diff --git a/pkg/detectors/uri/uri_test.go b/pkg/detectors/uri/uri_test.goindex 012b5d846..1cd024e3f 100644--- a/pkg/detectors/uri/uri_test.go+++ b/pkg/detectors/uri/uri_test.go@@ -38,7 +38,7 @@ func TestURI_FromChunk(t *testing.T) {{DetectorType: detectorspb.DetectorType_URI,Verified: false,- Redacted: "https://user:****@www.httpwatch.com/httpgallery/authentication/authenticatedimage/default.aspx",+ Redacted: "https://user:****@www.httpwatch.com",},},wantErr: false,@@ -55,7 +55,7 @@ func TestURI_FromChunk(t *testing.T) {{DetectorType: detectorspb.DetectorType_URI,Verified: true,- Redacted: "https://httpwatch:****@www.httpwatch.com/httpgallery/authentication/authenticatedimage/default.aspx",+ Redacted: "https://httpwatch:****@www.httpwatch.com",},},wantErr: false,@@ -72,7 +72,7 @@ func TestURI_FromChunk(t *testing.T) {{DetectorType: detectorspb.DetectorType_URI,Verified: true,- Redacted: "https://httpwatch:****@www.httpwatch.com/httpgallery/authentication/authenticatedimage/default.aspx",+ Redacted: "https://httpwatch:****@www.httpwatch.com",},},wantErr: false,