fix(auth): add Max-Age and __Host- prefix to session cookie#281
fix(auth): add Max-Age and __Host- prefix to session cookie#281jaredglaser wants to merge 1 commit into
Conversation
|
Warning Review limit reached
More reviews will be available in 40 minutes and 23 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the 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 credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. 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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (45)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Single-name session cookie keyed on isSecure (derived from OIDC_REDIRECT_URI): https issues __Host-session + Secure, http issues the plain session name. Max-Age mirrors the DB session TTL. No dual-name migration support. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JyRSkAfm3xbEYoW8QF2N9n
72342be to
de2d368
Compare
Summary
src/lib/auth/session-cookie.tsowns the cookie name, build, clear, and parse logic.buildSessionCookienow setsMax-AgefromSESSION_TTL_HOURS(hours * 3600).__Host-session(browser enforces Secure, Path=/, no Domain), http (local dev) keepssessionsince browsers reject the prefix without Secure.auth.functions.tsx, SSE auth, logout) resolve the active name from isSecure and read only that name. Middleware and SSE auth derive isSecure fromOIDC_REDIRECT_URIvia the newisSecureCookie()helper; logout reuses the isSecure it already derives from config. On https a plainsessioncookie is ignored, so a cookie planted under the plain name cannot fixate a session past the __Host- guard.CallbackHandlerDepsgainssessionTtlHours, wired fromloadAuthConfig()incallbackGetHandler.There is no dual-name migration support: there are no pre-existing sessions to migrate, so the cookie is never read or cleared under two names at once.
Testing
bun run typecheckpasses.src/lib/auth/__tests__/session-cookie.test.tscovers name selection, Max-Age, Secure/__Host- attributes, single-name clearing, and parse precedence/decoding edge cases (including that the plain name is ignored on https and the __Host- name is ignored on http).Closes #247
🤖 Generated with Claude Code