Skip to content

Find, verify, and analyze leaked credentials

chore(gcp): ignore known test creds (#2413)

Richard Gomez9572628dc6d3
diff --git a/pkg/detectors/gcp/gcp.go b/pkg/detectors/gcp/gcp.go
index dc5836833..6d1993e62 100644
--- a/pkg/detectors/gcp/gcp.go
+++ b/pkg/detectors/gcp/gcp.go
@@ -1,14 +1,17 @@
package gcp
import (
+ "bytes"
"context"
"encoding/json"
- regexp "github.com/wasilibs/go-re2"
"strings"
+ regexp "github.com/wasilibs/go-re2"
+
+ "golang.org/x/oauth2/google"
+
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors"
"github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb"
- "golang.org/x/oauth2/google"
)
type Scanner struct{}
@@ -78,6 +81,11 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
if len(raw) == 0 {
raw = []byte(key)
}
+ // This is an unprivileged service account used in Kubernetes' tests. It is intentionally public.
+ // https://github.com/kubernetes/kubernetes/blob/10a06602223eab17e02e197d1da591727c756d32/test/e2e_node/runtime_conformance_test.go#L50
+ if bytes.Equal(raw, []byte("image-pulling@authenticated-image-pulling.iam.gserviceaccount.com")) {
+ continue
+ }
credBytes, _ := json.Marshal(creds)