[PR #8708] fix: prevent revoked sessions from being restored via database fallback #16407

Closed
opened 2026-04-13 10:30:52 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/8708

State: closed
Merged: Yes


Note

preserveSessionInDatabase is intended for tracking, not authentication.

docs

https://better-auth.com/docs/concepts/session-management#preserving-sessions

When both preserveSessionInDatabase and storeSessionInDatabase are enabled, falling back to the database when a session is missing in secondary storage is not appropriate. It may improve resilience if secondary storage is down, but it goes beyond its intended purpose.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/8708 **State:** closed **Merged:** Yes --- > [!NOTE] > ### `preserveSessionInDatabase` is intended for tracking, not authentication. > > <img width="913" height="447" alt="docs" src="https://github.com/user-attachments/assets/9df1801c-c751-406f-82ac-87c007db6b62" /> > > https://better-auth.com/docs/concepts/session-management#preserving-sessions When both `preserveSessionInDatabase` and `storeSessionInDatabase` are enabled, falling back to the database when a session is missing in secondary storage is not appropriate. It may improve resilience if secondary storage is down, but it goes beyond its intended purpose.
GiteaMirror added the pull-request label 2026-04-13 10:30:52 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#16407