Skip to content

Vscode cannot access extensions marketplace when http.proxy contains user credentials #196630

Open

Description

@digeomel

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:

  1. How vscode accesses the extensions marketplace for updates/installs
  2. 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

  1. vscodenpa commented on Oct 25, 2023

    @vscodenpa

    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!

  2. digeomel commented on Oct 26, 2023

    @digeomel
    Author

    This also happens in 1.83.1.

  3. chrmarti commented on Oct 26, 2023

    @chrmarti
    Collaborator

    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.

  4. added
    proxy
    on Oct 26, 2023
  5. digeomel commented on Oct 26, 2023

    @digeomel
    Author

    Christof Marti (@chrmarti) could it be the existence of special URL-encoded characters like @ -> %40 in the password?
    Should I open this issue with the Electron team?
    And what is the role of http.proxyAuthorization then?

  6. digeomel commented on Oct 26, 2023

    @digeomel
    Author

    Is this the code that issues the request?

    async request(options: IRequestOptions, token: CancellationToken): Promise<IRequestContext> {

    I found an issue with Electron that's supposed to be closed almost 4 years ago:

    electron/electron#21269

  7. chrmarti commented on Oct 27, 2023

    @chrmarti
    Collaborator

    It turns out that we don't set the proxy for Electron when there is an @ in the URL:

    if ((newHttpProxy || '').indexOf('@') === -1 && (newHttpProxy !== this.currentHttpProxy || newNoProxy !== this.currentNoProxy)) {
    . This might have been to work around electron/electron#21269.

  8. added
    bug
    on Oct 27, 2023
  9. chrmarti commented on Sep 4, 2026

    @chrmarti
    Collaborator

    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.

  10. added this to the 1.137.0 milestone on Sep 4, 2026
  11. mrleemurray commented on Sep 7, 2026

    @mrleemurray
    Contributor

    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 @ -> %40 in the password?" — was never answered and is still broken today.

    What works

    c36c1716 strips credentials from the proxy URL before handing it to Electron and replays them from the proxy auth challenge. Verified working:

    http.proxy passed to Electron proxy set? credentials replied
    http://user:[email protected]:5678/ http://10.20.30.40:5678 yes user / password
    http://[email protected]:5678/ http://10.20.30.40:5678 yes user / ""
    https://user:[email protected]:8080/ https://proxy.corp.com:8080 yes user / password

    The attempt > 1 guard 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.proxy passed to Electron proxy set? credentials replied
    http://user:p%[email protected]:5678/ http://[email protected]:5678 no user / p
    http://us%40er:[email protected]:5678/ (unchanged) no 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.parse percent-decodes the authority. A password of p%40ss therefore arrives as p@ss, so the authority string contains two @:

    input           : http://user:p%[email protected]:5678/
    uri.authority   : user:p@[email protected]:5678
                                ^         ^
                           indexOf     lastIndexOf
    

    Both call sites take indexOf('@') — the first @, which is now inside the password — instead of the userinfo separator, which is the last @:

    Because the stripped URL still contains @, the guard at windowImpl.ts:1198 then skips setProxy entirely:

    if ((newHttpProxy || '').indexOf('@') === -1 && (newHttpProxy !== this.currentHttpProxy || ...)) {

    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 %40 and will hit this.

    Suggested fix

    Switching both call sites from indexOf('@') to lastIndexOf('@') resolves every failing case with no change to the currently-passing ones. I verified this across the full matrix using the real URI implementation:

    http.proxy current with lastIndexOf
    http://user:p%[email protected]:5678/ not set, user/p http://10.20.30.40:5678, user/p@ss
    http://us%40er:[email protected]:5678/ not set, us/"" http://10.20.30.40:5678, us@er/password
    http://user:pa%[email protected]:5678/ works unchanged
    http://user:[email protected]:5678/ works unchanged
    http://[email protected]:5678/ works unchanged
    http://10.20.30.40:5678/ works unchanged

    Two notes for whoever picks this up:

    1. The logic is duplicated verbatim in windowImpl.ts and auth.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.ts already owns Credentials and is imported by auth.ts), with unit tests — there is currently no test coverage for this parsing at all.

    2. Care is needed to keep two existing behaviours:

      • Parsing is skipped when the raw string contains no @, which avoids round-tripping a scheme-less proxy such as 10.20.30.40:5678 through URI.
      • The indexOf('@') === -1 guard before setProxy should 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).
    3. A username containing %3A stays 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.

  12. digeomel commented on Sep 7, 2026

    @digeomel
    Author

    Amazing analysis Lee Murray (@mrleemurray) , thanks a lot! Let's hope it will be reopened and fixed as you suggested!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugproxyverification-found

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions