Skip to content

gh-153792: Fix urllib.request digest auth crash on a malformed challenge#153793

Open
tonghuaroot wants to merge 1 commit into
python:mainfrom
tonghuaroot:urllib-digest-malformed-challenge
Open

gh-153792: Fix urllib.request digest auth crash on a malformed challenge#153793
tonghuaroot wants to merge 1 commit into
python:mainfrom
tonghuaroot:urllib-digest-malformed-challenge

Conversation

@tonghuaroot

@tonghuaroot tonghuaroot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

A malformed server-controlled WWW-Authenticate: Digest challenge made HTTPDigestAuthHandler raise a bare ValueError or IndexError out of urlopen(). Guard the two parse statements in retry_http_digest_auth and decline (return None) a challenge that cannot be parsed, as the handler already does for a 40x it cannot handle. get_authorization stays outside the guard so a real bug there is not masked.

…challenge

AbstractDigestAuthHandler.retry_http_digest_auth parsed a server-controlled
WWW-Authenticate digest challenge without guarding the parse, so a malformed
challenge raised a bare ValueError or IndexError out of urlopen(). Catch those
around the two parse statements and decline (return None), as the handler
already does for a 40x it cannot handle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant