Skip to content

fix(auth): treat blank session cookies as absent#1130

Merged
BigSimmo merged 2 commits into
mainfrom
cursor/fix-blank-auth-cookies-c687
Jul 24, 2026
Merged

fix(auth): treat blank session cookies as absent#1130
BigSimmo merged 2 commits into
mainfrom
cursor/fix-blank-auth-cookies-c687

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

Summary

  • Treat blank/whitespace-only current sb-<ref>-auth-token cookies (including empty chunks) as absent so a still-valid legacy sb-access-token can authenticate during migration.
  • Treat blank/whitespace-only legacy sb-access-token cookies as absent so anonymous public APIs are not forced to 401.
  • Keep fail-closed behavior for non-empty invalid current or legacy session cookies.
  • Extend tests/auth-tri-state.test.ts with blank-presence coverage and a synthetic project-ref fixture for cookie-name resolution.

Verification

  • npm exec vitest run tests/auth-tri-state.test.ts — 16 passed
  • npm run verify:pr-local — running after PR open
  • UI verification not run: no UI behavior changed.
  • Live RAG not run: no retrieval or generation behavior changed.

Risk and rollout

  • Risk: low. Only blank cookie leftovers change from invalidabsent (or fall through to legacy when blank current + valid legacy). Non-empty invalid modern sessions still do not fall back to legacy.
  • Rollback: revert this PR; no schema, data, provider, or deployment mutation.
  • Provider or production effects: None. Local/static/mocked checks only.

Clinical Governance Preflight

  • Source-backed claims still require linked source verification before clinical use
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval
  • Supabase target remains Clinical KB Database
  • Service-role keys and private document access remain server-only
  • Demo/synthetic content remains clearly separated from real clinical sources
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative
  • Deployment classification/TGA SaMD impact was checked; clinical decision-support behavior is unchanged

Notes

Open in Web Open in Cursor 

Blank or whitespace-only current and legacy Supabase session cookies were
treated as presented credentials, which blocked legacy fallback during
migration and forced 401 on anonymous public APIs. Require a non-blank
value before counting a cookie as present, and cover the edge cases in
auth-tri-state tests.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@supabase

supabase Bot commented Jul 24, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@BigSimmo, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fdca61e7-c605-45a1-898b-ed211e5ce9bb

📥 Commits

Reviewing files that changed from the base of the PR and between 6ceaaff and 177e9aa.

📒 Files selected for processing (2)
  • src/lib/supabase/auth.ts
  • tests/auth-tri-state.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/fix-blank-auth-cookies-c687

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@BigSimmo
BigSimmo marked this pull request as ready for review July 24, 2026 04:46
@BigSimmo
BigSimmo merged commit 9456cea into main Jul 24, 2026
18 checks passed
@BigSimmo
BigSimmo deleted the cursor/fix-blank-auth-cookies-c687 branch July 24, 2026 04:47
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