mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user