mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-04 08:17:24 -05:00
Add sensitive headers (#3429)
* Add HeaderWithSensitiveCase methods to respect casing * Update webhook.go
This commit is contained in:
parent
d09704e903
commit
b3fd94c13d
@ -588,8 +588,8 @@ func (t *HookTask) deliver() {
|
||||
Header("X-Gitea-Event", string(t.EventType)).
|
||||
Header("X-Gogs-Delivery", t.UUID).
|
||||
Header("X-Gogs-Event", string(t.EventType)).
|
||||
Header("X-GitHub-Delivery", t.UUID).
|
||||
Header("X-GitHub-Event", string(t.EventType)).
|
||||
HeaderWithSensitiveCase("X-GitHub-Delivery", t.UUID).
|
||||
HeaderWithSensitiveCase("X-GitHub-Event", string(t.EventType)).
|
||||
SetTLSClientConfig(&tls.Config{InsecureSkipVerify: setting.Webhook.SkipTLSVerify})
|
||||
|
||||
switch t.ContentType {
|
||||
|
@ -164,6 +164,12 @@ func (r *Request) Header(key, value string) *Request {
|
||||
return r
|
||||
}
|
||||
|
||||
// HeaderWithSensitiveCase add header item in request and keep the case of the header key.
|
||||
func (r *Request) HeaderWithSensitiveCase(key, value string) *Request {
|
||||
r.req.Header[key] = []string{value}
|
||||
return r
|
||||
}
|
||||
|
||||
// Headers returns headers in request.
|
||||
func (r *Request) Headers() http.Header {
|
||||
return r.req.Header
|
||||
|
Loading…
Reference in New Issue
Block a user