strictKnownMarketplaces.ts ×6

Frontier kind: Code frontier

unlabeled · c_57b4c224f4fd

190 tests · 22099 LOC · 121 files · introduces 0 tests · 49 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges49 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2463 ranges22099 lines · 121 files · Browse complete extent
All tests (intent)
190 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 49 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.ts 49 introduced LOC · 6 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- strictKnownMarketplaces.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { IStrictMarketplaceSource } from '../../../../../base/common/managedSettings.js';
7 > import { isEqual } from '../../../../../base/common/resources.js';
8 > import { URI } from '../../../../../base/common/uri.js';
9 > import { IMarketplaceReference, MarketplaceReferenceKind, parseMarketplaceReference } from './marketplaceReference.js';
10 >
11 > /**
12 > * The allowlist entry type for `chat.plugins.strictMarketplaces`. Re-exported
13 > * from `base/common` so chat plugin code can import it alongside the matcher it
14 > * operates with; the same type is consumed by the managed-settings adapter.
15 > */
16 > export type { IStrictMarketplaceSource };
17 >
18 > /**
19 > * The value of the `chat.plugins.strictMarketplaces` allowlist.
20 > * - `undefined`: no restrictions — all marketplaces are allowed.
21 > * - `[]`: complete lockdown — no marketplace is allowed.
22 > * - non-empty array: only marketplaces matching an entry are allowed.
23 > */
24 > export type StrictKnownMarketplaces = readonly IStrictMarketplaceSource[];
25 >
26 > /**
27 > * Coerces a resolved configuration value into a {@link StrictKnownMarketplaces}
28 > * allowlist. Returns `undefined` (meaning "no restrictions") when the value is
29 > * not an array — which is also how an unset policy surfaces (the registered
30 > * `null` default). Malformed entries (non-objects or entries without a string
31 > * `source`) are dropped so a bad managed-settings payload degrades to "no match"
32 > * rather than throwing during matching.
33 > */
34 > export function getStrictKnownMarketplaces(value: unknown): StrictKnownMarketplaces | undefined {
35 if (!Array.isArray(value)) {
36 return undefined;
39 typeof entry === 'object' && entry !== null && typeof entry.source === 'string');
40 }
42 > /**
43 > * Checks whether a marketplace reference is allowed by the strict allowlist.
44 > *
45 > * @param allowlist `undefined` allows everything, `[]` blocks everything,
46 > * otherwise the reference must match at least one entry.
47 > */
48 > export function isMarketplaceReferenceAllowed(allowlist: StrictKnownMarketplaces | undefined, ref: IMarketplaceReference): boolean {
49 if (allowlist === undefined) {
50 return true;
55 return allowlist.some(entry => matchesAllowlistEntry(entry, ref));
56 }
58 function matchesAllowlistEntry(entry: IStrictMarketplaceSource, ref: IMarketplaceReference): boolean {
59 switch (entry.source) {
111 }
112 }
114 > /** Appends (or replaces) a `#ref` fragment on a marketplace value. */
115 function appendRef(value: string, ref: string | undefined): string {
116 if (!ref) {
121 return `${base}#${ref}`;
122 }
124 > /** Extracts the host of a marketplace reference for `hostPattern` matching. */
125 function extractHost(ref: IMarketplaceReference): string | undefined {
126 if (ref.kind === MarketplaceReferenceKind.GitHubShorthand) {
150 }
151 }
153 > /** Tests a regex pattern against a value, treating invalid patterns as non-matching. */
154 function testPattern(pattern: string, value: string): boolean {
155 try {