Skip to content

Commit

Permalink
Add headers from configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
mcastorina committed Dec 8, 2022
1 parent f7e59d7 commit 7bd4245
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/custom_detectors/custom_detectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -117,6 +118,14 @@ func (c *customRegexWebhook) FromData(ctx context.Context, verify bool, data []b
if err != nil {
continue
}
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 "))
}
res, err := httpClient.Do(req)
if err != nil {
continue
Expand Down

0 comments on commit 7bd4245

Please sign in to comment.