[PR #7173] fix(revoke-session): revoke DB sessions if preserveSessionInDatabase #7121

Open
opened 2026-03-13 13:24:51 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7173
Author: @ping-maxwell
Created: 1/7/2026
Status: 🔄 Open

Base: canaryHead: fix(revoke-session)/revoke-DB-sessions-if-preserveSessionInDatabase-``


📝 Commits (10+)

  • 34a0b51 fix(revoke-session): revoke DB sessions if preserveSessionInDatabase
  • b6cd8b4 fix: ci
  • 11b2efe Merge branch 'canary' into fix(revoke-session)/revoke-DB-sessions-if-preserveSessionInDatabase-
  • c7b2936 Merge branch 'canary' into fix(revoke-session)/revoke-DB-sessions-if-preserveSessionInDatabase-
  • c085d20 Merge branch 'canary' into fix(revoke-session)/revoke-DB-sessions-if-preserveSessionInDatabase-
  • 18b07ff Merge branch 'canary' into fix(revoke-session)/revoke-DB-sessions-if-preserveSessionInDatabase-
  • 66f4667 Merge branch 'canary' into fix(revoke-session)/revoke-DB-sessions-if-preserveSessionInDatabase-
  • fafab72 Merge branch 'canary' into fix(revoke-session)/revoke-DB-sessions-if-preserveSessionInDatabase-
  • 52087f0 Merge branch 'canary' into fix(revoke-session)/revoke-DB-sessions-if-preserveSessionInDatabase-
  • 6e0aa8a Merge branch 'canary' into fix(revoke-session)/revoke-DB-sessions-if-preserveSessionInDatabase-

📊 Changes

2 files changed (+109 additions, -4 deletions)

View changed files

📝 packages/better-auth/src/db/internal-adapter.ts (+12 -4)
📝 packages/better-auth/src/db/secondary-storage.test.ts (+97 -0)

📄 Description

closes https://github.com/better-auth/better-auth/issues/5144

If the dev has secondary storage + storeSessionInDatabase + preserveSessionInDatabase then our current implementation does not mark the DB's session as expired or even remove it when a user hits /revoke-session (thus meaning their session is still valid).

Given the preserveSessionInDatabase means we can't delete the session, this PR insteads updates the session record to be expired.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/7173 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 1/7/2026 **Status:** 🔄 Open **Base:** `canary` ← **Head:** `fix(revoke-session)/revoke-DB-sessions-if-`preserveSessionInDatabase-`` --- ### 📝 Commits (10+) - [`34a0b51`](https://github.com/better-auth/better-auth/commit/34a0b5173f6ced1f79e34e1bf596ac0f7e08b2d5) fix(revoke-session): revoke DB sessions if `preserveSessionInDatabase ` - [`b6cd8b4`](https://github.com/better-auth/better-auth/commit/b6cd8b4e0a5cdebb5c5a6cfeb369adbe687babfa) fix: ci - [`11b2efe`](https://github.com/better-auth/better-auth/commit/11b2efe5e3e2e23352451534b7f72fe722158f06) Merge branch 'canary' into fix(revoke-session)/revoke-DB-sessions-if-`preserveSessionInDatabase-` - [`c7b2936`](https://github.com/better-auth/better-auth/commit/c7b2936e8aa8e7c8f5cec1f222f4fbcecc548841) Merge branch 'canary' into fix(revoke-session)/revoke-DB-sessions-if-`preserveSessionInDatabase-` - [`c085d20`](https://github.com/better-auth/better-auth/commit/c085d20557c6a229fb12bef894e4a33dc03c6f09) Merge branch 'canary' into fix(revoke-session)/revoke-DB-sessions-if-`preserveSessionInDatabase-` - [`18b07ff`](https://github.com/better-auth/better-auth/commit/18b07ff91c4b825228b9c3d8942bf2d0de221bc9) Merge branch 'canary' into fix(revoke-session)/revoke-DB-sessions-if-`preserveSessionInDatabase-` - [`66f4667`](https://github.com/better-auth/better-auth/commit/66f46676a36b1f3a80b5230431dbec755f96fe20) Merge branch 'canary' into fix(revoke-session)/revoke-DB-sessions-if-`preserveSessionInDatabase-` - [`fafab72`](https://github.com/better-auth/better-auth/commit/fafab720069bb983ae06a4d3149078dc2eb6f219) Merge branch 'canary' into fix(revoke-session)/revoke-DB-sessions-if-`preserveSessionInDatabase-` - [`52087f0`](https://github.com/better-auth/better-auth/commit/52087f0503736edb54840b64bdfd7d22f3fdb235) Merge branch 'canary' into fix(revoke-session)/revoke-DB-sessions-if-`preserveSessionInDatabase-` - [`6e0aa8a`](https://github.com/better-auth/better-auth/commit/6e0aa8a0a585e23ac4147643b913bcd23527aed9) Merge branch 'canary' into fix(revoke-session)/revoke-DB-sessions-if-`preserveSessionInDatabase-` ### 📊 Changes **2 files changed** (+109 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/db/internal-adapter.ts` (+12 -4) 📝 `packages/better-auth/src/db/secondary-storage.test.ts` (+97 -0) </details> ### 📄 Description closes https://github.com/better-auth/better-auth/issues/5144 If the dev has secondary storage + `storeSessionInDatabase` + `preserveSessionInDatabase` then our current implementation does not mark the DB's session as expired or even remove it when a user hits `/revoke-session` (thus meaning their session is still valid). Given the `preserveSessionInDatabase` means we can't delete the session, this PR insteads updates the session record to be expired. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 13:24:51 -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#7121