Repository navigation
fix(playground): clear auto-generated key on logout - #2349
Conversation
The httpOnly llmgateway_playground_key cookie persisted after logout, so the next user on the same browser would inherit the previous user's auto-generated playground API key. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
WalkthroughOrganization selection in the playground shell now defaults to the first organization when orgId is missing or unresolved. Playground API-key cookie names are centralized in constants; routes now use those constants and logout clears both last-used-project cookies and the explicit playground API-key cookies. ChangesPlayground Authentication and Cookie Management
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Pull request overview
Fixes a logout security gap in the Playground by ensuring the auto-generated playground API key cookie is cleared so subsequent users on the same browser don’t inherit a previous user’s key.
Changes:
- Adds a list of playground key cookie names (
llmgateway_playground_keyand__Host-variant) to be deleted on logout. - Extends the existing logout cookie-clearing server action to also delete those playground key cookies.
- Updates the server action’s doc comment to reflect the expanded behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** | ||
| * Server Action to clear all last used project cookies on logout | ||
| * Server Action to clear cookies that should not persist across users on logout: | ||
| * last-used-project cookies and the auto-generated playground API key cookie. | ||
| */ | ||
| export async function clearLastUsedProjectCookiesAction(): Promise<void> { |
The chat page defaulted selectedOrganization to null when no orgId was in the URL, so the ensure-playground-key effect never fired after login. All other pages (image, video, canvas, group) already defaulted to organizations[0]; align the chat page with the same behavior. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
llmgateway_playground_keyhttpOnly cookie (set by/api/ensure-playground-key) was not cleared on logout, so the next user on the same browser inherited the previous user's auto-generated playground API key. ExtendedclearLastUsedProjectCookiesActionto also deletellmgateway_playground_keyand its__Host-variant.playground-shell.tsx) was the only playground route that defaultedselectedOrganizationtonullwhen noorgIdwas in the URL, so theensure-playground-keyeffect short-circuited. Aligned with the other pages (image/video/canvas/group) which default toorganizations[0]."llmgateway_playground_key"/"__Host-llmgateway_playground_key"string literals across 7 playground API routes to import a singlePLAYGROUND_KEY_COOKIE_NAMEconstant from@/lib/constants.Test plan
llmgateway_playground_keycookie is set.🤖 Generated with Claude Code
Summary by CodeRabbit