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 4b99b42
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/custom_detectors/custom_detectors.go
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 @@ -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
}
Expand Down

0 comments on commit 4b99b42

Please sign in to comment.