[PR #3020] [MERGED] Fix delete user fresh age check #12855

Closed
opened 2026-04-13 08:38:15 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3020
Author: @etler
Created: 6/14/2025
Status: Merged
Merged: 6/15/2025
Merged by: @Bekacru

Base: mainHead: fix-delete-user-fresh-age-check


📝 Commits (1)

  • 6aa5e30 fix: deleteUser check session freshAge using ms instead of sec

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/api/routes/update-user.ts (+1 -1)

📄 Description

The deleteUser api route checks if a session is fresh before allowing the delete, but the freshAge config value was never converted from seconds to milliseconds.

With the default freshAge of 1 day, this means that the delete call session currently expires after 86 seconds.

This bug appears to have been around for a long time. Given how often time checks need to be made against config times, it would probably be better to create a utility function for doing time comparisons instead and refactor all existing time checks to use it.


🔄 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/3020 **Author:** [@etler](https://github.com/etler) **Created:** 6/14/2025 **Status:** ✅ Merged **Merged:** 6/15/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `fix-delete-user-fresh-age-check` --- ### 📝 Commits (1) - [`6aa5e30`](https://github.com/better-auth/better-auth/commit/6aa5e304fb1d64034a961123b577c20b1d3c5835) fix: deleteUser check session freshAge using ms instead of sec ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/update-user.ts` (+1 -1) </details> ### 📄 Description The `deleteUser` api route checks if a session is fresh before allowing the delete, but the `freshAge` config value was never converted from seconds to milliseconds. With the default `freshAge` of 1 day, this means that the delete call session currently expires after 86 seconds. This bug appears to have been around for a long time. Given how often time checks need to be made against config times, it would probably be better to create a utility function for doing time comparisons instead and refactor all existing time checks to use it. --- <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-04-13 08:38:15 -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#12855