Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@actions/http-client proxy auth token not properly encoded #1798

Closed
bdehamer opened this issue Aug 16, 2024 · 0 comments · Fixed by #1799
Closed

@actions/http-client proxy auth token not properly encoded #1798

bdehamer opened this issue Aug 16, 2024 · 0 comments · Fixed by #1799
Labels
bug Something isn't working

Comments

@bdehamer
Copy link
Contributor

bdehamer commented Aug 16, 2024

When using the octokit client from the @actions/github library to make requests through an authenticated proxy, the user/password creds are not properly encoded in the Proxy-Authorization header.

If I have an env var like the following:

https_proxy=http://username:password@hostname:port/

And sniff the outgoing network request, I can see that the Proxy-Authorization header is set to the following:

Proxy-Authorization: username:password

The correct value should be a base64-encoded basic auth value:

Proxy-Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

The issue is with the following line:

token: `${proxyUrl.username}:${proxyUrl.password}`

The token value being passed to the ProxyAgent is the un-encoded username/password pair. However, according to the documentation for the undici library (https://undici.nodejs.org/#/docs/api/ProxyAgent?id=example-basic-proxy-request-with-authentication), the supplied token needs to be pre-encoded:

token: `Basic ${Buffer.from('username:password').toString('base64')}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant