Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Proxy authentication should not be configured if no proxy username/password is provided #39

Closed
fgalind1 opened this issue Mar 18, 2021 · 1 comment · Fixed by #42
Closed

Comments

@fgalind1
Copy link
Contributor

fgalind1 commented Mar 18, 2021

Looks like http-client is passing an invalid proxy authentication header if no proxy authentication was provided at all here

http-client/index.ts

Lines 641 to 649 in edadda1

const agentOptions = {
maxSockets: maxSockets,
keepAlive: this._keepAlive,
proxy: {
proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`,
host: proxyUrl.hostname,
port: proxyUrl.port
}
}

If a proxy server doesn't require authentication (which is an example of our company proxies), we're sending proxyAuth: ':' which ends up on being a real authentication header passed to the client and tells proxy to try validate credentials, which they will be incorrect.

Otherwise the underlaying http library for creating the tunnel will set that proxy header if proxyAuth contains a value https://github.com/request/tunnel-agent/blob/master/index.js#L128-L132

Proxy Auth should not be set if username/password is not provided

@bryanmacfarlane
Copy link
Member

taking a look. thanks for the PR

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants