Skip to content

Commit

Permalink
fixed github issue 3774 for custom detector secret size (trufflesecur…
Browse files Browse the repository at this point in the history
  • Loading branch information
kashifkhan0771 authored Dec 25, 2024
1 parent ddc015e commit def734a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/custom_detectors/custom_detectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit def734a

Please sign in to comment.