This repository was archived by the owner on Sep 30, 2024. It is now read-only.
email: do not send certain emails to unverified emails#46184
Merged
Conversation
Member
Author
|
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
e60c2a0 to
6b80bb1
Compare
01bfde0 to
5b40d8f
Compare
Bundle size report 📦
Look at the Statoscope report for a full comparison between the commits 58b69df and 1d331cd or learn more. Open explanation
|
5b40d8f to
ab399f9
Compare
6b80bb1 to
fc4644e
Compare
ab399f9 to
5a20b9f
Compare
fc4644e to
ad68c3d
Compare
5a20b9f to
75e7b2c
Compare
ad68c3d to
fb5a412
Compare
75e7b2c to
d1a6bd6
Compare
fb5a412 to
863f3b3
Compare
1c50b9a to
3ef8164
Compare
863f3b3 to
c9913ac
Compare
3ef8164 to
78a3acc
Compare
Contributor
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff 1d331cd...58b69df.
|
unknwon
approved these changes
Jan 6, 2023
Contributor
unknwon
left a comment
There was a problem hiding this comment.
Approve to unblock, just one minor issue
470cc9e to
85d7ee6
Compare
78a3acc to
a28f30a
Compare
limitedmage
approved these changes
Jan 6, 2023
Contributor
limitedmage
left a comment
There was a problem hiding this comment.
EmailAction.tsx looks good! Didn't review the Go code.
Base automatically changed from
01-05-client_remove_deprecated_authenticatedUser.email
to
main
January 6, 2023 18:46
Co-authored-by: Joe Chen <joe@sourcegraph.com>
6611218 to
6cf4633
Compare
evict
approved these changes
Jan 10, 2023
bobheadxi
referenced
this pull request
Jan 25, 2023
Today, users created with `mutation { createUser }` automatically have their emails marked as verified, even if the email is bogus. This could cause us to automatically send potentially large numbers of emails automatically to nonexistent email addresses (see sourcegraph/customer#1790). To mitigate this, this change marks the emails of created users as unverified if SMTP is configured.
This has implications for Cloud instances, where `mutation { createUser }` is frequently used to create initial admin users. After this change, these users may receive a more limited set of emails (i.e. https://github.com/sourcegraph/sourcegraph/pull/46184) and have limited capabilities (i.e. unable to link account via external service) until they verify their email by:
1. using a "set password" or "reset password" link delivered by email (https://github.com/sourcegraph/sourcegraph/pull/46307)
1. using "verify email" in user settings to send an email verification
3. a site admin verifying the user email manually via `setUserEmailVerified` mutation or UI
## Test plan
<!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles -->
I've added new unit tests that cover the old and new set password behaviour on the mutation.
Manual test:
1. `sg start`, configured with SMTP in `dev-private`
2. Site admin -> users -> create `testuser` with email
3. Site admin -> users -> `testuser` -> emails -> primary email is unverified
4. Log out
5. CLick password reset link in email
6. Log in
7. User -> emails -> primary email is verified
Co-authored-by: Joe Chen <joe@sourcegraph.com>
Co-authored-by: Milan Freml <kopancek@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

We should seek to avoid damaging email reputations by validating if emails are verified before sending certain types of potentially high-frequency, non-essential emails to user primary emails, in this change:
In practice, at the moment only builtin auth signups will create accounts that have unverified primary emails. External service accounts are created with primary emails already verified, and so are those created with the
createUsermutation (which I am hoping to change in https://github.com/sourcegraph/sourcegraph/pull/46187).Today, a user could create a user, which automatically marks the email as verified, and then proceed to set up a code monitor that accidentally sends large numbers of emails that all bounce, which has implications for Cloud's managed SMTP services.
The risk: there was at least one incident recently where a small number of code monitors issued over a thousand emails in a few days due to an unforeseen issue with retry handling (https://github.com/sourcegraph/sourcegraph/pull/45641), and at least one instance of a user creating an account with an invalid email.
Stacked on https://github.com/sourcegraph/sourcegraph/pull/46183
Test plan