Skip to content

do not hand system proxy credentials to the origin server - #925

Open
Hsnmohd wants to merge 1 commit into
apache:masterfrom
Hsnmohd:system-creds-proxy-target
Open

Hsnmohd wants to merge 1 commit into
apache:masterfrom
Hsnmohd:system-creds-proxy-target

Conversation

@Hsnmohd

@Hsnmohd Hsnmohd commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

SystemDefaultCredentialsProvider, the default credentials provider of every client builder, falls back to asking java.net.Authenticator for RequestorType.PROXY credentials for whatever host issued the challenge, so with the common getRequestorType() == PROXY authenticator any origin server that answers 401 Basic is sent the JVM's proxy credentials (reproduced with HttpClients.createDefault() and HttpAsyncClients.createDefault(), direct and behind a proxy); skip the PROXY lookup when the auth scope is the host:port of the request being executed, which leaves 407 handling for forwarded and CONNECT requests unchanged.

SystemDefaultCredentialsProvider asked java.net.Authenticator for
RequestorType.PROXY credentials whenever no SERVER credentials were
found, whatever host issued the challenge. With an Authenticator that
answers proxy requests, as is common for corporate proxies, any origin
server replying 401 Basic was sent the proxy credentials. Skip the
PROXY lookup when the auth scope is the target of the request being
executed; 407 challenges from the proxy resolve as before.
@ok2c ok2c self-assigned this Nov 3, 2026
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.

2 participants