fix(server): rate-limit /api/analyze and /api/embed endpoints (#1328)#1339
Merged
magyargergo merged 1 commit intoMay 4, 2026
Merged
Conversation
…anpatwari#1328) Apply createRouteLimiter to the two heaviest FS-touching POST endpoints that were scoped out of U4 (abhigyanpatwari#1327) because CodeQL did not flag them directly. /api/analyze gets 10 rpm/IP (clone + full-tree walk), /api/embed gets 20 rpm/IP (ONNX inference per file). Adds structural wiring tests matching the existing rate-limit.test.ts pattern.
|
@azizur100389 is attempting to deploy a commit to the NexusCore Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
CI Report✅ All checks passed Pipeline Status
Test Results
✅ All 8019 tests passed 1 test(s) skipped — expand for details
Code CoverageTests
📋 View full run · Generated by CI |
Collaborator
|
Thank you for this! |
Contributor
Author
|
Happy to contribute! The clear issue write-up made it straightforward to pick up. Thanks for the quick merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
createRouteLimiter()toPOST /api/analyze(10 rpm/IP) andPOST /api/embed(20 rpm/IP) — the two heaviest FS-touching endpoints that were out of scope for U4 (fix(server): add per-route rate limiting on FS-touching endpoints (U4) #1327) because CodeQL did not flag them directly.rate-limit.test.tsmatching the existing pattern.Changes
gitnexus/src/server/api.tscreateRouteLimiter({ limit: 10 })on POST /api/analyze,createRouteLimiter({ limit: 20 })on POST /api/embedgitnexus/test/unit/rate-limit.test.tsTest plan
npx tsc --noEmit— cleannpx vitest run test/unit/rate-limit.test.ts— 15/15 pass (was 13)npx prettier --checkon changed files — cleanvitest run --project default— only pre-existing dev-env failures (home dir.gitcauses tmpdir-based tests to see a parent git repo); all pass on CICloses #1328