fixed github issue 3774 for custom detector secret size (#3816)

This commit is contained in:
Kashif Khan
2024-12-25 11:14:22 -08:00
committed by GitHub
parent ddc015e5ed
commit def734a783
+6
View File
@@ -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.