Skip to content

gh-155694: Scope HTTPPasswordMgr credentials by URL scheme - #155696

Open
lkk7 wants to merge 2 commits into
python:mainfrom
lkk7:fix-http-password-mgr-scheme
Open

gh-155694: Scope HTTPPasswordMgr credentials by URL scheme#155696
lkk7 wants to merge 2 commits into
python:mainfrom
lkk7:fix-http-password-mgr-scheme

Conversation

@lkk7

@lkk7 lkk7 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #155694.

Scope HTTPPasswordMgr credentials by URL scheme. This prevents a situation where credentials stored for an HTTPS URL match a corresponding HTTP URL. URIs without a scheme will still match any scheme.

@read-the-docs-community

read-the-docs-community Bot commented Aug 13, 2026

Copy link
Copy Markdown

@Eclips4 Eclips4 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Comment thread Lib/urllib/request.py
return (scheme or None, *self.reduce_uri(uri, default_port))

def _is_suburi_with_scheme(self, base, test):
if (base[0] is not None and test[0] is not None and

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only compares the scheme if both are non-None, is that correct? Or should it check the scheme regardless of whether each is None?

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.

HTTPPasswordMgr can send saved HTTPS credentials via HTTP because of incorrect scheme matching

3 participants