Skip to content

Commit 695af09

Browse files
bpaserodeepak1556
andauthored
UNC allow list checks cannot be disabled in extension host (fix #184989) (#185085)
* UNC allow list checks cannot be disabled in extension host (#184989) * Update src/vs/base/node/unc.js Co-authored-by: Robo <[email protected]> --------- Co-authored-by: Robo <[email protected]>
1 parent 4f95907 commit 695af09

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/vs/base/node/unc.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ export function addUNCHostToAllowlist(allowedHost: string | string[]): void;
2323
* path validation.
2424
*/
2525
export function disableUNCAccessRestrictions(): void;
26+
27+
/**
28+
* Whether UNC Host allow list in node.js is disabled.
29+
*/
30+
export function isUNCAccessRestrictionsDisabled(): boolean;

src/vs/base/node/unc.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,20 @@
117117
process.enableUNCAccessChecks = false;
118118
}
119119

120+
function isUNCAccessRestrictionsDisabled() {
121+
if (process.platform !== 'win32') {
122+
return true;
123+
}
124+
125+
return process.enableUNCAccessChecks === false;
126+
}
127+
120128
return {
121129
getUNCHostAllowlist,
122130
addUNCHostToAllowlist,
123131
getUNCHost,
124-
disableUNCAccessRestrictions
132+
disableUNCAccessRestrictions,
133+
isUNCAccessRestrictionsDisabled
125134
};
126135
}
127136

src/vs/platform/utilityProcess/electron-main/utilityProcess.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifec
1717
import { removeDangerousEnvVariables } from 'vs/base/common/processes';
1818
import { deepClone } from 'vs/base/common/objects';
1919
import { isWindows } from 'vs/base/common/platform';
20-
import { getUNCHostAllowlist } from 'vs/base/node/unc';
20+
import { isUNCAccessRestrictionsDisabled, getUNCHostAllowlist } from 'vs/base/node/unc';
2121

2222
export interface IUtilityProcessConfiguration {
2323

@@ -259,7 +259,11 @@ export class UtilityProcess extends Disposable {
259259
}
260260
env['VSCODE_CRASH_REPORTER_PROCESS_TYPE'] = configuration.type;
261261
if (isWindows) {
262-
env['NODE_UNC_HOST_ALLOWLIST'] = getUNCHostAllowlist().join('\\');
262+
if (isUNCAccessRestrictionsDisabled()) {
263+
env['NODE_DISABLE_UNC_ACCESS_CHECKS'] = '1';
264+
} else {
265+
env['NODE_UNC_HOST_ALLOWLIST'] = getUNCHostAllowlist().join('\\');
266+
}
263267
}
264268

265269
// Remove any environment variables that are not allowed

0 commit comments

Comments
 (0)