Skip to content

Strengthen SSRF Protection in URL Resolver#336

Open
d-oit wants to merge 2 commits into
mainfrom
fix/security-ssrf-protection-hardening-9529171255528985168
Open

Strengthen SSRF Protection in URL Resolver#336
d-oit wants to merge 2 commits into
mainfrom
fix/security-ssrf-protection-hardening-9529171255528985168

Conversation

@d-oit

@d-oit d-oit commented Jun 20, 2026

Copy link
Copy Markdown
Owner

I identified a potential SSRF vulnerability in the isPrivateIP check within src/lib/resolver.ts. The original check was missing several reserved IP ranges and did not fully account for all IP representations that the URL constructor might normalize to.

I have implemented the following improvements:

  1. Hardened Blacklist: Updated the IPv4 regex to include all reserved ranges defined in RFCs, including the 0.0.0.0/8, 100.64.0.0/10, and documentation ranges.
  2. Enhanced IPv6 Coverage: Added checks for unspecified (::), loopback (::1), multicast (ff00::/8), and improved IPv4-mapped address detection.
  3. Robust Testing: Created a new test file src/lib/__tests__/ssrf.test.ts with over 30 test cases, including obfuscated IP formats (decimal, octal, hex) which are normalized by the browser's URL implementation.
  4. Validation: All tests pass, and existing resolver tests remain stable.

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

- 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>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions github-actions Bot added config tests Related to automated/manual tests labels Jun 20, 2026
@codacy-production

codacy-production Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Not up to standards ⛔

🔴 Issues 4 high

Alerts:
⚠ 4 issues (≤ 0 issues of at least minor severity)

Results:
4 new issues

Category Results
ErrorProne 4 high

View in Codacy

🟢 Metrics 47 complexity · 2 duplication

Metric Results
Complexity 47
Duplication 2

View in Codacy

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config tests Related to automated/manual tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant