Skip to content

Update strictKnownMarketplaces managed setting to support rich types#322025

Merged
vijayupadya merged 7 commits into
mainfrom
vijayu/mp-managedSettings
Jun 19, 2026
Merged

Update strictKnownMarketplaces managed setting to support rich types#322025
vijayupadya merged 7 commits into
mainfrom
vijayu/mp-managedSettings

Conversation

@vijayupadya

@vijayupadya vijayupadya commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Fixes https://github.com/microsoft/vscode-internalbacklog/issues/8059

Update strictKnownMarketplaces managed setting that restricts which marketplace sources users can add and install plugins from.
This only blocks installation, and does not retroactively prevent loading plugins that are already installed.

Behavior enabled:

  • Restricts which marketplace sources users can add/install plugins from
  • Blocks direct plugin installation from non-approved sources
  • Only blocks installation — does not retroactively unload already-installed plugins
  • Shows UX when install is blocked by policy

Copilot AI review requested due to automatic review settings June 19, 2026 00:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR evolves the strictKnownMarketplaces enterprise-managed setting from a boolean flag into a rich, JSON-encoded allowlist (array of typed source descriptors), updates the policy/configuration plumbing to support union-typed settings (e.g. ['array','null']), and shifts strict-marketplace enforcement to install-time trust/installation flows.

Changes:

  • Teach PolicyConfiguration to handle union-typed configuration schemas and to parse JSON policy strings unless the setting accepts strings.
  • Adapt /copilot_internal/managed_settings response to emit strictKnownMarketplaces as a canonical JSON string in the managed-settings bag.
  • Add strict marketplace allowlist matching and wire it into marketplace trust + install flows; add unit tests for parsing/matching.
Show a summary per file
File Description
src/vs/workbench/services/policies/test/browser/multiplexPolicyService.test.ts Adds coverage for union-typed (array | null) policy registration + JSON-string parsing.
src/vs/workbench/services/accounts/test/browser/managedSettings.test.ts Updates tests to expect strictKnownMarketplaces carried as a JSON string (including lockdown []).
src/vs/workbench/services/accounts/browser/managedSettings.ts Emits strictKnownMarketplaces into the managed-settings bag as a JSON string when present.
src/vs/workbench/contrib/chat/test/common/plugins/strictKnownMarketplaces.test.ts New tests for coercion + allowlist matching behaviors across source types.
src/vs/workbench/contrib/chat/test/browser/plugins/pluginInstallService.test.ts Updates the marketplace-service stub to include strict-policy state.
src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.ts New allowlist parsing/matching helpers for strict marketplace policy.
src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.ts Changes trust semantics under strict policy + adds isStrictMarketplacePolicyActive().
src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.ts Removes strict-marketplace load-time gating (install-time only).
src/vs/workbench/contrib/chat/browser/pluginInstallService.ts Blocks “trust marketplace” prompts under strict policy and surfaces an enterprise-policy notification.
src/vs/workbench/contrib/chat/browser/chat.shared.contribution.ts Updates chat.plugins.strictMarketplaces schema to array | null and switches managed-settings type to string.
src/vs/platform/policy/common/copilotManagedSettings.ts Documents strictKnownMarketplaces as a JSON-encoded allowlist key.
src/vs/platform/configuration/common/configurations.ts Adds union-type normalization and improved JSON parsing rules for policy-backed settings.
src/vs/base/common/managedSettings.ts Introduces IStrictMarketplaceSource as the shared allowlist entry type.

Copilot's findings

  • Files reviewed: 13/13 changed files
  • Comments generated: 4

Comment thread src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.ts Outdated
Comment thread src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.ts Outdated
Comment thread src/vs/workbench/contrib/chat/browser/chat.shared.contribution.ts Outdated
@vijayupadya vijayupadya marked this pull request as ready for review June 19, 2026 05:26
@vijayupadya

Copy link
Copy Markdown
Contributor Author

cc @joshspicer

Comment on lines +430 to +441
if (this._pluginMarketplaceService.isStrictMarketplacePolicyActive()) {
this._notificationService.notify({
severity: Severity.Warning,
message: localize('strictMarketplaceBlockedInstall', "Plugins from '{0}' are blocked by your organization's policy.", plugin.marketplaceReference.displayLabel),
actions: {
primary: [new Action('chat.plugins.viewMarketplacePolicy', localize('viewPolicySettings', "View Policy Settings"), undefined, true, () => {
return this._commandService.executeCommand('workbench.action.openSettings', ChatConfiguration.StrictMarketplaces);
})],
},
});
return false;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would this prevent the user from ever being able to trust a marketplace for the first time when the policy is active?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good question - Allowlisted marketplaces aren't affected — when the strict policy is active, isMarketplaceTrusted() is governed by the allowlist (it ignores the user-trust store), so a marketplace on the org allowlist returns true from the earlier check and installs without any prompt. This branch is only reached for marketplaces not on the allowlist, where blocking (rather than offering a trust dialog) is by design — under strict mode the user must not be able to self-grant trust to bypass the enterprise allowlist.

@vijayupadya vijayupadya merged commit f736b7d into main Jun 19, 2026
25 checks passed
@vijayupadya vijayupadya deleted the vijayu/mp-managedSettings branch June 19, 2026 14:52
@vs-code-engineering vs-code-engineering Bot added this to the 1.126.0 milestone Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants