Skip to content

Keep Basic auth header when username or password is empty - #8145

Closed
adityav1709 wants to merge 1 commit into
google:mainfrom
adityav1709:fix/8139-basic-auth-empty-credentials
Closed

adityav1709 wants to merge 1 commit into
google:mainfrom
adityav1709:fix/8139-basic-auth-empty-credentials

Conversation

@adityav1709

Copy link
Copy Markdown

HttpCredentials permits an empty username or password, but the Basic auth header builders used truthiness checks, so they silently dropped the Authorization header, for example when an API key is used as the username with an empty password. This change checks for None instead of truthiness, matching the OpenAPI auth helper which already does this. Adds regression tests. Fixes #8139. Built with Muse (Aurora) as co-author.

HttpCredentials permits an empty username or password, but the Basic auth header builders used truthiness checks, so they silently dropped the Authorization header, for example when an API key is used as the username with an empty password.

Check for None instead of truthiness, matching the OpenAPI auth helper which already does this.

Fixes google#8139

Signed-off-by: adityav1709 <adityav170920@gmail.com>
Co-authored-by: Muse (Aurora)
@adityav1709

Copy link
Copy Markdown
Author

HttpCredentials permits an empty username or password, but the Basic auth header builders used truthiness checks, so they silently dropped the Authorization header, for example when an API key is used as the username with an empty password. This change checks for None instead of truthiness, matching the OpenAPI auth helper which already does this. Adds regression tests. Fixes #8139. Built with Muse (Aurora) as co-author (adityav170920@gmail.com)

@adityav1709

Copy link
Copy Markdown
Author

Superseded by #8151 — same fix, clean commit without the co-author line to satisfy the Google CLA.

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.

Basic HTTP auth drops credentials with empty username or password

2 participants