FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: flush PKCE verifier slot removals on the server by mandarini · Pull Request #275 · supabase/ssr · GitHub

/ ssr Public

fix: flush PKCE verifier slot removals on the server - #275

Merged
mandarini merged 2 commits into
mainfrom
fix/pkce-verifier-slot-removal-flush
Jul 28, 2026
Merged

mandarini merged 2 commits into
mainfrom
fix/pkce-verifier-slot-removal-flush

Conversation

mandarini commented Jul 28, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

auth-js stores each in-flight PKCE code verifier in its own cookie slot (<storageKey>-flow-<flowId>-code-verifier), bounded by a ring of five. The server storage applies writes to -code-verifier keys immediately but leaves removals buffered until an onAuthStateChange event, and a flow start fires no such event: when the ring evicts the oldest slot, that removal is discarded while the index write dropping the evicted id is applied, orphaning a verifier cookie that nothing references and no cleanup path can reach.

This applies the storage on removal for per-flow slot keys only, so the fixed -code-verifier key and the -flows-code-verifier index keep their existing buffered behavior and no current code path changes. Impact is cookie hygiene rather than credential exposure, since a verifier with no matching auth code grants nothing.

docs/design.md is the only place documenting when the server applies storage to cookies, so the new exception is recorded there. That section also never mentioned the existing immediate flush for verifier writes, and its event list had drifted from createServerClient.ts, so both are corrected alongside it.

mandarini self-assigned this Jul 28, 2026
mandarini marked this pull request as ready for review July 28, 2026 13:50
mandarini requested review from a team as code owners July 28, 2026 13:50
mandarini merged commit 6df6f03 into main Jul 28, 2026
3 checks passed
mandarini deleted the fix/pkce-verifier-slot-removal-flush branch July 28, 2026 15:37
mandarini added a commit that referenced this pull request Jul 28, 2026
This PR updates `@supabase/supabase-js` to v2.111.0.

**Source**: supabase-js-stable-release

---

## Test update included

supabase-js 2.111.0
([supabase/supabase-js#2569](supabase/supabase-js#2569))
stores PKCE verifiers in per-flow slots, so a flow start now writes
three storage keys instead of one: the per-flow slot, the flow index,
and the legacy fixed `-code-verifier` key. Our server storage adapter
flushes each of these immediately (by design — slot keys deliberately
end in `-code-verifier`), so `setAll` now fires 3 times per flow start
instead of 1.

The PKCE verifier test asserted that internal flush count and
snapshotted the exact cookies, so we updated it: expect 3 `setAll`
calls, normalize the random flow id in slot cookie names, and regenerate
the snapshots. Test-only change — no source changes needed, the adapter
was already prepared in #275.

**Why this isn't a breaking change in supabase-js:** the writes are
purely additive — the legacy key is still written with the same format,
and `exchangeCodeForSession` without a flow id reads it exactly as
before. The new slot-only lookup only kicks in when a flow id is
explicitly passed or the opt-in
`experimental.appendPkceFlowIdToRedirects` flag is enabled.

---

## Release Notes

## v2.111.0

## 2.111.0 (2026-07-28)

### 🚀 Features

- **auth:** store PKCE verifiers in per-flow slots to survive
overlapping flows
([#2569](supabase/supabase-js#2569))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini

This PR was created automatically.

---------

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
Co-authored-by: Katerina Skroumpelou <sk.katherine@gmail.com>
mandarini pushed a commit that referenced this pull request Jul 28, 2026
🤖 I have created a release *beep* *boop*
---


## [0.12.4](v0.12.3...v0.12.4)
(2026-07-28)


### Bug Fixes

* flush PKCE verifier slot removals on the server
([#275](#275))
([6df6f03](6df6f03))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.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 join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL