Skip to content

[Security] Rate limiting only covers 1 of 6 AI endpoints - apply to all#2880

Open
sanrishi wants to merge 1 commit into
ritesh-1918:gssocfrom
sanrishi:fix/rate-limiting-all-endpoints
Open

[Security] Rate limiting only covers 1 of 6 AI endpoints - apply to all#2880
sanrishi wants to merge 1 commit into
ritesh-1918:gssocfrom
sanrishi:fix/rate-limiting-all-endpoints

Conversation

@sanrishi

Copy link
Copy Markdown

Target

\�ackend/routers/ai.py: All AI analysis endpoints (6 endpoints unprotected)
\�ackend/routers/tickets.py: Ticket read/write endpoints (0 rate limited)
\�ackend/routers/admin.py: Admin endpoints (0 rate limited)

Vector

Insecure Deserialization & Payload Validation (Security)

Problem

Only /ai/analyze_ticket\ had rate limiting. Five other AI endpoints — including SSE streaming, Gemini-powered analysis, and V2 classification — had zero protection. Ticket and admin endpoints were also completely open.

The \limiter.py\ module already defined all limit constants (\ML_HEAVY_LIMIT, \ML_LIGHT_LIMIT, \TICKET_READ_LIMIT, \TICKET_WRITE_LIMIT, \ADMIN_LIMIT) but they were never applied to the actual route decorators.

Changes

  • Added @limiter.limit(ML_HEAVY_LIMIT)\ to 6 AI endpoints (troubleshoot, analyze_bug, analyze, analyze_stream, legacy, analyze-v2)
  • Added @limiter.limit(TICKET_READ_LIMIT)\ and \TICKET_WRITE_LIMIT\ to tickets endpoints
  • Added @limiter.limit(ADMIN_LIMIT)\ to admin endpoints
  • Fixed parameter name collisions (renamed
    equest\ → \ roubleshoot_request/etc. to avoid conflict with FastAPI \Request\ injection)

Fixes #2874

- Add ML_HEAVY_LIMIT to /ai/troubleshoot, /ai/analyze_bug, /ai/analyze, /ai/analyze_stream, /ai/analyze_ticket/legacy, /ai/analyze-v2
- Add TICKET_READ_LIMIT and TICKET_WRITE_LIMIT to /tickets endpoints
- Add ADMIN_LIMIT to /api/profiles
- limiter.py already defined all limit constants - only decorators were missing

Fixes ritesh-1918#2874
@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

Someone 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 14, 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: 95e22208-76ac-4879-9400-409c574b2990

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.

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