microsoft / vscode

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

JSON schemas are not loading within remote WSL server #89647

Closed DullReferenceException closed 4 years ago

DullReferenceException commented 4 years ago

Issue Type: Bug

Various extensions (eslint, prettier) that deal with JSON files are reporting that they're failing to parse JSON schemas. Example:

Unable to parse content from 'http://json.schemastore.org/eslintrc': Parse error at offset 0 (768).

I'm on Windows, using WSL (connected to the remote vscode server). From WSL, I'm able to use curl to download the file just fine, and it looks like valid JSON. It's unclear where to find more details on why it's failing to parse.

VS Code version: Code 1.41.1 (26076a4de974ead31f97692a0d32f90d735645c0, 2019-12-18T14:58:56.166Z) OS version: Windows_NT x64 10.0.18362 Remote OS version: Linux x64 4.4.0-18362-Microsoft

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz (12 x 2592)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: enabled
rasterization: enabled
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|31.73GB (13.03GB free)| |Process Argv|--folder-uri vscode-remote://wsl%2Bubuntu/home/jpage/Code/vnext-api| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu| |OS|Linux x64 4.4.0-18362-Microsoft| |CPUs|Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz (12 x 2592)| |Memory (System)|31.73GB (13.03GB free)| |VM|0%|
Extensions (5) Extension|Author (truncated)|Version ---|---|--- remote-wsl|ms-|0.41.7 vscode-eslint|dba|2.0.15 prettier-vscode|esb|3.20.0 vscode-mocha-test-adapter|hbe|2.2.0 vscode-test-explorer|hbe|2.15.0
DullReferenceException commented 4 years ago

Looks like the error stems from this line: https://github.com/microsoft/vscode-json-languageservice/blob/ccf866e1599b67b3cd44d34b93a8e1ed35070336/src/services/jsonSchemaService.ts#L378

DullReferenceException commented 4 years ago

Additional clue: occurs when connected to the remote WSL vscode service only. When running vscode entirely on Windows (pointing to the mounted WSL file system), the extensions are able to load their JSON schemas just fine.

DullReferenceException commented 4 years ago

Turned on a packet sniffer. There's an odd redirect response from the server:

GET http://json.schemastore.org/eslintrc HTTP/1.1
Accept-Encoding: gzip, deflate
Host: json.schemastore.org
Connection: close
X-IWS-DATA: $ENC$c7356739e2bcda7427c24fdb17889223c9a18d84644d6f2bd04acf52ac8224ae6ae9d438093466739916c7040231d923670b36de0818ff1a18f3e4daea5f5cdc15bf48a7390c922f1aece962fa1dda4ab701fd8f02b350fe7f2091c8bf669e283972215f47e1abae1600fcb1479bd3cca4e87c1b4f8d47d68b40acb84289dc91

HTTP/1.1 307 Temporary Redirect
Connection: Close
Content-Type: text/html; charset=UTF-8
P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTR STP IND DEM"
Set-Cookie: _zk_sc_tc1=1; HttpOnly
Set-Cookie: _zk_sc_tc2=1; expires=Wed, 05-Feb-2020 21:35:39 GMT; Path=/; Domain=.schemastore.org; HttpOnly
Set-Cookie: _zk_sc_d=; expires=Mon, 01-Jan-1990 00:00:00 GMT; HttpOnly
Set-Cookie: _zk_sc_d=; expires=Mon, 01-Jan-1990 00:00:00 GMT; Path=/; Domain=.schemastore.org; HttpOnly
Location: https://auth.iws-hybrid.trendmicro.com:443/auth?forward=http%3A%2F%2Fjson.schemastore.org%2Feslintrc&client=6283214b2b1878896195b40e66826b0312c4adae81af9fb37366e0ee4b4d9a89d6d44a25856ab64ac3c0bb48f688085b29dbf57e114d69e291d30ef56fc719ade542d0c95299f1e11865b2ff4f9ff530
Date: Wed, 29 Jan 2020 21:35:39 GMT

Maybe is from corporate "security" software hijacking the HTTP request?

DullReferenceException commented 4 years ago

Is there a way to use https for these schema downloads instead to avoid this sort of hijacking?

DullReferenceException commented 4 years ago

Looks like turning on proxy support for extensions in my WSL settings solved the issue.