workspaceTrust.ts ×12

Frontier kind: Code frontier

unlabeled · c_c5576b050cb6

4 tests · 25501 LOC · 136 files · introduces 0 tests · 36 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges36 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
3263 ranges25501 lines · 136 files · Browse complete extent
All tests (intent)
4 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: 36 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/services/workspaces/common/workspaceTrust.ts 36 introduced LOC · 12 ranges

Open complete file

202
203 private async getCanonicalUri(uri: URI): Promise<URI> {
204 > let canonicalUri = uri; workspaceTrust.ts
205 > if (this.environmentService.remoteAuthority && uri.scheme === Schemas.vscodeRemote) {
206 canonicalUri = await this.remoteAuthorityResolverService.getCanonicalURI(uri);
207 > } else if (uri.scheme === 'vscode-vfs') { workspaceTrust.ts
208 const index = uri.authority.indexOf('+');
209 if (index !== -1) {
211 }
212 }
214 > // ignore query and fragent section of uris always
215 > return canonicalUri.with({ query: null, fragment: null });
216 > }
217
218 private async resolveCanonicalUris(): Promise<void> {
365
366 private doGetUriTrustInfo(uri: URI): IWorkspaceTrustUriInfo {
367 > // Return trusted when workspace trust is disabled workspaceTrust.ts
368 > if (!this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()) {
369 return { trusted: true, uri };
370 }
372 > // Agent sessions workspace file is always trusted
373 > if (this.uriIdentityService.extUri.isEqual(uri, this.environmentService.agentSessionsWorkspace)) {
374 return { trusted: true, uri };
375 }
377 > if (this.isTrustedVirtualResource(uri)) {
378 return { trusted: true, uri };
379 }
381 > if (this.isTrustedByRemote(uri)) {
382 return { trusted: true, uri };
383 }
385 > let resultState = false;
386 > let maxLength = -1;
387 >
388 > let resultUri = uri;
389 >
390 > for (const trustInfo of this._trustStateInfo.uriTrustInfo) {
391 if (this.uriIdentityService.extUri.isEqualOrParent(uri, trustInfo.uri)) {
392 const fsPath = trustInfo.uri.fsPath;
398 }
399 }
401 > return { trusted: resultState, uri: resultUri };
402 > }
403
404 private async doSetUrisTrust(uris: URI[], trusted: boolean): Promise<void> {
448
449 private isTrustedVirtualResource(uri: URI): boolean {
450 > // `vscode-vfs` (e.g. GitHub Repositories) and `vscode-agent-host` workspaceTrust.ts
451 > // (remote agent host folders) represent real, writable resources where
452 > // code can run or files can change, so they must go through normal
453 > // workspace trust rather than being auto-trusted as virtual resources.
454 > return isVirtualResource(uri) && uri.scheme !== 'vscode-vfs' && uri.scheme !== AGENT_HOST_SCHEME;
455 > }
456
457 private isTrustedByRemote(uri: URI): boolean {
458 > if (!this.environmentService.remoteAuthority) { workspaceTrust.ts
459 > return false;
460 > }
461
462 if (!this._remoteAuthority) {
465
466 return (isEqualAuthority(getRemoteAuthority(uri), this._remoteAuthority.authority.authority)) && !!this._remoteAuthority.options?.isTrusted;
468
469 private set isTrusted(value: boolean) {