trustedDomains.ts ×4

Frontier kind: Code frontier

unlabeled · c_7514f573b2c5

45 tests · 3454 LOC · 20 files · introduces 0 tests · 33 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
4 ranges33 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
489 ranges3454 lines · 20 files · Browse complete extent
All tests (intent)
45 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: 33 introduced LOC across 4 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/url/common/trustedDomains.ts 33 introduced LOC · 4 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- trustedDomains.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 { URI } from '../../../base/common/uri.js';
7 > import { testUrlMatchesGlob } from './urlGlob.js';
8 >
9 > /**
10 > * Check whether a domain like https://www.microsoft.com matches
11 > * the list of trusted domains.
12 > *
13 > * - Schemes must match
14 > * - There's no subdomain matching. For example https://microsoft.com doesn't match https://www.microsoft.com
15 > * - Star matches all subdomains. For example https://*.microsoft.com matches https://www.microsoft.com and https://foo.bar.microsoft.com
16 > */
17 > export function isURLDomainTrusted(url: URI, trustedDomains: string[]): boolean {
18 url = URI.parse(normalizeURL(url));
19 trustedDomains = trustedDomains.map(normalizeURL);
35 return false;
36 }
38 > /**
39 > * Case-normalize some case-insensitive URLs, such as github.
40 > */
41 > export function normalizeURL(url: string | URI): string {
42 const caseInsensitiveAuthorities = ['github.com'];
43 try {
50 } catch { return url.toString(); }
51 }
53 > const rLocalhost = /^(.+\.)?localhost(:\d+)?$/i;
54 > const r127 = /^127\.0\.0\.1(:\d+)?$/;
55 > const rIPv6Localhost = /^(\[::1\]|\[0:0:0:0:0:0:0:1\])(:\d+)?$/;
56 >
57 > export function isLocalhostAuthority(authority: string) {
58 return rLocalhost.test(authority) || r127.test(authority) || rIPv6Localhost.test(authority);
59 }
61 > const r0000 = /^0\.0\.0\.0(:\d+)?$/;
62 > const rIPv6AllInterfaces = /^(\[::\]|\[0:0:0:0:0:0:0:0\])(:\d+)?$/;
63 >
64 > export function isAllInterfacesAuthority(authority: string) {
65 return r0000.test(authority) || rIPv6AllInterfaces.test(authority);
66 }