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

fix: Proxy and client cert authentication #1068

Merged
merged 10 commits into from
Mar 5, 2021

Conversation

FrankEssenberger
Copy link
Contributor

I realized while working on BAS that client certificate authentication is not working when also proxies are used.
I adjusted our code that the proxy settings are also passed to the http-agent. Unfortunately also the proxy agent itself does not forward the presented certificates to the target system. So they stay on the proxy and you get a 401.

I checked by locally adjusting the node modules that this PR TooTallNate/proxy-agents#111 fixes the issue, but the repo seems to be not very active. We can merge the code on our side but it will not work until we get an update on the node-https-proxy and this could take a while...

Copy link
Contributor

@jjtang1985 jjtang1985 left a comment

Choose a reason for hiding this comment

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

Looks good.
My concern would be the linting and automated tests.

packages/core/src/http-client/http-agent.ts Outdated Show resolved Hide resolved
@@ -29,10 +29,12 @@ export function getAgentConfig(
const agentType = destination.proxyConfiguration
? AgentType.PROXY
: AgentType.DEFAULT;
// eslint-disable-next-line @typescript-eslint/no-shadow
const certificateOptions = getCertificateOption(destination);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see shadow name. Could you please share a bit details?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for me I got a lint error that the variable in the if block below is shadowed - I do not understand that either.

packages/core/src/http-client/http-agent.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@jjtang1985 jjtang1985 left a comment

Choose a reason for hiding this comment

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

Looks good, with a minor comment.
Linting will be handled in a follow up ticket.

packages/core/src/connectivity/scp-cf/proxy-util.ts Outdated Show resolved Hide resolved
@jjtang1985
Copy link
Contributor

For the failing unit test, if you need further review, just let me know.

@FrankEssenberger FrankEssenberger merged commit 9a0fb21 into main Mar 5, 2021
@FrankEssenberger FrankEssenberger deleted the fix-client-cert-and-proxy branch March 5, 2021 13:11
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.

3 participants