Skip to content

Commit

Permalink
UNC allow list checks cannot be disabled in extension host (fix #184989
Browse files Browse the repository at this point in the history
…) (#185085)

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

* Update src/vs/base/node/unc.js

Co-authored-by: Robo <hop2deep@gmail.com>

---------

Co-authored-by: Robo <hop2deep@gmail.com>
  • Loading branch information
bpasero and deepak1556 committed Jun 14, 2023
1 parent 4f95907 commit 695af09
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
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,

This comment has been minimized.

Copy link
@Grumpy2869

Grumpy2869 Jul 2, 2023

true

addUNCHostToAllowlist,
getUNCHost,
disableUNCAccessRestrictions

This comment has been minimized.

Copy link
@Grumpy2869

Grumpy2869 Jul 2, 2023

This comment has been minimized.

Copy link
@sopendata7-lab

sopendata7-lab Jul 3, 2023

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

1 comment on commit 695af09

@Grumpy2869
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#186837

hope this works

Please sign in to comment.