hardening(urllib): make redirect rejection explicit - #1631
Conversation
urllib의 HTTPRedirectHandler에서 redirect_request 메서드가 None을 반환하도록 구현할 경우, 리다이렉트를 실질적으로 차단하지 못하고 SSRF 방어를 우회할 수 있는 취약점을 해결하기 위해 명시적으로 HTTPError를 발생시키도록 변경했습니다.
|
👋 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. |
urllib의 HTTPRedirectHandler에서 redirect_request 메서드가 None을 반환하도록 구현할 경우, 리다이렉트를 실질적으로 차단하지 못하고 SSRF 방어를 우회할 수 있는 취약점을 해결하기 위해 명시적으로 HTTPError를 발생시키도록 변경했습니다.
|
|
QUEUE_SATURATION_CHICKEN_EGG: remove the four-line false vulnerability record after #1631's corrected RCA; current review/check capacity is saturated and no substantive code/security objection exists.
Preserve the current protected-main explicit urllib redirect hardening and its corrected Sentinel record while retaining #1628's workflow-backed Pages reconciliation, fail-before-write, stale-run cancellation, and documentation changes. This is a normal two-parent non-force reconciliation.
Outcome
Make the two organization-owned
urllib.request.HTTPRedirectHandlersubclasses reject redirects explicitly by raisingHTTPErrorfromredirect_request.RCA correction
The original Sentinel description classified the existing implementation as a HIGH SSRF vulnerability. Fresh review and the Python 3.14
urllib.requestcontract show that classification was incorrect: returningNonefromredirect_requestmeans this handler cannot handle the redirect and allows another handler to try; with the current opener composition the redirect target was not followed. The existing code therefore already blocked redirects. This PR is defensive contract hardening, not remediation of an active SSRF bypass.Python's documented contract says to raise
HTTPErrorwhen no other handler should try to handle the redirected URL, while returningNoneis appropriate when another handler may handle it. These openers intentionally allow no redirect handling, so explicitHTTPErrorbetter states the invariant and fails closed without relying on fallback-handler composition.Changes
NoRedirectHandler.redirect_request()raisesHTTPErrordirectly;_NoPagesRedirects.redirect_request()does the same;pr_description.txtartifact were removed after review corrected the causal classification.Safety boundary
No URL allowlist, origin validation, request destination, credential, workflow permission, branch protection, scanner threshold, or merge authority changes. Fresh exact-head checks/reviews are required; predecessor evidence does not transfer.