Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
fix(detectors/posthog): widen phx_ key body to {43,48} (#5133)
matt05a583290be8
diff --git a/pkg/detectors/posthog/posthog.go b/pkg/detectors/posthog/posthog.goindex f8920d482..1f884085f 100644--- a/pkg/detectors/posthog/posthog.go+++ b/pkg/detectors/posthog/posthog.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(`\b(phx_[a-zA-Z0-9_]{43})\b`)+ keyPat = regexp.MustCompile(`\b(phx_[a-zA-Z0-9_]{43,48})\b`))// Keywords are used for efficiently pre-filtering chunks.diff --git a/pkg/detectors/posthog/posthog_test.go b/pkg/detectors/posthog/posthog_test.goindex 923bbc170..006140607 100644--- a/pkg/detectors/posthog/posthog_test.go+++ b/pkg/detectors/posthog/posthog_test.go@@ -13,6 +13,7 @@ import (var (validPattern = "phx_C1rP9fnAtEFJvb0IYCFdeQhar2WdwUFBYHJym1F_Zqr"+ validPattern48 = "phx_C1rP9fnAtEFJvb0IYCFdeQhar2WdwUFBYHJym1F_ZqrAbcde"invalidPattern = "phx_C1rP9fnAtEFJvb0IYCF?eQhar2WdwUFBYHJym1F_Zqr"keyword = "posthog")@@ -30,6 +31,11 @@ func TestAppPosthog_Pattern(t *testing.T) {input: fmt.Sprintf("%s token = '%s'", keyword, validPattern),want: []string{validPattern},},+ {+ name: "valid pattern 48 chars - with keyword posthog",+ input: fmt.Sprintf("%s token = '%s'", keyword, validPattern48),+ want: []string{validPattern48},+ },{name: "invalid pattern",input: fmt.Sprintf("%s = '%s'", keyword, invalidPattern),