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 ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d33ef8d79c
Коммит
773ec991a8
@@ -18,8 +18,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (w *Web) InitWebhooks() {
|
func (w *Web) InitWebhooks() {
|
||||||
w.MainRouter.Handle("/hooks/commands/{id:[A-Za-z0-9]+}", w.NewHandler(commandWebhook)).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.NewHandler(incomingWebhook)).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) {
|
func incomingWebhook(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user