[PR #7887] [CLOSED] fix(custom-session): support comma-separated set-cookie #7613

Closed
opened 2026-03-13 13:43:06 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7887
Author: @ping-maxwell
Created: 2/10/2026
Status: Closed

Base: canaryHead: fix/custom-session/support-comma-separated-set-cookie


📝 Commits (1)

  • 9609355 fix(custom-session): support comma-separated set-cookie

📊 Changes

2 files changed (+71 additions, -4 deletions)

View changed files

📝 packages/better-auth/src/plugins/custom-session/custom-session.test.ts (+53 -0)
📝 packages/better-auth/src/plugins/custom-session/index.ts (+18 -4)

📄 Description

closes https://github.com/better-auth/better-auth/issues/7878


Summary by cubic

Fixes custom-session cookie forwarding so multiple Set-Cookie headers are handled individually instead of being comma-joined, preventing corrupted cookies and broken attributes. Addresses github.com/better-auth/better-auth/issues/7878.

  • Bug Fixes
    • Forward cookies using headers.getSetCookie() + parseSetCookieHeader and set each cookie via ctx.setCookie to preserve attributes (Max-Age, Expires, SameSite, etc.).
    • Added a test that asserts session_token and session_data are sent as separate Set-Cookie headers with intact attributes.

Written for commit 960935592b. 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/7887 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 2/10/2026 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/custom-session/support-comma-separated-set-cookie` --- ### 📝 Commits (1) - [`9609355`](https://github.com/better-auth/better-auth/commit/960935592bb2d7f6fc7d9e52d1a7d65849d7a309) fix(custom-session): support comma-separated set-cookie ### 📊 Changes **2 files changed** (+71 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/custom-session/custom-session.test.ts` (+53 -0) 📝 `packages/better-auth/src/plugins/custom-session/index.ts` (+18 -4) </details> ### 📄 Description closes https://github.com/better-auth/better-auth/issues/7878 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes custom-session cookie forwarding so multiple Set-Cookie headers are handled individually instead of being comma-joined, preventing corrupted cookies and broken attributes. Addresses github.com/better-auth/better-auth/issues/7878. - **Bug Fixes** - Forward cookies using headers.getSetCookie() + parseSetCookieHeader and set each cookie via ctx.setCookie to preserve attributes (Max-Age, Expires, SameSite, etc.). - Added a test that asserts session_token and session_data are sent as separate Set-Cookie headers with intact attributes. <sup>Written for commit 960935592bb2d7f6fc7d9e52d1a7d65849d7a309. 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-03-13 13:43:06 -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#7613