Skip to content

feat: use signed-urls for email confirmation#81044

Merged
mdtro merged 18 commits into
masterfrom
mdtro/signed-urls-email-confirm
Jan 10, 2025
Merged

feat: use signed-urls for email confirmation#81044
mdtro merged 18 commits into
masterfrom
mdtro/signed-urls-email-confirm

Conversation

@mdtro

@mdtro mdtro commented Nov 20, 2024

Copy link
Copy Markdown
Contributor

We currently allow secondary emails to be added to accounts without verification. This leads to subtle bugs, some with security implications.

This PR adds an option to transition use to signed URLs to add secondary emails on accounts. Instead of adding the email address immediately to the account in an unverified state, a signed URL is generated and emailed to the email address. The secondary email is not added to the account.

Once clicked, the signed URL is verified and if valid, the secondary email is added to the user's account as a verified address.

Here's what it will look like in the frontend after submitting the form with a new email:
image

If you submit it with one that's already on your account:
image

Frontend PR will follow. The option that gates this functionality will not be enabled until the frontend PR is deployed.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 20, 2024
@mdtro mdtro changed the title Mdtro/signed urls email confirm feat: use signed-urls for email confirmation Nov 20, 2024
@codecov

codecov Bot commented Nov 20, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 86.58537% with 22 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/users/api/endpoints/user_emails.py 52.38% 10 Missing ⚠️
src/sentry/users/web/accounts.py 87.93% 7 Missing ⚠️
src/sentry/users/models/user.py 16.66% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #81044       +/-   ##
===========================================
+ Coverage   50.28%   87.58%   +37.30%     
===========================================
  Files        9371     9460       +89     
  Lines      535758   537011     +1253     
  Branches    21113    21113               
===========================================
+ Hits       269409   470361   +200952     
+ Misses     265991    66292   -199699     
  Partials      358      358               

@cathteng cathteng left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this will work on the backend but i'm curious what the user experience will be like

Comment thread src/sentry/users/web/accounts.py
Comment thread src/sentry/users/api/endpoints/user_emails.py Outdated
Comment thread src/sentry/users/api/endpoints/user_emails.py
Comment thread src/sentry/users/web/accounts.py Outdated
Comment thread src/sentry/users/web/accounts.py Outdated
@mdtro mdtro merged commit ed98d78 into master Jan 10, 2025
@mdtro mdtro deleted the mdtro/signed-urls-email-confirm branch January 10, 2025 15:52
mdtro added a commit that referenced this pull request Jan 10, 2025
Frontend changes to support #81044 

Here's what it will look like in the frontend after submitting the form
with a new email:
<img width="1280" alt="image"
src="https://github.com/user-attachments/assets/6f06e89b-a1d2-40eb-a4a4-1e860e07d57d"
/>

If you submit it with one that's already on your account:
<img width="1280" alt="image"
src="https://github.com/user-attachments/assets/57daad3f-e129-4176-ba9a-fc36c73b11ea"
/>
andrewshie-sentry pushed a commit that referenced this pull request Jan 22, 2025
We currently allow secondary emails to be added to accounts without
verification. This leads to subtle bugs, some with security
implications.

This PR adds an option to transition use to signed URLs to add secondary
emails on accounts. Instead of adding the email address immediately to
the account in an unverified state, a signed URL is generated and
emailed to the email address. The secondary email is not added to the
account.

Once clicked, the signed URL is verified and if valid, the secondary
email is added to the user's account as a verified address.

Here's what it will look like in the frontend after submitting the form
with a new email:
<img width="1280" alt="image"
src="https://github.com/user-attachments/assets/6f06e89b-a1d2-40eb-a4a4-1e860e07d57d"
/>

If you submit it with one that's already on your account:
<img width="1280" alt="image"
src="https://github.com/user-attachments/assets/57daad3f-e129-4176-ba9a-fc36c73b11ea"
/>

Frontend PR will follow. The option that gates this functionality will
not be enabled until the frontend PR is deployed.
andrewshie-sentry pushed a commit that referenced this pull request Jan 22, 2025
Frontend changes to support #81044 

Here's what it will look like in the frontend after submitting the form
with a new email:
<img width="1280" alt="image"
src="https://github.com/user-attachments/assets/6f06e89b-a1d2-40eb-a4a4-1e860e07d57d"
/>

If you submit it with one that's already on your account:
<img width="1280" alt="image"
src="https://github.com/user-attachments/assets/57daad3f-e129-4176-ba9a-fc36c73b11ea"
/>
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants