[PR #5318] [MERGED] fix(api-key): don't update the lastRequest when calling updateApiKey #5923

Closed
opened 2026-03-13 12:41:27 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5318
Author: @ping-maxwell
Created: 10/15/2025
Status: Merged
Merged: 10/16/2025
Merged by: @Bekacru

Base: canaryHead: fix/api-key-update-shouldnt-update-lastRequest


📝 Commits (3)

  • 54abfb9 fix(api-key): don't update the lastRequest when calling updateApiKey
  • ebd7ea1 Merge branch 'canary' into fix/api-key-update-shouldnt-update-lastRequest
  • cae98d8 Merge branch 'canary' into fix/api-key-update-shouldnt-update-lastRequest

📊 Changes

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

View changed files

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

📄 Description

This endpoint should be handled by the better-auth built-in rate-limits, and lastRequest is used for api-key verification rate limiting.

The same currently applies to the get-api-key endpoint

issue: https://github.com/better-auth/better-auth/issues/5309

linear: https://linear.app/better-auth/issue/ENG-380/fix-lastrequest-shouldnt-be-updated-on-update-api-key-endpoint


Summary by cubic

Stop updating lastRequest in updateApiKey so updates don’t skew API key verification rate limiting. Rate limiting for this endpoint is handled by built-in better-auth limits (ENG-380).

  • Bug Fixes
    • Removed lastRequest write in the update path; still decrements remaining and applies new values.

🔄 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/5318 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 10/15/2025 **Status:** ✅ Merged **Merged:** 10/16/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/api-key-update-shouldnt-update-lastRequest` --- ### 📝 Commits (3) - [`54abfb9`](https://github.com/better-auth/better-auth/commit/54abfb9376d8d4da295738bd24edfbad378d6a46) fix(api-key): don't update the `lastRequest` when calling updateApiKey - [`ebd7ea1`](https://github.com/better-auth/better-auth/commit/ebd7ea1286b298e7eba3a7f30be1c279ba8a4a86) Merge branch 'canary' into fix/api-key-update-shouldnt-update-lastRequest - [`cae98d8`](https://github.com/better-auth/better-auth/commit/cae98d8d92dcf2cd732ce00591834226a85aab4e) Merge branch 'canary' into fix/api-key-update-shouldnt-update-lastRequest ### 📊 Changes **1 file changed** (+0 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/api-key/routes/update-api-key.ts` (+0 -1) </details> ### 📄 Description This endpoint should be handled by the better-auth built-in rate-limits, and `lastRequest` is used for api-key verification rate limiting. The same currently applies to the get-api-key endpoint issue: https://github.com/better-auth/better-auth/issues/5309 linear: https://linear.app/better-auth/issue/ENG-380/fix-lastrequest-shouldnt-be-updated-on-update-api-key-endpoint <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Stop updating lastRequest in updateApiKey so updates don’t skew API key verification rate limiting. Rate limiting for this endpoint is handled by built-in better-auth limits (ENG-380). - **Bug Fixes** - Removed lastRequest write in the update path; still decrements remaining and applies new values. <!-- 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-03-13 12:41:27 -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#5923