`clearAuthCookiesAtScopes` sends no cache headers, unlike `applyServerStorage`

Open Beginner friendly
#316 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend, security

Research direction

Read src/cookies.ts and compare the setAll call in applyServerStorage (which passes the no-store headers) with the setAll(toSet, {}) call in clearAuthCookiesAtScopes. Pull the three headers into one shared constant and pass it from both call sites. Check the existing cookie tests in the repo to see how setAll options are asserted, and add a case covering the cleared-scope path so it verifies the same headers are sent; done means both paths use the one constant and a test fails if they diverge.

Written by the indexing model from the issue text.

Description

applyServerStorage passes these headers to setAll whenever it writes auth cookies (src/cookies.ts):

Cache-Control: private, no-cache, no-store, must-revalidate, max-age=0
Expires: 0
Pragma: no-cache

clearAuthCookiesAtScopes calls setAll(toSet, {}) instead, so a response that clears the session at old scopes carries no cache headers. A shared cache (CDN, a framework's full-route cache) can then store a Set-Cookie: ...; Max-Age=0 response and replay it to other users, which signs them out, or store the page that went with it.

Fix

Pass the same no-store headers from clearAuthCookiesAtScopes, ideally through one shared constant so the two paths can't drift again.

We currently add the headers ourselves around every clear.

Dominant language
TypeScript
Stars
216
Forks
35
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from supabase/ssr

All issues in supabase/ssr

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.