Automatic Merge
Этот коммит содержится в:
Christopher Poile
2026-03-27 02:30:55 -04:00
коммит произвёл GitHub
родитель c64ff9d84e
Коммит c654f0502f
4 изменённых файлов: 168 добавлений и 2 удалений

Просмотреть файл

@@ -475,11 +475,23 @@ func (a *App) tryExecuteCustomCommand(c request.CTX, args *model.CommandArgs, tr
p[key] = values
}
// Use configured SiteURL for response_url to prevent SSRF via Host header spoofing (MM-67142)
siteURL := *a.Config().ServiceSettings.SiteURL
if siteURL == "" {
return cmd, nil, model.NewAppError("tryExecuteCustomCommand", "api.command.execute_command.site_url_required.app_error", nil, "", http.StatusBadRequest)
}
if siteURL != args.SiteURL {
c.Logger().Warn(i18n.T("api.command.execute_command.provided_site_url_different.app_error"),
mlog.String("request_host", args.SiteURL),
mlog.String("configured_site_url", siteURL),
mlog.String("command", trigger))
}
hook, appErr := a.CreateCommandWebhook(cmd.Id, args)
if appErr != nil {
return cmd, nil, model.NewAppError("command", "api.command.execute_command.failed.app_error", map[string]any{"Trigger": trigger}, "", http.StatusInternalServerError).Wrap(appErr)
}
p.Set("response_url", args.SiteURL+"/hooks/commands/"+hook.Id)
p.Set("response_url", siteURL+"/hooks/commands/"+hook.Id)
return a.DoCommandRequest(c, cmd, p)
}