Skip to content

Commit 96a42dd

Browse files
committed
add decision document for changing email
1 parent 0d631ad commit 96a42dd

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

docs/decisions/024-change-email.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Change Email
2+
3+
Date: 2023-07-26
4+
5+
Status: accepted
6+
7+
## Context
8+
9+
For most websites, the user's email is the primary mechanism for authenticity.
10+
You sign up with your email, password reset involves the email, and often you
11+
sign in with your email.
12+
13+
For various reasons, users may wish to maintain their account data, but change
14+
their email address. There are a few important considerations for managing this:
15+
16+
1. The user may no longer have access to the current email address.
17+
1. If the user typos their email address, then they may lose access to their
18+
account.
19+
1. If an adversary gets temporary access to a user's account, they may be able
20+
to change the victim's email address to one they own.
21+
22+
There are a few ways to address these concerns. Here are a few things you could
23+
do (some in combination)
24+
25+
- Let the user change the email with no validation
26+
- Notify the new email address of the change
27+
- Notify the old email address of the change
28+
- Require confirmation of the new address before allowing the change
29+
- Require confirmation of the old address before allowing the change
30+
- Require a two-factor code before allowing the change
31+
32+
The ultimate secure approach would be:
33+
34+
- Require a two-factor code and confirmation from the old and new address before
35+
allowing the change.
36+
37+
This has a few problems:
38+
39+
1. Not all users have 2FA enabled
40+
2. Users don't always have access to their old address
41+
42+
If you really needed that level of security, you could require 2FA and users
43+
could reach out to support if they don't have access to the old email to plead
44+
their case.
45+
46+
However, there's a middle-ground:
47+
48+
- Require a two-factor code from users who have it enabled, receive confirmation
49+
of the new address, and notify the old address.
50+
51+
This strikes a good balance of being easy for the user, reducing the number of
52+
support requests, and security.
53+
54+
## Decision
55+
56+
We're going to require recent (within the last 2 hours) verification of the
57+
two-factor code if the user has it enabled, require confirmation of the new
58+
address, and notify the old address of the change.
59+
60+
## Consequences
61+
62+
This will require supporting a mechanism for tracking when the last 2FA code was
63+
entered (just storing the time in the session). This will also require a new
64+
verification for confirming the new address (utilizing existing verification
65+
utilities we have for onboarding the user in the first place).
66+
67+
It's a little bit more complicated than just letting the user change their email
68+
address, but will hopefully reduce the problems described.

0 commit comments

Comments
 (0)