

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Authentication
incomplete
2: Stateless vs. Stateful Authentication
incomplete
3: What Are Sessions?
incomplete
4: What Are Cookies?
incomplete
5: Cookie Security
incomplete
6: Session Lifetime
incomplete
7: Password Resets
incomplete
8: Broken Password Reset Flow
incomplete
9: OAuth 2.0
incomplete
10: SAML and OIDC
incomplete
11: API Keys
incomplete
12: Reauthentication
incomplete
13: Authentication Misconceptions
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
We all forget passwords. So, as developers, we have no choice but to offer password recovery. But with that come some pretty big risks.
Instead of authenticating with their password (because they presumably forgot it), the user proves control of something else: in most cases, their email inbox. So, now their email address is just as viable an attack vector as the password itself!
Most reset vulnerabilities come from several predictable mistakes:
A password reset token should be treated like a temporary password, so it should be:
The underlying assumption here is that the user's email is both secure and private... which is not always true for every user. So, password resets should also always be accompanied by a notification to the user via any other communications channels (sms, push, email) and should invalidate existing sessions.
Bearly Secure's password reset tokens are predictable, the provided hashing helper doesn't hash anything, and tokens remain valid for an hour. The routes also bypass the provided validation and atomic reset helpers.
Replace the insecure implementations and connect the provided password-reset helpers.
With Bearly Secure still running, run and submit the CLI tests from the project root.