Skip to content

Find, verify, and analyze leaked credentials

Use defautl endpoints when no custom verifier provided. (#1242)

ahravf107e1b49792
diff --git a/pkg/detectors/github/github.go b/pkg/detectors/github/github.go
index 7b08ab085..cda1c7098 100644
--- a/pkg/detectors/github/github.go
+++ b/pkg/detectors/github/github.go
@@ -82,6 +82,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
matches := keyPat.FindAllStringSubmatch(dataStr, -1)
+ if len(s.verifierURLs) == 0 {
+ s.verifierURLs = append(s.verifierURLs, defaultURL)
+ }
+
for _, match := range matches {
// First match is entire regex, second is the first group.
if len(match) != 2 {
diff --git a/pkg/detectors/gitlab/gitlab.go b/pkg/detectors/gitlab/gitlab.go
index bc7990d7a..6fe1d11ed 100644
--- a/pkg/detectors/gitlab/gitlab.go
+++ b/pkg/detectors/gitlab/gitlab.go
@@ -63,6 +63,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
matches := keyPat.FindAllStringSubmatch(dataStr, -1)
+ if len(s.verifierURLs) == 0 {
+ s.verifierURLs = append(s.verifierURLs, defaultURL)
+ }
+
for _, match := range matches {
if len(match) != 2 {
continue
diff --git a/pkg/detectors/gitlabv2/gitlab.go b/pkg/detectors/gitlabv2/gitlab.go
index ffc0b7bf8..41f62c419 100644
--- a/pkg/detectors/gitlabv2/gitlab.go
+++ b/pkg/detectors/gitlabv2/gitlab.go
@@ -62,6 +62,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
matches := keyPat.FindAllStringSubmatch(dataStr, -1)
+ if len(s.verifierURLs) == 0 {
+ s.verifierURLs = append(s.verifierURLs, defaultURL)
+ }
+
for _, match := range matches {
if len(match) != 2 {
continue