Repository navigation
Description
Does this issue occur when all extensions are disabled?: Not applicable, the bug is precisely about extensions
- VS Code Version: Code 1.83.0 (e7e0370, 2023-10-03T16:11:49.843Z)
- OS Version: Linux x64 5.15.0-86-generic snap (Ubuntu 22.04.3 LTS)
I have checked most previously reported issues related to the proxy and extensions (and there are quite a few and mostly a few years old), and although those have been closed/solved, mine is not.
I'm on Ubuntu 22.04.3 LTS.
First of all, there are two separate issues here:
- How vscode accesses the extensions marketplace for updates/installs
- How extensions access the Internet
My proxy-related settings are as follows:
{
"http.proxy": "http://user:[email protected]:5678/",
"http.proxySupport": "on",
"http.proxyAuthorization": null,
"http.proxyStrictSSL": false,
}With the settings above, vscode cannot access the extensions marketplace. If I remove the user:password@ part, everything works fine.
However, and this is related to the 2nd issue, using this extension: https://marketplace.visualstudio.com/items?itemName=chrmarti.network-proxy-test which I assume tests if extensions can access the Internet, it is the other way around. Without the user credentials, it fails, with them it works.
The environment variables http_proxy and https_proxy are both set to http://user:[email protected]:5678/.
Please note that I also tried setting http.proxyAuthorization to a base64-encoded string of user:password, but that didn't work for both scenarios. In this case, I'm also not sure if special characters like @ which normally have to be url-encoded, as %40, need to be encoded here before passed to base64, or there's no need for encoding at all. I think I tried both.
I realize that for the 2nd issue different extensions might use different ways to access the Internet, and some may not work with the proxy settings, but why can't vscode access the extensions marketplace when user credentials are present?
PS. Redirected here from microsoft/vsmarketplace#783 as I thought that this was an issue with the marketplace.
Activity
vscodenpa commentedon Oct 25, 2023
Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.83.1. Please try upgrading to the latest version and checking whether this issue remains.
Happy Coding!
digeomel commentedon Oct 26, 2023
This also happens in 1.83.1.
chrmarti commentedon Oct 26, 2023
We feed
"http.proxy"back to Electron which is used for accessing the marketplace. That should work with credentials, but not in this case. Not sure what might make the difference.digeomel commentedon Oct 26, 2023
Christof Marti (@chrmarti) could it be the existence of special URL-encoded characters like
@->%40in the password?Should I open this issue with the Electron team?
And what is the role of
http.proxyAuthorizationthen?digeomel commentedon Oct 26, 2023
Is this the code that issues the request?
vscode/src/vs/platform/request/browser/requestService.ts
Line 28 in 7eec26f
I found an issue with Electron that's supposed to be closed almost 4 years ago:
electron/electron#21269
chrmarti commentedon Oct 27, 2023
It turns out that we don't set the proxy for Electron when there is an
@in the URL:vscode/src/vs/platform/windows/electron-main/windowImpl.ts
Line 801 in 56088b0
chrmarti commentedon Sep 4, 2026
Thanks for the detailed report. This was fixed in c36c171 and shipped in VS Code 1.92.0 — the proxy URL is now stripped of credentials before being passed to Electron (which doesn't handle them inline), and those credentials are supplied separately through the proxy authentication handler when Electron challenges for them. Please open a new issue if you still see problems on the latest build.
mrleemurray commentedon Sep 7, 2026
Follow-up on #196630: still reproducible when the proxy password contains an encoded character
I re-tested this issue against current
main(ccfec4b8140, 1.138.0). The fix in c36c171 works for the exact configuration in the original report, but the case digeomel raised in the thread — "could it be the existence of special URL-encoded characters like@->%40in the password?" — was never answered and is still broken today.What works
c36c1716strips credentials from the proxy URL before handing it to Electron and replays them from the proxy auth challenge. Verified working:http.proxyhttp://user:[email protected]:5678/http://10.20.30.40:5678user/passwordhttp://[email protected]:5678/http://10.20.30.40:5678user/""https://user:[email protected]:8080/https://proxy.corp.com:8080user/passwordThe
attempt > 1guard also behaves correctly — wrong credentials fall through to the login dialog rather than looping.What is still broken
If the username or password contains a character that must be percent-encoded in userinfo, the marketplace is still unreachable:
http.proxyhttp://user:p%[email protected]:5678/http://[email protected]:5678user/phttp://us%40er:[email protected]:5678/us/""Both failure modes from the original report reappear: the proxy is never applied and the credentials sent to the proxy are truncated.
Root cause
URI.parsepercent-decodes the authority. A password ofp%40sstherefore arrives asp@ss, so the authority string contains two@:Both call sites take
indexOf('@')— the first@, which is now inside the password — instead of the userinfo separator, which is the last@:windowImpl.ts:1186— used to strip credentials forsetProxyauth.ts:165— used to split username/password for the auth challengeBecause the stripped URL still contains
@, the guard atwindowImpl.ts:1198then skipssetProxyentirely:That guard is the same condition Christof Marti (@chrmarti) identified as the original cause of this issue, so the end-user symptom is identical to what was first reported: VS Code silently makes no proxy request at all, while extensions using the raw setting continue to work.
This is not an edge case — RFC 3986 requires
@in userinfo to be percent-encoded, so any user whose proxy password contains@(common in generated corporate passwords) must write%40and will hit this.Suggested fix
Switching both call sites from
indexOf('@')tolastIndexOf('@')resolves every failing case with no change to the currently-passing ones. I verified this across the full matrix using the realURIimplementation:http.proxylastIndexOfhttp://user:p%[email protected]:5678/user/phttp://10.20.30.40:5678,user/p@sshttp://us%40er:[email protected]:5678/us/""http://10.20.30.40:5678,us@er/passwordhttp://user:pa%[email protected]:5678/http://user:[email protected]:5678/http://[email protected]:5678/http://10.20.30.40:5678/Two notes for whoever picks this up:
The logic is duplicated verbatim in
windowImpl.tsandauth.ts, and the two copies must agree — if the URL is stripped at the last@but the credentials are split at the first, the proxy gets set with the wrong password. It would be worth extracting a single shared helper (src/vs/platform/request/common/request.tsalready ownsCredentialsand is imported byauth.ts), with unit tests — there is currently no test coverage for this parsing at all.Care is needed to keep two existing behaviours:
@, which avoids round-tripping a scheme-less proxy such as10.20.30.40:5678throughURI.indexOf('@') === -1guard beforesetProxyshould stay. A scheme-less URL with credentials (user:password@host:port) parses with an empty authority, so nothing is stripped, and that guard is what stops inline credentials reaching Electron (SetProxy - Using proxies that require authentication does not work. electron/electron#21269).A username containing
%3Astays ambiguous after decoding, since the username/password split falls on the first:. That is pre-existing and inherent to splitting an already-decoded authority; probably not worth addressing here.Given the original symptom is fully reproducible on
main, this issue may be worth reopening rather than tracking separately.digeomel commentedon Sep 7, 2026
Amazing analysis Lee Murray (@mrleemurray) , thanks a lot! Let's hope it will be reopened and fixed as you suggested!