-
Notifications
You must be signed in to change notification settings - Fork 0
Restrict guest access before dashboard #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR restricts guest mode access by removing the dashboard from the list of guest-allowed routes and ensuring guest users are redirected to the login page when accessing protected paths.
- Removed
/dashboardfromGUEST_ALLOWED_ROUTESarray - Added explicit redirect to login for guest users accessing non-allowed routes
- Refactored authentication logic by removing unnecessary conditional wrapper
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return NextResponse.redirect(new URL('/auth/login', request.url)) | ||
| } | ||
|
|
||
| // Only create Supabase client and check session if NOT in guest mode |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment at line 49 is now inaccurate. After the refactoring, the Supabase client is created regardless of guest mode status. Since guest mode users that reach this point have already been redirected (line 40), the comment should be updated to reflect that this code only executes for non-guest users due to the early return, or the comment should be removed as it's now misleading.
| // Only create Supabase client and check session if NOT in guest mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (isGuestAllowedRoute) { | ||
| return response | ||
| } | ||
|
|
||
| return NextResponse.redirect(new URL('/auth/login', request.url)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guest mode now loops back to login
Removing /dashboard from the guest-allowed list means requests with the guestMode cookie now hit this branch and are redirected to /auth/login. The GuestModeButton still sets that cookie and routes guests to /dashboard, so “Continue as Guest” immediately bounces back to the login page and the guest dashboard experience is unreachable. Consider keeping /dashboard guest-accessible or update the guest entry point/target so the guest flow still lands on an allowed page.
Useful? React with 👍 / 👎.
Summary
Testing
Codex Task