MM-35344: Trust Requester for webhook endpoints (#19855)

Without this, the endpoint throws CSRF warnings
if a token is passed.

https://mattermost.atlassian.net/browse/MM-35344

```release-note
NONE
```
This commit is contained in:
Agniva De Sarker
2022-03-29 14:42:29 +05:30
committed by GitHub
parent d33ef8d79c
commit 773ec991a8

View File

@@ -18,8 +18,8 @@ import (
)
func (w *Web) InitWebhooks() {
w.MainRouter.Handle("/hooks/commands/{id:[A-Za-z0-9]+}", w.NewHandler(commandWebhook)).Methods("POST")
w.MainRouter.Handle("/hooks/{id:[A-Za-z0-9]+}", w.NewHandler(incomingWebhook)).Methods("POST")
w.MainRouter.Handle("/hooks/commands/{id:[A-Za-z0-9]+}", w.APIHandlerTrustRequester(commandWebhook)).Methods("POST")
w.MainRouter.Handle("/hooks/{id:[A-Za-z0-9]+}", w.APIHandlerTrustRequester(incomingWebhook)).Methods("POST")
}
func incomingWebhook(c *Context, w http.ResponseWriter, r *http.Request) {