-
Notifications
You must be signed in to change notification settings - Fork 2
Fix/security warnings #240
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
Conversation
🔒 Security Fixes: - Add admin authentication to admin-core-team API endpoints - Prevent unauthorized access to admin data - Add proper user session validation - Use service role only for admin operations 🛡️ CSV Injection Protection: - Sanitize CSV export data to prevent formula injection - Add prefix for cells starting with =, +, -, @ 🔗 Navigation Improvements: - Replace window.location.href with Next.js Link components - Improve SPA navigation and accessibility - Fix all form authentication redirects ✅ Admin UI Security: - Add client-side admin access guards - Prevent non-admin users from accessing admin pages - Show proper forbidden messages All critical security vulnerabilities addressed per CodeRabbit review.
- Fix React hooks rules violation in admin page - Move admin access check after all hooks - Remove unused error variable in username page - All builds now pass successfully
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. WalkthroughServer-side admin authentication and authorization were added to the admin core team API routes and the admin page. CSV export now sanitizes fields. Several forms switched unauthenticated sign-in CTAs from window.location redirects to Next.js Link-based navigation. A bindingless catch was introduced in a username page without changing behavior. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Client
participant R as API Route (/api/admin-core-team)
participant A as requireAdmin (SSR)
participant DB as Supabase (Service Client)
rect rgb(240,248,255)
note over C,R: GET (admin list)
C->>R: GET /api/admin-core-team
R->>A: Validate session + is_admin
A-->>R: 200 OK (admin) / 401 / 403
alt Authorized
R->>DB: select core_team_applications (fields..., order desc)
DB-->>R: rows or error
R-->>C: 200 rows / 500 error
else Unauthorized
R-->>C: 401/403
end
end
rect rgb(245,255,240)
note over C,R: POST/PATCH (update)
C->>R: POST/PATCH with payload
R->>A: Validate session + is_admin
A-->>R: 200 OK (admin) / 401 / 403
alt Authorized
R->>R: Validate input (status/id)
alt Valid
R->>DB: update core_team_applications (set status/notes, updated_at)
DB-->>R: updated row or error
R-->>C: 200 row / 500 error
else Invalid
R-->>C: 400 Bad Request
end
else Unauthorized
R-->>C: 401/403
end
end
sequenceDiagram
autonumber
participant U as User
participant F as Form (unauthenticated)
participant L as Next.js Link
participant R as Router
U->>F: View form (not signed in)
F->>L: Render Button asChild with Link "/auth/signin"
U-->>L: Click "Sign In to Continue"
L->>R: Client-side route to /auth/signin
R-->>U: Sign-in page
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (9)
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Comment |
Summary by CodeRabbit