[PR #6538] [MERGED] feat(oauth-proxy): add expirty timestamp for encrypted tokens #6731

Closed
opened 2026-03-13 13:09:44 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6538
Author: @Bekacru
Created: 12/5/2025
Status: Merged
Merged: 12/6/2025
Merged by: @Bekacru

Base: canaryHead: feat/oauth-proxy


📝 Commits (10+)

  • 4140ae0 fix: pathname should be normalized when basePath is set to root
  • ebf79b0 feat(oauth-proxy): add timestamp validation for encrypted payloads
  • 0da8e66 Merge branch 'canary' into feat/oauth-proxy
  • 549e4a4 chore: cleanup
  • e79de68 update
  • 561d09a chore: cleanup
  • c36d425 Update packages/better-auth/src/plugins/oauth-proxy/index.ts
  • 6e4a7f9 chore: normalize pathname handling for disabled paths and rate limiting
  • df38781 Merge branch 'canary' into feat/oauth-proxy
  • 8cba0bb chore: lint

📊 Changes

9 files changed (+387 additions, -26 deletions)

View changed files

📝 docs/content/docs/plugins/oauth-proxy.mdx (+3 -1)
📝 packages/better-auth/src/api/index.ts (+2 -2)
📝 packages/better-auth/src/api/rate-limiter/index.ts (+3 -4)
📝 packages/better-auth/src/api/routes/sign-up.ts (+0 -1)
📝 packages/better-auth/src/api/to-auth-endpoints.test.ts (+13 -0)
📝 packages/better-auth/src/plugins/oauth-proxy/index.ts (+84 -8)
📝 packages/better-auth/src/plugins/oauth-proxy/oauth-proxy.test.ts (+282 -4)
📝 packages/better-auth/src/plugins/oauth-proxy/utils.ts (+0 -3)
📝 packages/better-auth/src/plugins/organization/routes/crud-access-control.ts (+0 -3)

📄 Description

Summary by cubic

Adds replay protection to the OAuth Proxy by encrypting cookie payloads with a timestamp and enforcing an expiry window (default 60s). Also normalizes path handling for disabled paths and rate limiting.

  • New Features

    • OAuth Proxy now validates encrypted payload timestamps to block replayed URLs.
    • Added maxAge option (seconds, default 60).
    • Docs updated with security notes and the new option.
  • Bug Fixes

    • Normalize request path for disabledPaths when basePath is "/" and in prefixed routes.
    • Normalize path handling in the rate limiter (ignore trailing slashes).

Written for commit 8cba0bb39f. Summary will update automatically on new commits.


🔄 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/6538 **Author:** [@Bekacru](https://github.com/Bekacru) **Created:** 12/5/2025 **Status:** ✅ Merged **Merged:** 12/6/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `feat/oauth-proxy` --- ### 📝 Commits (10+) - [`4140ae0`](https://github.com/better-auth/better-auth/commit/4140ae001ac7637aa03e3a2eed85f99e55f51cf8) fix: pathname should be normalized when basePath is set to root - [`ebf79b0`](https://github.com/better-auth/better-auth/commit/ebf79b0b499995cbaeaf915a7c9087deadeb057d) feat(oauth-proxy): add timestamp validation for encrypted payloads - [`0da8e66`](https://github.com/better-auth/better-auth/commit/0da8e66452afdab59101774df965298e7c2c6c23) Merge branch 'canary' into feat/oauth-proxy - [`549e4a4`](https://github.com/better-auth/better-auth/commit/549e4a4defe966be7a6506ffabe91b5ef4d4911b) chore: cleanup - [`e79de68`](https://github.com/better-auth/better-auth/commit/e79de68368be97cb456b3514246adedbfebec93f) update - [`561d09a`](https://github.com/better-auth/better-auth/commit/561d09a8c900ae3646426354b009918ccace1470) chore: cleanup - [`c36d425`](https://github.com/better-auth/better-auth/commit/c36d425c5d22c3428009da2ac5a9579666e70098) Update packages/better-auth/src/plugins/oauth-proxy/index.ts - [`6e4a7f9`](https://github.com/better-auth/better-auth/commit/6e4a7f9aa8a09d624249d7bbe56fffba37966012) chore: normalize pathname handling for disabled paths and rate limiting - [`df38781`](https://github.com/better-auth/better-auth/commit/df38781bc7e4b3dd7e92ce65f2ee42a259fc4bc5) Merge branch 'canary' into feat/oauth-proxy - [`8cba0bb`](https://github.com/better-auth/better-auth/commit/8cba0bb39f6fc7cfec71a7bb1071db389db653ba) chore: lint ### 📊 Changes **9 files changed** (+387 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/oauth-proxy.mdx` (+3 -1) 📝 `packages/better-auth/src/api/index.ts` (+2 -2) 📝 `packages/better-auth/src/api/rate-limiter/index.ts` (+3 -4) 📝 `packages/better-auth/src/api/routes/sign-up.ts` (+0 -1) 📝 `packages/better-auth/src/api/to-auth-endpoints.test.ts` (+13 -0) 📝 `packages/better-auth/src/plugins/oauth-proxy/index.ts` (+84 -8) 📝 `packages/better-auth/src/plugins/oauth-proxy/oauth-proxy.test.ts` (+282 -4) 📝 `packages/better-auth/src/plugins/oauth-proxy/utils.ts` (+0 -3) 📝 `packages/better-auth/src/plugins/organization/routes/crud-access-control.ts` (+0 -3) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Adds replay protection to the OAuth Proxy by encrypting cookie payloads with a timestamp and enforcing an expiry window (default 60s). Also normalizes path handling for disabled paths and rate limiting. - **New Features** - OAuth Proxy now validates encrypted payload timestamps to block replayed URLs. - Added maxAge option (seconds, default 60). - Docs updated with security notes and the new option. - **Bug Fixes** - Normalize request path for disabledPaths when basePath is "/" and in prefixed routes. - Normalize path handling in the rate limiter (ignore trailing slashes). <sup>Written for commit 8cba0bb39f6fc7cfec71a7bb1071db389db653ba. Summary will update automatically on new commits.</sup> <!-- 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 13:09:44 -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#6731