Skip to content

Commit

Permalink
fix: user sanitization should clean up email change info too (#1759)
Browse files Browse the repository at this point in the history
The `sanitizeUser` function did not cleanup the **EmailChange** and
**EmailChangeSentAt** properties on a User. If a User had a pending
email address change, the new address could be leaked via a crafted
`signUp` request.
  • Loading branch information
staaldraad authored Sep 3, 2024
1 parent 7009202 commit 9d419b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/api/signup.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,9 @@ func sanitizeUser(u *models.User, params *SignupParams) (*models.User, error) {

u.ID = uuid.Must(uuid.NewV4())

u.Role = ""
u.Role, u.EmailChange = "", ""
u.CreatedAt, u.UpdatedAt, u.ConfirmationSentAt = now, now, &now
u.LastSignInAt, u.ConfirmedAt, u.EmailConfirmedAt, u.PhoneConfirmedAt = nil, nil, nil, nil
u.LastSignInAt, u.ConfirmedAt, u.EmailChangeSentAt, u.EmailConfirmedAt, u.PhoneConfirmedAt = nil, nil, nil, nil, nil
u.Identities = make([]models.Identity, 0)
u.UserMetaData = params.Data
u.Aud = params.Aud
Expand Down

0 comments on commit 9d419b4

Please sign in to comment.