microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.61k stars 275 forks source link

DevContainer: Error while installing extensions: self-signed certificate in certificate chain #9948

Closed OneCyrus closed 3 months ago

OneCyrus commented 3 months ago

Steps to Reproduce:

  1. Use a devcontainer behind TLS inspection and have extension in the devcontainer.json defined
  2. in the devcontainer dockerfile we are adding the certificates to the store and run
RUN sudo update-ca-certificates
ENV NODE_OPTIONS=--use-openssl-ca
ENV CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
ENV REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
ENV NPM_CONFIG_CAFILE=/etc/ssl/certs/ca-certificates.crt 
ENV NODE_TLS_REJECT_UNAUTHORIZED=0

node.js itself has no problem in the devcontainer. so it looks like the extension host doesn't respect those certificates.

Does this issue occur when you try this locally?: N/A Does this issue occur when you try this locally and all extensions are disabled?: N/A

OneCyrus commented 3 months ago

also tested with the chrmarti.network-proxy-test extension

Note: Make sure to replace all sensitive information with dummy values before sharing this output.

VS Code 1.89.1 (dc96b837cf6bb4af9cd736aa3af08cf8279f7685)
Network Proxy Test 0.0.11
linux 5.15.146.1-microsoft-standard-WSL2 x64

Settings:
- http.proxy: 
- http.proxyAuthorization: null
- http.proxyStrictSSL: true
- http.proxySupport: override
- http.systemCertificates: true

Environment variables:

Sending GET request to https://example.com...
vscode-proxy-agent: DIRECT
Received response:
- Status: 200 OK
Certificate chain:
- Subject: undefined
  Validity: undefined - undefined
  Fingerprint: undefined
Received error: Cannot read properties of undefined (reading 'CN')
Retrying while ignoring certificate issues to collect information on the certificate chain.

Sending GET request to https://example.com (allowing unauthorized)...
vscode-proxy-agent: DIRECT
Received response:
- Status: 200 OK
Certificate chain:
- Subject: www.example.org (Internet Corporation for Assigned Names and Numbers)
  Subject alt: DNS:www.example.org, DNS:example.net, DNS:example.edu, DNS:example.com, DNS:example.org, DNS:www.example.com, DNS:www.example.edu, DNS:www.example.net
  Validity: Jan 30 00:00:00 2024 GMT - Mar  1 23:59:59 2025 GMT
  Fingerprint: 2F:******
- Subject: MY TLS Proxy
  Validity: Jan 15 15:31:29 2021 GMT - Jan 15 15:41:29 2031 GMT
  Fingerprint: 32:******
- Subject: MY-CA02
  Validity: Oct 11 06:15:13 2018 GMT - Oct 11 06:25:11 2038 GMT
  Fingerprint: B3:*****
  Self-signed
Local root certificates:
- Subject: CN=Root-CA02 (OS)
  Validity: Oct 11 06:15:13 2018 GMT - Oct 11 06:25:11 2038 GMT
  Fingerprint: B3:****
  Issuer: CN=MY-CA02
chrmarti commented 3 months ago

Have you tried setting NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt?

VSCodeTriageBot commented 3 months ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!