feat(backend): added projectID check for getUXTest endpoint
This commit is contained in:
parent
42e0fdb71e
commit
3de478650e
1 changed files with 10 additions and 1 deletions
|
|
@ -377,7 +377,7 @@ func (e *Router) getUXTestInfo(w http.ResponseWriter, r *http.Request) {
|
|||
bodySize := 0
|
||||
|
||||
// Check authorization
|
||||
_, err := e.services.Tokenizer.ParseFromHTTPRequest(r)
|
||||
sessInfo, err := e.services.Tokenizer.ParseFromHTTPRequest(r)
|
||||
if err != nil {
|
||||
ResponseWithError(w, http.StatusUnauthorized, err, startTime, r.URL.Path, bodySize)
|
||||
return
|
||||
|
|
@ -393,6 +393,15 @@ func (e *Router) getUXTestInfo(w http.ResponseWriter, r *http.Request) {
|
|||
ResponseWithError(w, http.StatusInternalServerError, err, startTime, r.URL.Path, bodySize)
|
||||
return
|
||||
}
|
||||
sess, err := e.services.Sessions.Get(sessInfo.ID)
|
||||
if err != nil {
|
||||
ResponseWithError(w, http.StatusForbidden, err, startTime, r.URL.Path, bodySize)
|
||||
return
|
||||
}
|
||||
if sess.ProjectID != info.ProjectID {
|
||||
ResponseWithError(w, http.StatusForbidden, errors.New("project mismatch"), startTime, r.URL.Path, bodySize)
|
||||
return
|
||||
}
|
||||
type TaskInfoResponse struct {
|
||||
Task *uxtesting.UXTestInfo `json:"test"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue