Skip to content

Commit 9d419b4

Browse files
authored
fix: user sanitization should clean up email change info too (#1759)
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.
1 parent 7009202 commit 9d419b4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/api/signup.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,9 @@ func sanitizeUser(u *models.User, params *SignupParams) (*models.User, error) {
336336

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

339-
u.Role = ""
339+
u.Role, u.EmailChange = "", ""
340340
u.CreatedAt, u.UpdatedAt, u.ConfirmationSentAt = now, now, &now
341-
u.LastSignInAt, u.ConfirmedAt, u.EmailConfirmedAt, u.PhoneConfirmedAt = nil, nil, nil, nil
341+
u.LastSignInAt, u.ConfirmedAt, u.EmailChangeSentAt, u.EmailConfirmedAt, u.PhoneConfirmedAt = nil, nil, nil, nil, nil
342342
u.Identities = make([]models.Identity, 0)
343343
u.UserMetaData = params.Data
344344
u.Aud = params.Aud

0 commit comments

Comments
 (0)