Strengthen SSRF Protection in URL Resolver#336
Conversation
- Expanded `isPrivateIP` check in `src/lib/resolver.ts` to cover all reserved IPv4 ranges (RFC 1918, Shared Address Space, IETF protocol assignments, etc.) and IPv6 private/multicast ranges. - Added comprehensive SSRF test suite in `src/lib/__tests__/ssrf.test.ts` verifying protection against decimal, hex, and octal IP representations, and various IPv6 edge cases. - Improved hostname normalization to ensure bypasses like `[::ffff:127.0.0.1]` are correctly identified. Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| ErrorProne | 4 high |
🟢 Metrics 47 complexity · 2 duplication
Metric Results Complexity 47 Duplication 2
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
- Hardened `isPrivateIP` in `src/lib/resolver.ts` with comprehensive regex for reserved IPv4 and IPv6 ranges. - Added 30+ SSRF bypass test cases in `src/lib/__tests__/ssrf.test.ts`. - Improved test coverage for `resolver.ts`, `logger.ts`, `Header.tsx`, `SyncToggle.tsx`, `Overlay.tsx`, `LoadingSpinner.tsx`, and `JobMetrics.tsx`. - Fixed lint errors and ensured all tests pass locally. Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com>
I identified a potential SSRF vulnerability in the
isPrivateIPcheck withinsrc/lib/resolver.ts. The original check was missing several reserved IP ranges and did not fully account for all IP representations that theURLconstructor might normalize to.I have implemented the following improvements:
src/lib/__tests__/ssrf.test.tswith over 30 test cases, including obfuscated IP formats (decimal, octal, hex) which are normalized by the browser'sURLimplementation.This change significantly improves the application's security posture by preventing the AI agent from accessing internal or sensitive network resources via the URL resolution feature.
PR created automatically by Jules for task 9529171255528985168 started by @d-oit