managedSettings.ts ×2

Frontier kind: Code frontier

unlabeled · c_32ff1eaaa880

766 tests · 4445 LOC · 23 files · introduces 0 tests · 48 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
2 ranges48 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
599 ranges4445 lines · 23 files · Browse complete extent
All tests (intent)
766 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: 48 introduced LOC across 2 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/base/common/managedSettings.ts 48 introduced LOC · 2 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- managedSettings.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 > /**
7 > * A single enterprise-managed marketplace entry, preserving the marketplace
8 > * name (used as `displayLabel`) and the original `source` discriminator.
9 > */
10 > export type IExtraKnownMarketplaceEntry =
11 > | { readonly name: string; readonly source: { readonly source: 'github'; readonly repo: string; readonly ref?: string } }
12 > | { readonly name: string; readonly source: { readonly source: 'git'; readonly url: string; readonly ref?: string } };
13 >
14 > /**
15 > * A single entry in the enterprise-managed `strictKnownMarketplaces` allowlist
16 > * (the `chat.plugins.strictMarketplaces` setting), a discriminated union on
17 > * `source`. Delivered as JSON via managed settings (the server endpoint or
18 > * native MDM) and validated at match time, so the optional fields are only
19 > * meaningful for their corresponding `source`.
20 > */
21 > export interface IStrictMarketplaceSource {
22 > readonly source: 'github' | 'git' | 'url' | 'npm' | 'file' | 'directory' | 'hostPattern' | 'pathPattern';
23 > readonly repo?: string;
24 > readonly url?: string;
25 > readonly ref?: string;
26 > readonly path?: string;
27 > readonly package?: string;
28 > readonly hostPattern?: string;
29 > readonly pathPattern?: string;
30 > readonly headers?: Readonly<Record<string, string>>;
31 > }
32 >
33 > /**
34 > * Converts an {@link IExtraKnownMarketplaceEntry} array into the
35 > * `{ [name]: url-or-shorthand }` dict stored on the `chat.plugins.extraMarketplaces`
36 > * setting (and carried as the canonical JSON value of the `extraKnownMarketplaces`
37 > * managed setting across both the server endpoint and native MDM delivery).
38 > *
39 > * Plain-string entries (allowed by the policy schema but unnamed) are stored with
40 > * the value used as both key and value so they survive the round-trip intact.
41 > *
42 > * Marketplace names come from managed settings (untrusted input) and are written as object keys,
43 > * so `__proto__` / `constructor` / `prototype` keys are skipped to avoid prototype pollution
44 > * (mirroring the guard in the managed-settings normalizer's string-map encoder).
45 > */
46 > export function extraKnownMarketplacesToConfigDict(entries: readonly (string | IExtraKnownMarketplaceEntry)[] | undefined): Record<string, string> | undefined {
47 if (!entries?.length) {
48 return undefined;
66 return obj;
67 }
69 > /** Whether a marketplace name would pollute the prototype chain if used as an object key. */
70 function isUnsafeMarketplaceKey(key: string): boolean {
71 return key === '__proto__' || key === 'constructor' || key === 'prototype';