[GH-ISSUE #4512] Sensitive auth functions should ignore the cookie cache in session middleware #18596

Closed
opened 2026-04-15 17:08:00 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @widavies on GitHub (Sep 8, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/4512

Is this suited for github?

  • Yes, this is suited for github

No response

Describe the solution you'd like

Auth functions like /change-password should always ignore the session cookie cache. Currently, they use the standard session middleware.

I think this is a security risk. Let's say a user changes their password with revokeOtherSessions: true. This will revoke all sessions on the server, but the cookie caches for all existing sessions will live on for the remainder of the cookie cache TTL.

As /change-password will accept the cookie cache, users can change the password and get their session back.

This probably applies to several other auth functions as well.

Describe alternatives you've considered

.

Additional context

No response

Originally created by @widavies on GitHub (Sep 8, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/4512 ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. _No response_ ### Describe the solution you'd like Auth functions like `/change-password` should always _ignore_ the session cookie cache. Currently, they use the standard [session middleware](https://github.com/better-auth/better-auth/blob/e15113737a5e7b524c188fe07305fc8f310464ce/packages/better-auth/src/api/routes/update-user.ts#L153). I think this is a security risk. Let's say a user changes their password with `revokeOtherSessions: true`. This will revoke all sessions on the server, but the cookie caches for all existing sessions will live on for the remainder of the cookie cache TTL. As `/change-password` will accept the cookie cache, users can change the password and get their session back. This probably applies to several other auth functions as well. ### Describe alternatives you've considered . ### Additional context _No response_
GiteaMirror added the locked label 2026-04-15 17:08:00 -05:00
Author
Owner

@Kinfe123 commented on GitHub (Sep 9, 2025):

ref #4530

<!-- gh-comment-id:3269653147 --> @Kinfe123 commented on GitHub (Sep 9, 2025): ref #4530
Author
Owner

@widavies commented on GitHub (Sep 15, 2025):

@Kinfe123 Thanks! You guys are shipping like crazy, appreciate it!

<!-- gh-comment-id:3293866732 --> @widavies commented on GitHub (Sep 15, 2025): @Kinfe123 Thanks! You guys are shipping like crazy, appreciate it!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#18596