[PR #4961] [MERGED] fix: ttl for rate limited secondary storage #13930

Closed
opened 2026-04-13 09:13:18 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4961
Author: @dvanmali
Created: 9/29/2025
Status: Merged
Merged: 10/2/2025
Merged by: @himself65

Base: canaryHead: rateLimiterSecondaryStorage


📝 Commits (5)

  • b3d85b1 fix: add ttl on rate limited secondary storage
  • 3960494 fix: honor path window and max values for ttl
  • 00b8f68 fix: correct import path
  • 8d63e60 fix: window in seconds
  • f240029 fix: default should be in sec

📊 Changes

2 files changed (+34 additions, -8 deletions)

View changed files

📝 packages/better-auth/src/api/rate-limiter/index.ts (+20 -8)
📝 packages/better-auth/src/api/rate-limiter/rate-limiter.test.ts (+14 -0)

📄 Description

Adds ttl for rate limited secondary storage values.

Fixes:

Additional PR:


Summary by cubic

Adds TTL to rate-limiter entries stored in secondary storage, using the path-specific window so keys expire correctly. Fixes #4034 and #4472.

  • Bug Fixes
    • Apply TTL when writing to secondaryStorage (uses route window, falls back to global, default 10s).
    • Pass window into storage factory and tidy storage selection.
    • Tests verify TTL=10 and correct count/429 behavior with custom storage.

🔄 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/4961 **Author:** [@dvanmali](https://github.com/dvanmali) **Created:** 9/29/2025 **Status:** ✅ Merged **Merged:** 10/2/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `rateLimiterSecondaryStorage` --- ### 📝 Commits (5) - [`b3d85b1`](https://github.com/better-auth/better-auth/commit/b3d85b115d55e67c02f2261706ec1336e87d4fc5) fix: add ttl on rate limited secondary storage - [`3960494`](https://github.com/better-auth/better-auth/commit/39604944355823bb471de126aeef1f3c968ba1b2) fix: honor path window and max values for ttl - [`00b8f68`](https://github.com/better-auth/better-auth/commit/00b8f684b57da1fdc7769fbef1e7c522f7c2dc46) fix: correct import path - [`8d63e60`](https://github.com/better-auth/better-auth/commit/8d63e6071163b2523694be81aafa5f4325e021ae) fix: window in seconds - [`f240029`](https://github.com/better-auth/better-auth/commit/f240029a29bca1b2a11359465f013f0ecf6bd726) fix: default should be in sec ### 📊 Changes **2 files changed** (+34 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/rate-limiter/index.ts` (+20 -8) 📝 `packages/better-auth/src/api/rate-limiter/rate-limiter.test.ts` (+14 -0) </details> ### 📄 Description Adds ttl for rate limited secondary storage values. Fixes: - #4034 - #4472 Additional PR: - #3836 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds TTL to rate-limiter entries stored in secondary storage, using the path-specific window so keys expire correctly. Fixes #4034 and #4472. - **Bug Fixes** - Apply TTL when writing to secondaryStorage (uses route window, falls back to global, default 10s). - Pass window into storage factory and tidy storage selection. - Tests verify TTL=10 and correct count/429 behavior with custom storage. <!-- End of auto-generated description by cubic. --> --- <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 09:13:18 -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#13930