π‘οΈ Sentinel: [CRITICAL] Fix event loop blocking in SSRF validation#121
π‘οΈ Sentinel: [CRITICAL] Fix event loop blocking in SSRF validation#121d3mocide wants to merge 1 commit into
Conversation
Co-authored-by: d3mocide <[email protected]>
|
π 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. |
π¨ Severity: CRITICAL
π‘ Vulnerability: The
_validate_request_urlevent hook used to validate URLs inhttpx.AsyncClientwithfollow_redirects=Trueinbackend/routers/radio.pycalledvalidate_safe_urlsynchronously. Becausevalidate_safe_urlperforms blocking DNS resolution (socket.getaddrinfo), executing it in an async context blocked the backend's main event loop, creating a Denial of Service (DoS) vulnerability.π― Impact: Attackers could cause a severe latency and DoS under load.
π§ Fix: Modified
_validate_request_urlinbackend/routers/radio.pyto runvalidate_safe_urlwithin a thread usingawait asyncio.get_running_loop().run_in_executor(None, validate_safe_url, str(request.url))to avoid blocking the event loop.β Verification: Tested via unit tests for backend
python3 -m unittest discover backend/tests. Added security learning entry to.jules/sentinel.md.PR created automatically by Jules for task 5840742459428934283 started by @d3mocide