From def734a783b2d4542f2b353d326130d618f3c421 Mon Sep 17 00:00:00 2001 From: Kashif Khan <70996046+kashifkhan0771@users.noreply.github.com> Date: Thu, 26 Dec 2024 00:14:22 +0500 Subject: [PATCH] fixed github issue 3774 for custom detector secret size (#3816) --- pkg/custom_detectors/custom_detectors.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/custom_detectors/custom_detectors.go b/pkg/custom_detectors/custom_detectors.go index 2403661a29cd..d43950b81005 100644 --- a/pkg/custom_detectors/custom_detectors.go +++ b/pkg/custom_detectors/custom_detectors.go @@ -32,6 +32,7 @@ type CustomRegexWebhook struct { // Ensure the Scanner satisfies the interface at compile time. var _ detectors.Detector = (*CustomRegexWebhook)(nil) var _ detectors.CustomFalsePositiveChecker = (*CustomRegexWebhook)(nil) +var _ detectors.MaxSecretSizeProvider = (*CustomRegexWebhook)(nil) // NewWebhookCustomRegex initializes and validates a CustomRegexWebhook. An // unexported type is intentionally returned here to ensure the values have @@ -115,6 +116,11 @@ func (c *CustomRegexWebhook) IsFalsePositive(_ detectors.Result) (bool, string) return false, "" } +// custom max size for custom detector +func (c *CustomRegexWebhook) MaxSecretSize() int64 { + return 1000 +} + func (c *CustomRegexWebhook) createResults(ctx context.Context, match map[string][]string, verify bool, results chan<- detectors.Result) error { if common.IsDone(ctx) { // TODO: Log we're possibly leaving out results.