-
Notifications
You must be signed in to change notification settings - Fork 266
Open
Description
[REQUIRED] Step 2: Describe your environment
- Operating System version: Mac OS
- Firebase SDK version: v3.12.0
- Library version: v3.12.0 (? not sure which library do you mean here)
- Firebase Product: auth (auth, database, storage, etc)
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
The email validation func checks if the split over @
results in 2 parts:
firebase-admin-go/auth/user_mgt.go
Lines 461 to 463 in 32728b0
if parts := strings.Split(email, "@"); len(parts) != 2 || parts[0] == "" || parts[1] == "" { | |
return fmt.Errorf("malformed email string: %q", email) | |
} |
But this risks rejecting valid email address. These are all valid email addresses:
- Abc\@[email protected]
- "Abc@def"@example.com
- "<"@\".!.#%[email protected]
which the library will reject. The recommendation per Stavros Korokithakis is to check if there's an @ symbol and try to send an email to it. If they click the validation link, then it's a real address. So replace the prior snippet with:
Relevant Code:
Current code:
firebase-admin-go/auth/user_mgt.go
Lines 461 to 463 in 32728b0
if parts := strings.Split(email, "@"); len(parts) != 2 || parts[0] == "" || parts[1] == "" { | |
return fmt.Errorf("malformed email string: %q", email) | |
} |
Suggested replacement:
if !strings.Contains(email, "@") {
return fmt.Errorf("malformed email string: %q", email)
}
References: