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

Disabling Proxy support does not disable proxy agent redirection #167015

Open
cheenamalhotra opened this issue Nov 22, 2022 · 5 comments
Open

Disabling Proxy support does not disable proxy agent redirection #167015

cheenamalhotra opened this issue Nov 22, 2022 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug proxy Issues regarding network proxies

Comments

@cheenamalhotra
Copy link
Member

cheenamalhotra commented Nov 22, 2022

  • VS Code Version: Latest
  • OS Version: Windows 11

Steps to Reproduce:

  1. Set HTTP_PROXY env variable to garbage value.
  2. Start VS Code and set "http.proxySupport": "off" in settings.json
  3. Make an HTTP Request (in my case I tested authorization with azurecore provider (similar to microsoft authenticator provider) - from Azure Data Studio)
  4. Notice HTTP request will fail.

Expected: Since http.proxysupport is OFF, authentication should not use proxy URL.

Explanation

VSCode should not send Proxy URL in request if proxy support is disabled. As there is no other way to override these settings and skip any injected HTTP_PROXY env variables if users don't want to use Proxy. The Proxy agent set in code despite this proxy support turned "off" causes authentication failures when proxy is not expected to play a role.

I have also tried to use startup params from here, but they don't work either: https://code.visualstudio.com/docs/setup/network#_proxy-server-support

Code Issue

I believe this code is responsible to set Proxy Agent:

const agent = options.agent ? options.agent : await getProxyAgent(options.url || '', env, { proxyUrl, strictSSL });
options.agent = agent;
options.strictSSL = strictSSL;
if (this.authorization) {
options.headers = {
...(options.headers || {}),
'Proxy-Authorization': this.authorization
};
}

I think all these 3 settings (agent, strictSSL, proxy headers) should be set only when proxy support is enabled.

@Charles-Gagnon
Copy link
Contributor

Charles-Gagnon commented Nov 22, 2022

I believe this is because extensions use a different stack for handling requests - so the settings in VS Code core don't apply to them automatically.

See #12588

@cheenamalhotra
Copy link
Member Author

cheenamalhotra commented Nov 22, 2022

I was able to make it work in ADS by updating code to what I mentioned above.
Also, yes, I'm testing ADS, but since codebase in src/vs/platform that's why I brought it up since this issue applies to VSCode core design.

@chrmarti
Copy link
Contributor

chrmarti commented Dec 9, 2022

"http.proxySupport": "off" only affects extensions.

@chrmarti chrmarti added bug Issue identified by VS Code Team member as probable bug proxy Issues regarding network proxies labels Dec 9, 2022
@fxzxmic
Copy link

fxzxmic commented Jan 7, 2023

I don't know if I need to start a new issue, but my question is: Why doesn't vscode support ALL_PROXY environment variable?

@cheenamalhotra
Copy link
Member Author

cc @chrisdias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug proxy Issues regarding network proxies
Projects
None yet
Development

No branches or pull requests

4 participants