jfrog / jfrog-vscode-extension

JFrog VS-Code Extension
https://jfrog.github.io/jfrog-vscode-extension
Apache License 2.0
189 stars 32 forks source link

Weird behaviour / not working with a proxy #97

Open jbackes opened 3 years ago

jbackes commented 3 years ago

Describe the bug We have an X-Ray server only reachable over a proxy server; lets say X-Ray server is https://xray and proxy is http://proxy:6789; note that proxy is http and X-Ray is https. I set the proxy in vscode and this seems to be working perfectly fine, i.e. I can install plugins, update vscode and wireshark for example logs from my ip to proxy ip: CONNECT update.code.visualstudio.com:443 HTTP/1.1 which succeeds with "Connection Established" etc. But after entering the X-Ray configuration, the status bar just says "Checking connection with Xray server..." for about maybe 10 minutes and then an alert window pops up saying "Socket hang up". Wireshark logs something weird (at least in my opinion): There is no CONNECT to the proxy but an http POST to the proxy with request url https://xray/api/v1/summary/component. In my opinion, wireshark should not see this POST because the connection should be ssl/tls encrypted but it seems like the plugin never tries to establish an ssl connection.

To Reproduce Try to configure an https xray over an http proxy

Expected behavior A successful connection to xray

Versions

PiyushJonnie commented 2 years ago

Steps to reproduce the issue :

Visual Studio Code error message window appears with text: “Request failed with status code 400”

eyalbe4 commented 2 years ago

Thank you for reporting this issue @PiyushJonnie! Is you JFrog environment accessible through an HTTP proxy? If so, ddi you set your proxy details as described here?

PiyushJonnie commented 2 years ago

@eyalbe4 Yes, here JFrog environment is only accessible through an HTTP proxy. Proxy settings are configured as mentioned in the link. If the proxy is disabled, the response changes to:

“Could not connect to Xray: Error connect ETIMEDOUT :443”

Other extensions are working correctly and are able to use the proxy as expected.

jghal commented 1 year ago

I am seeing the similar issue, except I can make it all the way through the configuration prompts including my Artifactory credentials, and then it's a few seconds until the error pops up.

I tried setting jfrog.logLevel to debug but I don't know where that log is to check it.

VS Code version

Version: 1.76.1 (user setup)
Commit: 5e805b79fcb6ba4c2d23712967df89a089da575b
Date: 2023-03-08T16:32:00.131Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Windows_NT x64 10.0.19044
Sandboxed: Yes

Extension version

Name: JFrog
Id: JFrog.jfrog-vscode-extension
Description: JFrog Xray scanning of Go, npm, Pypi, Maven and NuGet project dependencies.
Version: 2.0.2
Publisher: JFrog
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=JFrog.jfrog-vscode-extension
jghal commented 1 year ago

And just to confirm the negative, I am able to connect the extension to this same [public-facing] Artifactory server when off the corporate network and not using a proxy.

jghal commented 1 year ago

Additionally. Both jfrog and frogbot can connect to the Artifactory server with the proxy with http[s]_proxy env variables set. I've tried with and without proxy authentication configured, though I don't actually need to authenticate the proxy for this server (confirmed with jfrog and curl). When I set the extension log level to debug, I don't see any extra info in the extension logs versus info logging.

attiasas commented 1 year ago

Our apologies for the inconvenience caused by this. This PR - jfrog-client-js/pull/73 should fix it. Fix released from version 2.2.0+