Skip to content

Add route-level rate limiting to settings endpoints to resolve CodeQL alert - #22

Draft
48thCoder with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-code-scanning-alert-42
Draft

Add route-level rate limiting to settings endpoints to resolve CodeQL alert#22
48thCoder with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-code-scanning-alert-42

Conversation

Copilot AI commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

This PR addresses the code scanning finding on backend/routes/settingsRoutes.js by adding recognized rate limiting to settings handlers that perform auth + DB access. The change is intentionally narrow and focused on the flagged route surface.

  • Scope: settings route hardening

    • Added express-rate-limit as a backend dependency.
    • Introduced a shared limiter for settings routes (60s window, 30 requests).
    • Applied limiter in backend/routes/settingsRoutes.js to both:
      • GET /
      • PUT /
  • Implementation detail

    • Replaced custom in-repo middleware approach with express-rate-limit middleware so static analysis can reliably detect and validate rate limiting.
const settingsRateLimit = rateLimit({
  windowMs: 60 * 1000,
  limit: 30,
  standardHeaders: true,
  legacyHeaders: false
});

router.get('/', settingsRateLimit, auth, getSettings);
router.put('/', settingsRateLimit, auth, updateSettings);

@vercel

vercel Bot commented Sep 5, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
attendly-ai Ready Ready Preview Sep 5, 2026 10:27am UTC

Co-authored-by: 48thCoder <143126881+48thCoder@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix code scanning alert 42 Add route-level rate limiting to settings endpoints to resolve CodeQL alert Sep 5, 2026
Copilot AI requested a review from 48thCoder September 5, 2026 10:28
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.

2 participants