Skip to content

🔒 fix: Rate Limit Docs Feedback Per Client Instead Of Per URL - #901

Open
berry-13 wants to merge 1 commit into
mainfrom
berry-13/fix-sec
Open

berry-13 wants to merge 1 commit into
mainfrom
berry-13/fix-sec

Conversation

@berry-13

@berry-13 berry-13 commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

The docs feedback server action rate limited by the submitted page URL, which the caller controls. Any new string such as /docs?a=1, /docs?a=2 got a fresh bucket, so an anonymous script could create unlimited GitHub Discussions and Discord posts, including @mentions that notify GitHub users.

Submissions are now limited per client IP (cf-connecting-ip, then Vercel's x-real-ip / x-forwarded-for) at 3 per minute, plus a global cap of 20 per minute. Both use Upstash when configured, so the limit holds across serverless instances, and fall back to in-memory otherwise. The URL must resolve to an existing docs page in docsSource, with query string and fragment stripped and the locale prefix kept. @ in messages is broken with a zero-width space for GitHub, and the Discord webhook sends allowed_mentions: { parse: [] }.

Change Type

  • Bug fix (security: rate limit bypass)

Testing

  • vitest run on the feedback, chat and subscribe tests: 26 passed. New cases cover 10 submissions with different ?x= suffixes from one client (only 3 succeed), rejection of non-existent pages, query stripping with locale kept, allowed_mentions, and mention escaping.
  • ESLint and Prettier clean on the touched files; tsc reports no errors in them.
  • Not exercised against live GitHub or Discord, to avoid posting real messages.

Checklist

  • Tests added for the bypass and the new validation
  • Lint and formatting pass

The feedback server action keyed its limit on the caller-chosen page URL,
so varying a query string reset the limit and allowed unlimited GitHub
Discussions and Discord posts. Limit by client IP with a global cap, backed
by Upstash when configured, accept only existing docs pages with the query
stripped, and neutralize @mentions in GitHub and Discord posts.
@berry-13 berry-13 added the bug Something isn't working label Nov 1, 2026
@vercel

vercel Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
librechat-ai Ready Ready Preview Nov 1, 2026 2:50am UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T02:42:54.838352Z 32b31e6 PR opened
🔒 Security Review ✅ Completed 2026-11-01T02:44:30.891028Z 32b31e6 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch was successfully deployed

1 active deployment
Preview — 32b31e64 Deployed Nov 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant