fix : add SSRF validation to repository analysis endpoint#2351
fix : add SSRF validation to repository analysis endpoint#2351tmdeveloper007 wants to merge 1 commit into
Conversation
|
Someone 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 30 minutes and 41 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 |
Fixes #2120
Summary
The
POST /analyzeendpoint inapp/analyze/route.tsaccepted any string as a repository URL and forwarded it to the analysis pipeline without performing SSRF-safe URL validation. A user could submit URLs pointing to internal network resources (e.g. AWS metadata endpoint169.254.169.254, private IPs like192.168.1.1) which would be processed by the worker.Changes
app/analyze/route.ts: AddedvalidateSafeUrl()SSRF check afternormalizeKnownRepoHttpUrl()validates the URL format. If the URL resolves to a private, loopback, or link-local IP, a400response is returned with the message: "Please enter a valid public GitHub, GitLab, or Bitbucket repository URL. Internal and private network addresses are not allowed."Security Impact
Prevents SSRF attacks where a user submits an internal network URL through the repository analysis form. The same URL format validation already existed (via
normalizeKnownRepoHttpUrl), but there was no check that the resolved IP was publicly reachable.