Skip to content

Use deny list for non-linkable endpoint URLs in extension#15894

Open
adamint wants to merge 1 commit intomicrosoft:mainfrom
adamint:fix/endpoint-url-deny-list-15472
Open

Use deny list for non-linkable endpoint URLs in extension#15894
adamint wants to merge 1 commit intomicrosoft:mainfrom
adamint:fix/endpoint-url-deny-list-15472

Conversation

@adamint
Copy link
Copy Markdown
Member

@adamint adamint commented Apr 4, 2026

Description

Replace the HTTP/HTTPS allow list with a deny list matching the dashboard's KnownUnsupportedUrlSchemes for determining which endpoint URLs are clickable in the VS Code extension tree view and tooltips.

The previous fix (#15514) only made http:// and https:// URLs clickable, but as @JamesNK pointed out, custom schemes like vscode:// should also be clickable since they can hand off to apps registered with the OS. The dashboard uses a deny list approach for this reason.

Changes:

  • Added extension/src/utils/urlSchemes.ts with a deny list of 9 unsupported schemes (gopher, ws, wss, news, nntp, telnet, tcp, redis, rediss) mirroring src/Shared/KnownUnsupportedUrlSchemes.cs
  • Updated EndpointUrlItem constructor to use isLinkableUrl() instead of HTTP-only check
  • Updated buildResourceTooltip to use isLinkableUrl() instead of startsWith('http') check
  • Added unit tests for the isLinkableUrl helper

Fixes #15472

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Replace the HTTP/HTTPS allow list with a deny list matching the
dashboard's KnownUnsupportedUrlSchemes. This allows custom schemes
like vscode:// to remain clickable while blocking known-unsupported
schemes (tcp, redis, telnet, etc.).

Fixes microsoft#15472
Copilot AI review requested due to automatic review settings April 4, 2026 04:49
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15894

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15894"

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the VS Code extension’s logic for determining whether endpoint URLs should be clickable by switching from an HTTP(S) allow-list to a scheme deny-list aligned with the dashboard’s KnownUnsupportedUrlSchemes.

Changes:

  • Added isLinkableUrl() helper with a deny list of unsupported URL schemes.
  • Updated the tree view endpoint items and resource tooltip generation to use isLinkableUrl() instead of HTTP-only checks.
  • Added unit tests covering linkable vs non-linkable schemes.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
extension/src/views/AspireAppHostTreeProvider.ts Uses isLinkableUrl() to decide endpoint clickability and which URLs appear in tooltips.
extension/src/utils/urlSchemes.ts Introduces the deny-list-based isLinkableUrl() helper.
extension/src/test/urlSchemes.test.ts Adds unit tests validating isLinkableUrl() behavior across schemes.
Comments suppressed due to low confidence (1)

extension/src/views/AspireAppHostTreeProvider.ts:109

  • EndpointUrlItem now assigns contextValue = 'endpointUrl' for any scheme that passes isLinkableUrl(), not just HTTP(S). This will also enable the existing context-menu actions (notably openInSimpleBrowser / "Open in VS Code") for custom schemes like vscode:// or ftp://, which may not be intended or supported by the simple browser. Consider splitting the context value (e.g., endpointUrlHttp vs endpointUrlLinkable) so that only HTTP(S) endpoints offer the simple-browser action while other linkable schemes only offer external open/copy.
        const uri = vscode.Uri.parse(url);
        if (isLinkableUrl(url)) {
            this.iconPath = new vscode.ThemeIcon('link-external');
            this.contextValue = 'endpointUrl';
            this.command = {
                command: 'vscode.open',
                title: url,
                arguments: [uri]
            };
        } else {
            this.iconPath = new vscode.ThemeIcon('radio-tower');
            this.contextValue = 'endpointUrlNonHttp';
        }

* This is a deny list because custom schemes could hand off the link to an app
* registered with the OS. For example, vscode://.
*
* Mirrors the dashboard's KnownUnsupportedUrlSchemes (src/Shared/KnownUnsupportedUrlSchemes.cs).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add a comment to KnownUnsupportedUrlSchemes that values are mirrored here. That way someone (aka AI) knows to update both places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VS Code extension shouldn't offer to open non HTTP resources in browser

3 participants