CRITICAL: Fix auth gaps on analyze endpoints, sanitize error messages, remove hardcoded JWT (Fixes #849)#855
Conversation
…hardcoded JWT Remaining security fixes for gssoc branch: - Add authentication to /ai/analyze_ticket and /ai/analyze endpoints - Sanitize auth error messages in auth_cookie.py (prevent user enumeration) - Remove hardcoded service_role JWT from scratch/test_companies.js
|
@namann5 is attempting to deploy a commit to the ritesh Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac891935da
ℹ️ 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".
#849
CRITICAL Security Vulnerabilities Found
Severity: CRITICAL
Three critical security vulnerabilities were discovered during a comprehensive security audit. A fix branch with patches is available at: https://github.com/namann5/HELPDESK.AI/pull/new/fix/critical-mock-token-auth-bypass
Vulnerability 1: Hardcoded Supabase service_role JWT (CRITICAL)
Files:
A valid Supabase service_role JWT is hardcoded in 3 tracked files. The decoded payload shows role: service_role with expiration in 2036.
Impact: Anyone with this JWT can read/write/delete ALL data in every table, bypassing Row-Level Security, manage auth users, and execute arbitrary SQL via the Supabase REST API.
Fix: Replaced hardcoded JWT with current_setting('supabase.service_role_key', true) which reads from database configuration. Environment variable loading for scratch scripts.
Vulnerability 2: Unauthenticated API Endpoints (CRITICAL)
Files: backend/main.py
The following endpoints have zero authentication:
While Depends(get_current_user) was defined, it was only used by /auth/me.
Fix: Added Depends(get_current_user) to all 6 endpoints.
Vulnerability 3: Auth Error Messages Leak Details (HIGH)
Files: backend/main.py
Login returns raw Supabase error messages which differ between "user not found" vs "wrong password", enabling user enumeration. Token validation also leaks raw exception details.
Fix: All auth errors now return generic messages without leaking implementation details.
Immediate Actions Required