The host '...' was not found in the list of allowed hosts. Do you want to open it anyway?

27k Views Asked by At

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?

4

There are 4 best solutions below

10
Sean O On BEST ANSWER

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

Note "a restart is required when changing this setting"

a screenshot of vs code settings specifically the security section and the allowed UNCHosts

4
Daniela Wuerich On

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

1
Erwin Kurnia On

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

0
VonC On

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.