fix : add repository ownership check to GET /api/annotations endpoint#2361
fix : add repository ownership check to GET /api/annotations endpoint#2361tmdeveloper007 wants to merge 1 commit into
Conversation
Prevents IDOR vulnerability where any authenticated user could read annotations for any repository by providing its repositoryId. Adds enforceRepositoryPermission check before querying mapAnnotation records, returning 404 (not 403) to avoid repository enumeration. Fixes nisshchayarathi#2353
|
@tmdeveloper007 is attempting to deploy a commit to the Nisshchaya's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Warning Review limit reached
More reviews will be available in 59 minutes and 21 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
🎉 Thanks for your contribution, @tmdeveloper007!Your PR has passed our automated GSSoC quality checks. Here's a quick summary:
A maintainer will review your PR soon. Please be patient and available for feedback. 💪 GSSoC'26 automation · Maintainer: @nisshchayarathi |
|
CI status: Build, Type Check, Lint, CodeQL, GSSoC checks all green. Note: Unit Tests job reports a pre-existing failure in app/api/auth/sessions/tests/route.test.ts due to a Jest/ESM module compatibility issue (jose/dist/browser/index.js). This failure exists on the upstream main branch and is unrelated to this PR. Ready for merge. |
Fixes #2353
Summary
The
GET /api/annotations?repositoryId=<id>endpoint required authentication but performed no repository ownership check. Any authenticated user could read the map annotations for any repository by simply providing itsrepositoryId.Changes
app/api/annotations/route.ts: AddedenforceRepositoryPermission(request, repositoryId, read)call before queryingmapAnnotationrecords. Returns 404 (not 403) when access is denied to avoid leaking repository existence to unauthorized users.Security Impact
Closes an Insecure Direct Object Reference (IDOR) vulnerability. Users can no longer access annotations for repositories they do not own or have been granted access to.