Automatic Merge
Этот коммит содержится в:
Mattermost Build
2025-09-01 16:34:06 +03:00
коммит произвёл GitHub
родитель ef896a4ea6
Коммит 27fadafead
2 изменённых файлов: 3 добавлений и 2 удалений

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

@@ -6,6 +6,7 @@ package app
import ( import (
"bytes" "bytes"
"context" "context"
"crypto/subtle"
b64 "encoding/base64" b64 "encoding/base64"
"encoding/json" "encoding/json"
"fmt" "fmt"
@@ -279,7 +280,7 @@ func (a *App) GetOAuthAccessTokenForCodeFlow(c request.CTX, clientId, grantType,
return nil, model.NewAppError("GetOAuthAccessToken", "api.oauth.get_access_token.credentials.app_error", nil, "", http.StatusNotFound).Wrap(nErr) return nil, model.NewAppError("GetOAuthAccessToken", "api.oauth.get_access_token.credentials.app_error", nil, "", http.StatusNotFound).Wrap(nErr)
} }
if oauthApp.ClientSecret != secret { if subtle.ConstantTimeCompare([]byte(oauthApp.ClientSecret), []byte(secret)) == 0 {
return nil, model.NewAppError("GetOAuthAccessToken", "api.oauth.get_access_token.credentials.app_error", nil, "", http.StatusForbidden) return nil, model.NewAppError("GetOAuthAccessToken", "api.oauth.get_access_token.credentials.app_error", nil, "", http.StatusForbidden)
} }

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

@@ -53,7 +53,7 @@ func (a *App) CreateSession(c request.CTX, session *model.Session) (*model.Sessi
func (a *App) GetCloudSession(token string) (*model.Session, *model.AppError) { func (a *App) GetCloudSession(token string) (*model.Session, *model.AppError) {
apiKey := os.Getenv("MM_CLOUD_API_KEY") apiKey := os.Getenv("MM_CLOUD_API_KEY")
if apiKey != "" && apiKey == token { if apiKey != "" && subtle.ConstantTimeCompare([]byte(apiKey), []byte(token)) == 1 {
// Need a bare-bones session object for later checks // Need a bare-bones session object for later checks
session := &model.Session{ session := &model.Session{
Token: token, Token: token,