fix: prevent double encoded cookie#8133
Merged
himself65 merged 3 commits intobetter-auth:canaryfrom Mar 3, 2026
Merged
Conversation
|
@Oluwatobi-Mustapha is attempting to deploy a commit to the better-auth Team on Vercel. A member of the Team first needs to authorize it. |
@better-auth/api-key
better-auth
auth
@better-auth/core
@better-auth/drizzle-adapter
@better-auth/electron
@better-auth/expo
@better-auth/i18n
@better-auth/kysely-adapter
@better-auth/memory-adapter
@better-auth/mongo-adapter
@better-auth/oauth-provider
@better-auth/passkey
@better-auth/prisma-adapter
@better-auth/redis-storage
@better-auth/scim
@better-auth/sso
@better-auth/stripe
@better-auth/telemetry
@better-auth/test-utils
commit: |
himself65
reviewed
Feb 25, 2026
Comment on lines
+1
to
+8
| function tryDecode(str: string): string { | ||
| try { | ||
| return decodeURIComponent(str); | ||
| } catch { | ||
| return str; | ||
| } | ||
| } | ||
|
|
Contributor
There was a problem hiding this comment.
I think we probably try to decode on the top level
himself65
approved these changes
Feb 25, 2026
47b1ac3 to
3846367
Compare
Closed
aded47b to
1d34572
Compare
himself65
approved these changes
Mar 3, 2026
Contributor
Author
|
Thank you @himself65 🙏🏼 |
himself65
added a commit
that referenced
this pull request
Mar 3, 2026
Co-authored-by: Alex Yang <himself65@outlook.com>
5 tasks
himself65
added a commit
that referenced
this pull request
Mar 3, 2026
Co-authored-by: Alex Yang <himself65@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #8127
Decode forwarded
Set-Cookievalues incustomSessionbefore callingctx.setCookie(...)so/get-sessionrefresh does not double-encode session cookies (%25).Tests
corepack pnpm --dir packages/better-auth exec vitest run src/plugins/custom-session/custom-session.test.ts --maxWorkers=1corepack pnpm --dir packages/better-auth exec vitest run src/cookies/cookies.test.ts --maxWorkers=1Summary by cubic
Prevents double-encoding of session cookies during get-session refresh in the customSession plugin, fixing #8127. Cookie values are decoded once when parsing Set-Cookie so better-auth.session_token stays unchanged on refresh.
Written for commit 1d34572. Summary will update on new commits.