Skip to content

πŸ›‘οΈ Sentinel: [HIGH] Fix Event Loop Block in SSRF Validation - #124

Open
d3mocide wants to merge 1 commit into
mainfrom
sentinel/fix-dos-ssrf-dns-resolution-6798578802006811675
Open

πŸ›‘οΈ Sentinel: [HIGH] Fix Event Loop Block in SSRF Validation#124
d3mocide wants to merge 1 commit into
mainfrom
sentinel/fix-dos-ssrf-dns-resolution-6798578802006811675

Conversation

@d3mocide

Copy link
Copy Markdown
Owner

🚨 Severity: HIGH
πŸ’‘ Vulnerability: The proxy_stream endpoint in backend/routers/radio.py performed Server-Side Request Forgery (SSRF) validation using validate_safe_url. This function relies on socket.getaddrinfo, which is a synchronous, blocking network call. Calling it directly within the async def function blocked the entire FastAPI asyncio event loop during DNS resolution.
🎯 Impact: An attacker could provide a stream URL that points to a malicious, non-responsive, or extremely slow DNS server. This would tie up the event loop during resolution, preventing the server from handling any other concurrent requests and causing a Denial of Service (DoS).
πŸ”§ Fix: Wrapped the validate_safe_url calls in await asyncio.get_running_loop().run_in_executor(None, validate_safe_url, ...) to offload the blocking DNS resolution to a separate thread, keeping the main event loop responsive.
βœ… Verification: Ran python3 -m unittest discover backend/tests/ and confirmed all 146 tests still pass, including the SSRF validation tests. Checked python syntax and docker configurations.


PR created automatically by Jules for task 6798578802006811675 started by @d3mocide

Offloaded the synchronous `validate_safe_url` DNS resolution calls to a thread pool executor in `backend/routers/radio.py`. Previously, these blocking calls ran directly in the async event loop, creating a Denial of Service (DoS) risk where a slow or malicious DNS response could stall the entire FastAPI application.

Co-authored-by: d3mocide <136547209+d3mocide@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.

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