[PR #7159] [MERGED] fix(cookies): fallback to isProduction when baseURL is not set #15355

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7159
Author: @bytaesu
Created: 1/7/2026
Status: Merged
Merged: 1/20/2026
Merged by: @himself65

Base: canaryHead: 2026-01-07/fix/secure-cookie-fallback


📝 Commits (2)

  • ef7bfc9 fix(cookies): fallback to isProduction when baseURL is not set
  • bd26c93 test: wrap with describe block

📊 Changes

2 files changed (+39 additions, -2 deletions)

View changed files

📝 packages/better-auth/src/cookies/cookies.test.ts (+38 -1)
📝 packages/better-auth/src/cookies/index.ts (+1 -1)

📄 Description

docs

Summary by cubic

Default to secure cookies in production when baseURL is not set. Prevents insecure cookies in prod. Closes #7156.

  • Bug Fixes
    • Use NODE_ENV=production as fallback to enable Secure cookies when baseURL is missing.
    • Added test to assert Secure is present in Set-Cookie for prod with no baseURL.

Written for commit bd26c93dd6. Summary will update 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/7159 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 1/7/2026 **Status:** ✅ Merged **Merged:** 1/20/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `2026-01-07/fix/secure-cookie-fallback` --- ### 📝 Commits (2) - [`ef7bfc9`](https://github.com/better-auth/better-auth/commit/ef7bfc9a3e5f33f1ad37319ff59cb486e00d87e3) fix(cookies): fallback to isProduction when baseURL is not set - [`bd26c93`](https://github.com/better-auth/better-auth/commit/bd26c93dd68081f2ffe38e8f10ef2cb30b163620) test: wrap with describe block ### 📊 Changes **2 files changed** (+39 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/cookies/cookies.test.ts` (+38 -1) 📝 `packages/better-auth/src/cookies/index.ts` (+1 -1) </details> ### 📄 Description <img width="781" height="158" alt="docs" src="https://github.com/user-attachments/assets/cfed13f3-3a2c-4a0a-a6f0-da0211183308" /> --- - Closes https://github.com/better-auth/better-auth/issues/7156 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Default to secure cookies in production when baseURL is not set. Prevents insecure cookies in prod. Closes #7156. - **Bug Fixes** - Use NODE_ENV=production as fallback to enable Secure cookies when baseURL is missing. - Added test to assert Secure is present in Set-Cookie for prod with no baseURL. <sup>Written for commit bd26c93dd68081f2ffe38e8f10ef2cb30b163620. Summary will update 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-04-13 09:59:11 -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#15355