Repository navigation
Private Marketplace extension blocking: add gallery and install enforcement - #333859
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Installed extension models can retain stale blocking metadata and bypass the new UI and chat safeguards.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (4)
| Severity | Finding |
|---|---|
src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts — blockingInfo can remain stale for installed extensions. queryGallery/getExtensions return an… |
|
src/vs/platform/extensionManagement/common/abstractExtensionManagementService.ts — This multi-line comment restates the branch and error construction. A short note captures the… |
|
src/vs/platform/extensionManagement/common/extensionGalleryService.ts — This long JSDoc duplicates implementation details and caller behavior, so it is likely to drift as… |
|
src/vs/platform/extensionManagement/common/extensionGalleryService.ts — This multi-line inline comment narrates the surrounding selection logic and includes a fallback… |
What changed in this PR
Adds client support for marketplace extension-blocking metadata and enforces it across installation, updates, UI, and chat search.
Changes:
- Parses extension- and version-level blocking metadata.
- Prevents blocked extension acquisition and surfaces origin-specific messages.
- Adds contract parsing and message tests.
| File | Description |
|---|---|
searchExtensionsTool.ts |
Excludes blocked extensions from chat results. |
extensions.ts |
Exposes blocking metadata in the workbench model. |
extensionsWorkbenchService.ts |
Applies blocking to updates and installation. |
extensionsActions.ts |
Disables actions and displays blocked status. |
extensionManagement.test.ts |
Tests origin-specific messages. |
extensionGalleryService.test.ts |
Tests blocking contract parsing. |
extensionManagementUtil.ts |
Builds localized blocking messages. |
extensionManagement.ts |
Defines public blocking types. |
extensionGalleryService.ts |
Parses blocking data and filters versions. |
abstractExtensionManagementService.ts |
Enforces blocks and preserves failure reasons. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
2020982 to
b980ceb
Compare
b980ceb to
65fb414
Compare
roblourens
left a comment
There was a problem hiding this comment.
[Experimental performance review bot]
Automated experimental performance review.
(Written by Copilot)
Karthik Nadig (karthiknadig)
left a comment
There was a problem hiding this comment.
Thanks for putting this together. The parsing rules and the fail-safe handling of malformed payloads are well thought out.
Please split this into two PRs:
- Parsing + install gating (platform layer):
getBlockingInfoand the raw types, version selection inisValidVersion,canInstall/checkAndGetCompatibleVersion, and auto-update gating, with tests that use a stubbed gallery response. - UI, stacked on top:
ExtensionStatusAction, theextensionDisallowInstallcontext key, the auto-update toggle,searchExtensionsTool, and the installed-extension refresh inextensionsWorkbenchService.
That lets us settle install behavior while the spec is still in review, and keeps the UI discussion focused on what we show for extensions that are already installed, which isn't designed yet.
Main issues (details inline):
- Throwing
canInstall.valueturns the existing allow-list and platform-incompatible errors into raw markdown in the dialog and CLI. - A missing or unknown
originfalls back to the most alarming message. - Installed extensions are told they "must not be used" but stay enabled.
- Version-level blocks still show up as "not found" / "not compatible" on install.
- Not gated on a gallery capability while the contract is in review.
- Tests don't exercise the behavior changes.
Review assisted by Copilot.
|
Thanks for the detailed review. For additional context, the Extension Blocking specification has been approved by the VS Marketplace team, although its metadata had not yet been updated. Private Marketplace is also already emitting the I reduced this PR to the platform portion: contract parsing, version selection, install gating, error handling, and behavioral tests. Installed-extension propagation, auto-update behavior, context keys, status and toggle UI, and chat filtering have been removed for separate work, where the installed-extension remediation and wording can be reviewed independently. The revision also restores the existing allow-list/platform error behavior, uses 🤖 This reply was authored by GitHub Copilot CLI on behalf of Michael Cummings (MSFT) (@mcumming). |
The marketplace previously omitted extensions it would not serve, so a user searching for one saw an empty result and no reason for it. It now returns the record carrying a `blocked` flag instead, and this reads that flag and explains the block rather than letting the extension disappear. The flag comes at two granularities -- a whole extension, or a single version while the others remain available -- and both are read. A blocked version is skipped when selecting one to acquire, so selection falls through to a permitted version, in display paths as well as install paths: a version pinned out by policy is usually the newest, and showing it would strand an extension whose earlier versions are perfectly usable. The two granularities are not distinguished in the result, because a block only reaches a user once no version is permitted, and at that point the extension is unavailable to them whichever granularity produced it. Blocked extensions are still returned by the gallery, so enforcement lives at the decision points -- canInstall, auto-update, and the extensionDisallowInstall context key -- rather than by filtering them out of results. The block takes precedence over deprecation, and the message distinguishes an organization policy decision from a marketplace statement, since conflating the two either alarms users about a routine policy decision or understates a marketplace finding. Report the reason canInstall determined when refusing an install, rather than discarding it for a fixed platform-incompatibility message. That message was already wrong for an allow list denial, and adding a second cause to the same path would have made a blocked extension claim it was unavailable for the machine's platform, sending the user to look for one that could run it. The paths reaching this are the ones with no other signal: settings sync, the command line, and the URI handler. Only the flag and the origin are read. The contract also defines a reason, none of whose values the registry populates today: allow-list denials are the only blocks issued, and they carry origin policy. Origin is kept rather than collapsed to a boolean because attributing a marketplace block to the user's own organization would be misleading. Absent, unrecognized, and wrong-typed values degrade to the marketplace wording rather than failing the parse, which would have taken down the whole query rather than the one extension. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 2c07f98f-e549-41c2-af5b-7f197c533c8c
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 2c07f98f-e549-41c2-af5b-7f197c533c8c
Exclude a blocked latest version from the display-query fallback so the existing all-versions retry can select an older permitted release. Cover the latest-only response shape and retry sequence. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 47b6e35c-f0a9-4b72-9c0e-ea4531326362
f94a1e3 to
f99f285
Compare
Run the display-query fallback regression against the universal target so the synthetic versions are valid in both desktop and web test environments. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 2c07f98f-e549-41c2-af5b-7f197c533c8c
Select the first unblocked fallback version and allow callers to opt into retrieving blocking metadata for an exact blocked version. Cover pre-release fallback and exact-version metadata behavior. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 2c07f98f-e549-41c2-af5b-7f197c533c8c
|
Karthik Nadig (@karthiknadig) this is ready for your review |
Karthik Nadig (karthiknadig)
left a comment
There was a problem hiding this comment.
Thanks for splitting this and working through the feedback. The plain-text error messages, the NotAllowed handling and the new behavioral tests look good. The contract-based reasoning for the origin fallback and for skipping a capability gate makes sense to me.
A few non-blocking nits inline. They can be handled in #341049, which is stacked on this branch.
Review assisted by Copilot.
|
The branch has been rebased and the refreshed cross-platform CI is green, including Linux, macOS, and Windows Browser coverage. The follow-up fixes now:
The focused Browser and Electron gallery suites, targeted ESLint, and client type-check also pass locally. There are no unresolved review threads. The only remaining pending status is the shared external VS Code PR Check. Karthik Nadig (@karthiknadig), could you please re-review when convenient? I do not have permission to formally re-request your review on this upstream PR. 🤖 This reply was authored by GitHub Copilot CLI on behalf of Michael Cummings (MSFT) (@mcumming). |
9ebdca5
into
microsoft:main


The Private Marketplace evaluates an administrative allow/deny policy on extension queries. Previously, a denial reached the client only as an absence: the extension was missing from results or installation failed without explaining the policy decision.
Private Marketplace now emits the approved Extension Blocking wire contract: an extension- or version-level
blockedflag with ablockingobject. This PR implements the platform portion of that contract in VS Code.What it does
service, as required by the approved contract.This PR is intentionally limited to gallery parsing and platform install enforcement. Installed-extension propagation, auto-update behavior, context keys, status UI, toggle UI, and chat-search filtering remain in #341049 because remediation and wording for an extension that is already installed require their own workbench behavior.
Version-level behavior
Version-level blocks do not imply that the whole extension is blocked. Selection skips a blocked version and uses the first older permitted version when one exists, including the existing pre-release fallback path.
By default, an explicitly requested blocked version returns no matching version. An internal opt-in query can retrieve that exact version's blocking metadata so the workbench can preserve the state of an already-installed blocked version; this does not change normal acquisition selection. If every version is blocked in a compatible query, no compatible extension is returned. This PR does not add a blocking-specific result state to the gallery selection API.
Install errors
Whole-extension blocks that reach the install service fail with the origin-specific blocking message and
ExtensionManagementErrorCode.NotAllowed.Existing allow-list and platform-incompatibility behavior is preserved. Their Markdown-capable
canInstallresults are not passed into plain-text CLI and dialog consumers.NotAllowedis handled by the existing informational install-failure dialog and by Settings Sync's skip-and-do-not-retry path.Capability negotiation
The approved contract does not define a gallery-manifest capability, and Private Marketplace is already emitting the metadata. The client therefore reads the additive fields directly rather than requiring a VS Code-specific capability that the deployed producer does not advertise.
Testing
Tests cover:
canInstallbehavior.NotAllowederror.canInstallfailures.The gallery tests use deterministic stubbed responses matching data already emitted by Private Marketplace.
🤖 This pull request description was authored by GitHub Copilot CLI on behalf of Michael Cummings (MSFT) (@mcumming).