Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UNC allow list checks cannot be disabled in extension host (fix #184989) #185085

Merged
merged 2 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/vs/base/node/unc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ export function addUNCHostToAllowlist(allowedHost: string | string[]): void;
* path validation.
*/
export function disableUNCAccessRestrictions(): void;

/**
* Whether UNC Host allow list in node.js is disabled.
*/
export function isUNCAccessRestrictionsDisabled(): boolean;
11 changes: 10 additions & 1 deletion src/vs/base/node/unc.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,20 @@
process.enableUNCAccessChecks = false;
}

function isUNCAccessRestrictionsDisabled() {
if (process.platform !== 'win32') {
return true;
}

return process.enableUNCAccessChecks === false;
}

return {
getUNCHostAllowlist,
addUNCHostToAllowlist,
getUNCHost,
disableUNCAccessRestrictions
disableUNCAccessRestrictions,
isUNCAccessRestrictionsDisabled
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifec
import { removeDangerousEnvVariables } from 'vs/base/common/processes';
import { deepClone } from 'vs/base/common/objects';
import { isWindows } from 'vs/base/common/platform';
import { getUNCHostAllowlist } from 'vs/base/node/unc';
import { isUNCAccessRestrictionsDisabled, getUNCHostAllowlist } from 'vs/base/node/unc';

export interface IUtilityProcessConfiguration {

Expand Down Expand Up @@ -259,7 +259,11 @@ export class UtilityProcess extends Disposable {
}
env['VSCODE_CRASH_REPORTER_PROCESS_TYPE'] = configuration.type;
if (isWindows) {
env['NODE_UNC_HOST_ALLOWLIST'] = getUNCHostAllowlist().join('\\');
if (isUNCAccessRestrictionsDisabled()) {
env['NODE_DISABLE_UNC_ACCESS_CHECKS'] = '1';
} else {
env['NODE_UNC_HOST_ALLOWLIST'] = getUNCHostAllowlist().join('\\');
}
}

// Remove any environment variables that are not allowed
Expand Down
Loading