Skip to content

Commit

Permalink
always use a validated userId for alerts configs
Browse files Browse the repository at this point in the history
If a user were to put some arbitrary value in the userId field of their
invitation, we should not use it, but rather the userId of the user making the
request, which has been validated already.

Thanks again to Brian for finding this edge case.

BACK-2500
  • Loading branch information
ewollesen committed Jan 23, 2024
1 parent 09e04e3 commit 84043db
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions api/invite.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,8 @@ func (a *Api) AcceptInvite(res http.ResponseWriter, req *http.Request, vars map[
a.sendError(ctx, res, http.StatusBadRequest, STATUS_ERR_DECODING_CONTEXT)
return
}
// In the event that the invitee didn't have a user account when they
// were invited, this could be empty. Since they're accepting the
// invite now, they clearly have a userID, so we can populate that
// field now.
if ctc.AlertsConfig != nil && ctc.AlertsConfig.UserID == "" {

if ctc.AlertsConfig != nil {
ctc.AlertsConfig.UserID = inviteeID
}

Expand Down

0 comments on commit 84043db

Please sign in to comment.