Skip to content

[SECURITY] fix: add authentication and tenant isolation to ticket endpoints (critical)#2919

Open
namann5 wants to merge 1 commit into
ritesh-1918:gssocfrom
namann5:fix/tickets-missing-auth-idor-critical
Open

[SECURITY] fix: add authentication and tenant isolation to ticket endpoints (critical)#2919
namann5 wants to merge 1 commit into
ritesh-1918:gssocfrom
namann5:fix/tickets-missing-auth-idor-critical

Conversation

@namann5

@namann5 namann5 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

🔒 Security Fix: Missing Auth & IDOR on Ticket Endpoints

Fixes #2916

Vulnerabilities Fixed

Endpoint Issue Fix
POST /tickets No authentication Added Depends(get_current_user)
PATCH /tickets/{id} No authentication Added Depends(get_current_user)
GET /tickets/{id} IDOR — any user could read any ticket Added company_id ownership check (403 on mismatch)
GET /tickets No tenant scoping Defaults to authenticated user's company_id

Verification

  • ✅ Zero merge conflicts with upstream/gssoc
  • ✅ Only backend/routers/tickets.py changed

Severity: Critical — CVSS 8.8 (Missing Authentication + IDOR)
Level: critical | advanced

…oints (critical)

Three vulnerabilities fixed in tickets router:

1. POST /tickets (create_ticket) - Had NO authentication at all.
   Added Depends(get_current_user).

2. PATCH /tickets/{ticket_id} (update_ticket) - Had NO authentication.
   Added Depends(get_current_user).

3. GET /tickets/{ticket_id} (get_ticket_by_id) - Had authentication but
   NO tenant ownership verification (IDOR). Any authenticated user could
   read any ticket across all companies. Added company_id match check
   returning 403 Forbidden on cross-tenant access.

4. GET /tickets (get_tickets) - Optional company_id param allowed any
   authenticated user to see all tickets across all tenants. Now defaults
   to the authenticated user's company_id.
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

@namann5 is attempting to deploy a commit to the ritesh Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 99936d63-1a60-46d6-8d29-39c83ddd3d21

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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.

Reviewed commit: 1723ddda56

ℹ️ 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".

Comment thread backend/routers/tickets.py
Comment thread backend/routers/tickets.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant