Skip to content

πŸ›‘οΈ Sentinel: Fix SSRF via Redirects in WebsiteAnalysisService - #385

Open
criptogus wants to merge 1 commit into
mainfrom
sentinel-ssrf-fix-website-analysis-2172533208198083493
Open

πŸ›‘οΈ Sentinel: Fix SSRF via Redirects in WebsiteAnalysisService#385
criptogus wants to merge 1 commit into
mainfrom
sentinel-ssrf-fix-website-analysis-2172533208198083493

Conversation

@criptogus

Copy link
Copy Markdown
Owner

Fixed SSRF vulnerability in WebsiteAnalysisService by implementing manual redirect handling and validation. Added unit tests to verify the fix.


PR created automatically by Jules for task 2172533208198083493 started by @criptogus

🚨 Severity: HIGH
πŸ’‘ Vulnerability: SSRF via Redirects
The `WebsiteAnalysisService` used `axios` with default redirect handling (`maxRedirects: 5`). While the initial URL was validated against private IPs, a malicious server could redirect the request to a private IP (e.g., `http://localhost/admin`), bypassing the initial check.

🎯 Impact:
An attacker could access internal services (like the database REST interface or cloud metadata services) by providing a URL that redirects to them.

πŸ”§ Fix:
- Disabled automatic redirects in `axios` (`maxRedirects: 0`).
- Implemented a manual loop to follow redirects (up to 5).
- Added `validateWebUrl(currentUrl)` check at EACH step of the redirect chain.
- This ensures that every URL fetched is validated against the SSRF filter.

βœ… Verification:
- Added `backend/src/tests/services/websiteAnalysisService.test.ts` which simulates a redirect to a private IP and asserts that it is blocked.
- Ran tests successfully with `npm test`.

Co-authored-by: criptogus <128640021+criptogus@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

πŸ‘‹ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant