Skip to content

Session revocation support for password reset - #775

Open
dowski wants to merge 1 commit into
rebootfrom
dowski/revoke-sessions-on-password-reset
Open

dowski wants to merge 1 commit into
rebootfrom
dowski/revoke-sessions-on-password-reset

Conversation

@dowski

@dowski dowski commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

When a user resets their password, by default their other sessions will be revoked. This is optional and an app can choose to present a UI to give the user the choice or set its own value.

@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
auth-v2 Ready Ready Preview Oct 27, 2026 3:32pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
convex-auth-docs Ignored Ignored Oct 27, 2026 3:32pm UTC

Request Review

dowski commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

@pkg-pr-new

pkg-pr-new Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
npm i https://pkg.pr.new/@convex-dev/auth@775

commit: da882d6

@dowski dowski changed the title Default-revoke other sessions when a user resets their password Session revokation support Oct 22, 2026
@dowski dowski changed the title Session revokation support Session revocation support for password reset Oct 22, 2026
@dowski
dowski marked this pull request as ready for review October 22, 2026 21:44

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 8 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/core/src/methods/email-password/server.ts">

<violation number="1" location="packages/core/src/methods/email-password/server.ts:602">
P1: This revokes sessions only for `changePassword`; `completePasswordRecovery` still changes the password and mints a session without revoking existing sessions. Revoke all pre-existing sessions in the recovery path before minting the replacement session, so a stolen refresh token cannot survive an email password reset.</violation>
</file>

Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack

Re-trigger cubic

// The current password was just verified, so the caller owns this
// session: sign out the user's other sessions, which may belong to
// whoever knew the old password.
if (signOutOtherSessions) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: This revokes sessions only for changePassword; completePasswordRecovery still changes the password and mints a session without revoking existing sessions. Revoke all pre-existing sessions in the recovery path before minting the replacement session, so a stolen refresh token cannot survive an email password reset.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/core/src/methods/email-password/server.ts, line 602:

<comment>This revokes sessions only for `changePassword`; `completePasswordRecovery` still changes the password and mints a session without revoking existing sessions. Revoke all pre-existing sessions in the recovery path before minting the replacement session, so a stolen refresh token cannot survive an email password reset.</comment>

<file context>
@@ -592,6 +596,13 @@ export function setupEmailPassword<UsersTable extends string>(
+            // The current password was just verified, so the caller owns this
+            // session: sign out the user's other sessions, which may belong to
+            // whoever knew the old password.
+            if (signOutOtherSessions) {
+              await ctx.convexAuth.revokeOtherSessions();
+            }
</file context>

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That's in another PR.

@dowski
dowski force-pushed the dowski/revoke-session-handle branch from afe8173 to fcde1bf Compare October 23, 2026 20:56
@dowski
dowski force-pushed the dowski/revoke-sessions-on-password-reset branch from 2cb5e9a to fd53cdb Compare October 23, 2026 21:15
@dowski
dowski force-pushed the dowski/revoke-sessions-on-password-reset branch from fd53cdb to e748bfc Compare October 26, 2026 23:27
@dowski
dowski force-pushed the dowski/revoke-sessions-on-password-reset branch from e748bfc to d83ad7c Compare October 26, 2026 23:44
@dowski
dowski force-pushed the dowski/revoke-session-handle branch from 201b3bd to 957d13b Compare October 26, 2026 23:44
@dowski
dowski force-pushed the dowski/revoke-session-handle branch 2 times, most recently from 520e0ba to 2a03112 Compare October 26, 2026 23:50
@dowski
dowski force-pushed the dowski/revoke-sessions-on-password-reset branch from d83ad7c to 2a88e48 Compare October 26, 2026 23:51
@dowski
dowski force-pushed the dowski/revoke-sessions-on-password-reset branch from 2a88e48 to a07384a Compare October 27, 2026 14:51
@dowski
dowski force-pushed the dowski/revoke-session-handle branch from 2a03112 to adf014c Compare October 27, 2026 14:51
@dowski
dowski changed the base branch from dowski/revoke-session-handle to graphite-base/775 October 27, 2026 15:00
@dowski
dowski force-pushed the dowski/revoke-sessions-on-password-reset branch from a07384a to 914dafc Compare October 27, 2026 15:01
@dowski
dowski force-pushed the graphite-base/775 branch from adf014c to 09915cc Compare October 27, 2026 15:01
@cursor
cursor Bot changed the base branch from graphite-base/775 to reboot October 27, 2026 15:02
@dowski
dowski force-pushed the dowski/revoke-sessions-on-password-reset branch from 914dafc to dbe6bb8 Compare October 27, 2026 15:02

This branch was successfully deployed

1 active deployment
Preview – auth-v2 — da882d61 Deployed Oct 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant