diff --git a/pkg/custom_detectors/custom_detectors.go b/pkg/custom_detectors/custom_detectors.go index b63eb3972b09..bb296db8cdc6 100644 --- a/pkg/custom_detectors/custom_detectors.go +++ b/pkg/custom_detectors/custom_detectors.go @@ -6,6 +6,7 @@ import ( "encoding/json" "net/http" "regexp" + "strings" "github.com/trufflesecurity/trufflehog/v3/pkg/common" "github.com/trufflesecurity/trufflehog/v3/pkg/detectors" @@ -114,6 +115,14 @@ func (c *customRegexWebhook) FromData(ctx context.Context, verify bool, data []b return results, nil } req, err := http.NewRequestWithContext(ctx, "POST", verifyConfig.GetEndpoint(), bytes.NewReader(jsonBody)) + for _, header := range verifyConfig.GetHeaders() { + key, value, found := strings.Cut(header, ":") + if !found { + // Should be unreachable due to validation. + continue + } + req.Header.Add(key, strings.TrimLeft(value, "\t\n\v\f\r ")) + } if err != nil { continue }