microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.65k stars 28.68k forks source link

Proxy parameters are ignored and user-settings are missing a proxy-bypass option #44941

Open omniproc opened 6 years ago

omniproc commented 6 years ago

Issue Type

Bug

Description

@joaomoreno mentioning you here as discussed in https://github.com/Microsoft/vscode-docs/pull/1069

Steps to reproduce

  1. Start VSC using code --proxy-server="myproxy:8080" --proxy-bypass-list="*.someinternaldomain" --ignore-certificate-errors
  2. Make sure in the user settings the options http.proxy and http.proxyStrictSSL are not set.

Expected outcome: VSC should use the proxy myproxy:8080 for ALL protocols except when connecting so any subdomain on .someinternaldomain. Also it should ignore any SSL errors. This should be true for all VSC parts that require networking and all plug-ins that do so.

Actual outcome: All submitted cmd parameters seem to be ignored atleast for parts of VSC.

Observed behaviour: Create a JSON-Schema that is referencing both a public URL and an internal URL, e.g.

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "properties": {
        "something": {
            "$ref": "https://repo.someinternaldomain/some-internal-schema.json"
        }
    }
}

where some-internal-schema.json can be an blank JSON such as

{}

VSCode will then try to resolve both: the internal and the public domains. Given the cmd params we used to start VSC both should work. But actually what I get is

Unable to load schema from 'repo.someinternaldomain'. Error: self signed certificate in certificate chain

Testing further, I set the option "http.proxyStrictSSL" : false in the VSC user settings, the certificate error now is replaced by the following error:

Unable to load schema from 'http://json-schema.org/draft-07/schema': Unable to connect to http://json-schema.org/draft-07/schema. Error: connect ECONNREFUSED 127.0.0.1:80

Note that on the same system I am able to visit json-schema.org without any issues using the same proxy configuration. This can be also tested when setting "http.proxy": "http://myproxy:8080" in the user settings. Then the error will go away. Now public connections are working just fine but the internal connections will still not work because --proxy-bypass-list, just like all the other cmd parameters seems to be ignored.

So the issue is:

  1. chromium proxy parameters as shown above are ignored by some parts of VSC (used for JSON schema validation). Note that this also happens with code --disable-extensions so I believe this is a built-in feature.
  2. a option to configure a proxy-bypass-list in the user-settings is missing (this would be a great addition not only because the parameters are not working but in general)

VS Code Info

VS Code version: Code 1.20.1 (f88bbf9137d24d36d968ea6b2911786bfe103002, 2018-02-13T15:34:36.336Z) OS version: Windows_NT x64 6.3.9600

System Info |Item|Value| |---|---| |CPUs|Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz (2 x 2497)| |Memory (System)|8.00GB (6.40GB free)| |Process Argv|C:\Program Files\Microsoft VS Code\Code.exe| |Screen Reader|no| |VM|100%|
Extensions (18) Extension|Author (truncated)|Version ---|---|--- rainbow-brackets|2gu|0.0.6 npm-intellisense|chr|1.3.0 vscode-markdownlint|Dav|0.13.0 vscode-eslint|dba|1.4.7 githistory|don|0.4.0 vscode-generate-getter-setter|DSK|0.4.2 gitlens|eam|8.0.2 EditorConfig|Edi|0.12.1 tslint|eg2|1.0.28 LogFileHighlighter|emi|2.1.1 json-tools|eri|1.0.2 docthis|joe|0.6.0 git-indicators|lam|2.1.1 quicktype|qui|8.5.86 linter-xo|sam|2.1.3 json-schema-validator|tbe|0.1.0 better-align|wwm|1.1.6 markdown-all-in-one|yzh|1.0.5 (2 theme extensions excluded)

Reproduces without extensions

joaomoreno commented 6 years ago

Unfortunately, you got all that correctly. There really isn't any workaround for now. More info here: https://code.visualstudio.com/docs/setup/network

JSON is an extension, but it doesn't get disabled with --disable-extensions.

cdenneen commented 6 years ago

@joaomoreno looking through some old issues it seems #27838 should have fixed proxy settings being ignored but user posted this recently and it seems to be still related in current build:

https://gitlab.com/fatihacet/gitlab-vscode-extension/issues/10#note_61906562

image

They were able to circumvent this with changing in Windows 10 Control Panel but might be worth noting. /cc @code-adn

tmeckel commented 6 years ago

@joaomoreno , @cdenneen Same issue here. Although I set the proxy server via the command line using --proxy-server= and setting it in the personal settings via "http.proxy": I get the following error message:

Unable to load schema from 'https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json': <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta type="copyright" content="Copyright (C) 1996-2017 The Squid Software Foundation and contributors">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ERROR: Cache Access Denied</title>
...

Seems to me that VSCode is still using the systems settings and not the one used via the command line and personal profile.

To circumvent the NTLM Corporate Proxy I'm using CNTLM on my local machine and configured VSCode accordingly as stated above.

kcslb92 commented 5 years ago

@joaomoreno , @cdenneen Same issue here. Although I set the proxy server via the command line using --proxy-server= and setting it in the personal settings via "http.proxy": I get the following error message:

Unable to load schema from 'https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json': <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta type="copyright" content="Copyright (C) 1996-2017 The Squid Software Foundation and contributors">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ERROR: Cache Access Denied</title>
...

Seems to me that VSCode is still using the systems settings and not the one used via the command line and personal profile.

To circumvent the NTLM Corporate Proxy I'm using CNTLM on my local machine and configured VSCode accordingly as stated above.

Hi @tmeckel, I am wondering if you can please give some details on how you setup CNTLM to work with your transparent NTLM Corporate Proxy? I am trying to do the same and having issues.

Cheers!

chrmarti commented 3 years ago

Checking in VS Code 1.53, I see --proxy-server and --proxy-bypass-list being applied, but --ignore-certificate-errors is not applied (except where we use the Chromium network stack - but not in extensions).

dreamcat4 commented 1 year ago

today i run vscode for the first time in several months. And it cannot download any extensions. Tried messing with the proxy user settings, didn't do anything

OK so while troubleshooting get taken to this page

which clearly says there is a cmdline option supported from chromium --no-proxy-server

However the option is not recognized

$ code --no-proxy-server
Option 'proxy-server' requires a non empty value. Ignoring the option.

And doesn't work. Then i see this comment:

https://github.com/microsoft/vscode/issues/129203#issuecomment-900370933

@chrmarti can you please shed any light on this issue? As I appear to be using the latest version of vscode here on ubuntu 22.04... and i don't have any system proxy config afaikt

APT-Sources: http://packages.microsoft.com/repos/code stable/main amd64 Packages`
11:53 AM `Version: 1.74.0-1670260027

Cannot use vscode now as a result of this issue. It seems like a lot of trouble to disable this feature, that would be helpful. Maybe an env var instead?

[edit] well i also tried code --no-proxy-server=true but that XHR failed error still appears. The extensions list shows up fast and without delay however when clicking 'update' on any extension then it hangs and times out (cannot connect). And the xhr failed appears in logs after the timeout limit is exceeded

thommierother commented 10 months ago

Unfortunately this issue is still open on 1.84.2 on linux. The variables --no-proxy-server and --proxy-bypass-list have no effect and are ignored:

thommie@odysseus3:~> /usr/share/code/code --no-proxy-server --proxy-bypass-list=mercedes-benz.com --unity-launch %F
Option 'proxy-server' requires a non empty value. Ignoring the option.
UmaisZahid commented 10 months ago

Can confirm, seeing the same issue.