Skip to content

Commit 3d29b66

Browse files
test
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
1 parent eb119c3 commit 3d29b66

4 files changed

Lines changed: 8 additions & 72 deletions

File tree

code/src/vs/platform/extensionManagement/common/allowedExtensionsService.ts

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,6 @@ export class AllowedExtensionsService extends Disposable implements IAllowedExte
3131

3232
private readonly publisherOrgs: string[];
3333

34-
private _defaultExtensionsEnv: string | undefined;
35-
36-
/**
37-
* Set the DEFAULT_EXTENSIONS value from environment service.
38-
* This can be called from the workbench layer to inject the value.
39-
*/
40-
setDefaultExtensionsEnv(value: string | undefined): void {
41-
this._defaultExtensionsEnv = value;
42-
}
43-
4434
private _allowedExtensionsConfigValue: AllowedExtensionsConfigValueType | undefined;
4535
get allowedExtensionsConfigValue(): AllowedExtensionsConfigValueType | undefined {
4636
return this._allowedExtensionsConfigValue;
@@ -75,55 +65,7 @@ export class AllowedExtensionsService extends Disposable implements IAllowedExte
7565
return Object.fromEntries(entries);
7666
}
7767

78-
private getDefaultExtensionsEnv(): string | undefined {
79-
// First check if it was set via setter (workbench context)
80-
if (this._defaultExtensionsEnv !== undefined) {
81-
console.log('!!!!!!!! AllowedExtensionsService.getDefaultExtensionsEnv - from setter:', this._defaultExtensionsEnv);
82-
return this._defaultExtensionsEnv;
83-
}
84-
85-
// Try process.env (server/Node.js context)
86-
if (typeof process !== 'undefined' && process.env) {
87-
const envValue = process.env['DEFAULT_EXTENSIONS'];
88-
console.log('!!!!!!!! AllowedExtensionsService.getDefaultExtensionsEnv - from process.env:', envValue);
89-
console.log('!!!!!!!! AllowedExtensionsService.getDefaultExtensionsEnv - typeof process:', typeof process);
90-
console.log('!!!!!!!! AllowedExtensionsService.getDefaultExtensionsEnv - process.env exists:', !!process.env);
91-
if (envValue) {
92-
return envValue;
93-
}
94-
} else {
95-
console.log('!!!!!!!! AllowedExtensionsService.getDefaultExtensionsEnv - process not available');
96-
}
97-
98-
return undefined;
99-
}
100-
10168
isAllowed(extension: IGalleryExtension | IExtension | { id: string; publisherDisplayName: string | undefined; version?: string; prerelease?: boolean; targetPlatform?: TargetPlatform }): true | IMarkdownString {
102-
// First check DEFAULT_EXTENSIONS environment variable (if set)
103-
// This allows server-side configuration via environment variable.
104-
// If an extension is in DEFAULT_EXTENSIONS, it's automatically allowed.
105-
const defaultExtensionsEnv = this.getDefaultExtensionsEnv();
106-
console.log('!!!!!!!!!!!! isAllowed ', defaultExtensionsEnv);
107-
108-
if (defaultExtensionsEnv) {
109-
const defaultExtensions = defaultExtensionsEnv.split(';').filter(value => value.trim());
110-
let extensionId: string;
111-
112-
if (isGalleryExtension(extension)) {
113-
extensionId = extension.identifier.id.toLowerCase();
114-
} else if (isIExtension(extension)) {
115-
extensionId = extension.identifier.id.toLowerCase();
116-
} else {
117-
extensionId = extension.id.toLowerCase();
118-
}
119-
120-
// If extension is in DEFAULT_EXTENSIONS, allow it (bypass other checks)
121-
if (defaultExtensions.some(ext => ext.trim().toLowerCase() === extensionId)) {
122-
return true;
123-
}
124-
// If DEFAULT_EXTENSIONS is set but extension is not in it, continue with normal config check
125-
}
126-
12769
// Then check configuration/policy-based allowed extensions
12870
if (!this._allowedExtensionsConfigValue) {
12971
return true;

code/src/vs/platform/extensionManagement/node/extensionManagementService.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,8 @@ export class ExtensionManagementService extends AbstractExtensionManagementServi
101101

102102
// Check if DEFAULT_EXTENSIONS environment variable is accessible
103103
const defaultExtensionsEnv = typeof process !== 'undefined' && process.env ? process.env['DEFAULT_EXTENSIONS'] : undefined;
104-
logService.info('!!!!!!!! ExtensionManagementService constructor - typeof process:', typeof process);
105-
logService.info('!!!!!!!! ExtensionManagementService constructor - process.env exists:', typeof process !== 'undefined' && !!process.env);
106104
logService.info('!!!!!!!! ExtensionManagementService constructor - DEFAULT_EXTENSIONS value:', defaultExtensionsEnv);
107-
if (typeof process !== 'undefined' && process.env) {
108-
logService.info('!!!!!!!! ExtensionManagementService constructor - process.env keys sample:', Object.keys(process.env).slice(0, 10).join(', '));
109-
}
105+
console.log('!!!!!!!! ExtensionManagementService constructor - DEFAULT_EXTENSIONS value:', defaultExtensionsEnv);
110106
const extensionLifecycle = this._register(instantiationService.createInstance(ExtensionsLifecycle));
111107
this.extensionsScanner = this._register(instantiationService.createInstance(ExtensionsScanner, extension => extensionLifecycle.postUninstall(extension)));
112108
this.manifestCache = this._register(new ExtensionsManifestCache(userDataProfilesService, fileService, uriIdentityService, this, this.logService));

code/src/vs/server/node/che/defaultExtensionsInstaller.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,21 @@ export class DefaultExtensionsInstaller extends Disposable {
3535
private async initialize(): Promise<void> {
3636
const defaultExtensionsEnv = typeof process !== 'undefined' && process.env ? process.env['DEFAULT_EXTENSIONS'] : undefined;
3737
if (!defaultExtensionsEnv) {
38-
this.logService.debug('DefaultExtensionsInstaller: DEFAULT_EXTENSIONS not set, skipping installation');
38+
this.logService.info('DefaultExtensionsInstaller: DEFAULT_EXTENSIONS not set, skipping installation');
3939
return;
4040
}
4141

4242
const extensionPaths = defaultExtensionsEnv.split(';').filter(p => p.trim());
4343
if (extensionPaths.length === 0) {
44-
this.logService.debug('DefaultExtensionsInstaller: No extensions to install');
44+
this.logService.info('DefaultExtensionsInstaller: No extensions to install');
4545
return;
4646
}
4747

48-
this.logService.info(`DefaultExtensionsInstaller: Found ${extensionPaths.length} default extension(s) in DEFAULT_EXTENSIONS`);
48+
this.logService.info(`!!!!!!!! DefaultExtensionsInstaller: Found ${extensionPaths.length} default extension(s) in DEFAULT_EXTENSIONS`);
4949

5050
// Track installed extensions in a file to avoid reinstalling
5151
const storageFile = this.getStorageFile();
52+
this.logService.info(`!!!!!!!! DefaultExtensionsInstaller: storageFile ${storageFile}`);
5253
let installedPaths: string[] = [];
5354
try {
5455
const content = await this.fileService.readFile(storageFile);
@@ -86,7 +87,6 @@ export class DefaultExtensionsInstaller extends Disposable {
8687
this.logService.info(`DefaultExtensionsInstaller: Installing extension from ${trimmedPath}`);
8788

8889
await this.extensionManagementService.install(vsixUri, {
89-
donotIncludePackAndDependencies: true,
9090
isDefault: true // Mark as default extension to bypass policy checks
9191
});
9292
successfullyInstalled.push(trimmedPath);

code/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,9 +2407,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
24072407
}
24082408

24092409
if (extension.gallery) {
2410-
console.log('+++++++ extension.gallery ');
2411-
console.log('+++ ', extension.gallery);
2412-
console.log('+++ ', extension.displayName);
2410+
console.log('++++++++++++ extension.gallery ', extension.gallery.identifier.id);
24132411
// Check if extension is allowed first (before checking platform compatibility or signing)
24142412
const allowedResult = this.allowedExtensionsService.isAllowed({ id: extension.gallery.identifier.id, publisherDisplayName: extension.gallery.publisherDisplayName });
24152413
if (allowedResult !== true) {
@@ -2595,12 +2593,12 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
25952593
}
25962594
}
25972595
if (installable instanceof URI) {
2598-
this.logService.info('!!!!!!!!! installable instanceof URI = CMD', installable);
2596+
this.logService.info('!!!!!!!!!!!!!!!!! installable instanceof URI = CMD', installable.path);
25992597
// Block VSIX installations if the policy is configured and blockNonGalleryExtensions is enabled
26002598
const blockNonGallery = this.configurationService.getValue<boolean>(BlockNonGalleryExtensionsConfigKey);
26012599
const hasPolicy = this.configurationService.inspect(AllowedExtensionsConfigKey).policy !== undefined;
26022600
if (hasPolicy && blockNonGallery) {
2603-
this.logService.error('!!! installable instanceof URI !!! BLOCK ');
2601+
this.logService.error('!!! installable instanceof URI !!! BLOCK ', installable.path);
26042602
throw new Error(nls.localize('vsix not allowed', "VSIX files cannot be installed because only extensions from the gallery are allowed. Please install this extension from the Extensions marketplace."));
26052603
}
26062604
this.logService.error('!!! installable instanceof URI !!!NOT BLOCK ');

0 commit comments

Comments
 (0)