15

Since updating to Visual Studio Code v. 1.78.2 this warning has been popping up. It is appearing because the folder I am working out of is using a UNC path. I rely on this path.

The VS help page states:

configure the host to be allowed via the security.allowedUNCHosts setting (for example add server-a when you open a path such as \server-a\path)

Where is this setting?

Pfalbaum
  • 586
  • 3
  • 10
  • 26

4 Answers4

18

Go to preferences Ctrl + , and search for 'allowedUNCHosts'. You'll find it under Security.

Sean O
  • 2,276
  • 1
  • 21
  • 24
3

To those looking for a solution when using \\wsl$, adding wsl.localhost to the allowedUNCHHosts option worked for me. This source indicates that it can be changed in JSON settings as well.

1

The May 2023 VSCode 1.79 can also update that setting for you through a confirmation dialog.

See "Windows UNC host allowlist improvements":

As part of an important security fix, VS Code introduced an allowlist for UNC hosts.
In this milestone, we addressed many of the usability problems reported by Windows users when they have UNC paths in their day-to-day work with VS Code.

Dialog improvements

The confirmation dialog to allow a UNC host on startup now updates the security.allowedUNCHosts setting and adds the host when you select the checkbox.

Windows UNC allow dialog

In addition, clicking the Learn More button no longer closes the dialog.

New security.restrictUNCAccess setting

A new setting security.restrictUNCAccess lets you disable the UNC allowlist for hosts and restore the behavior to how it was before this security fix.

We strongly advise against changing this setting, as it makes your system vulnerable again to the Information Disclosure Vulnerability.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

Map your WSL host to your network (by right clicking on the WSL host in windows explorer and add a drive letter i.e Z), after that you can add any folder in your WSL to your VSCode workspace

  • This does work for getting rid of the message however it also means that VSCode won't open in a WSL window with all the advantages that come with that – ChrisM May 25 '23 at 03:16