Skip to content

Fix: Validate homepage URL scheme before opening browser (ADO#2982591)#2548

Open
lucygramley wants to merge 1 commit into
mainfrom
fix/mythos-2982591-homepage-url-validation
Open

Fix: Validate homepage URL scheme before opening browser (ADO#2982591)#2548
lucygramley wants to merge 1 commit into
mainfrom
fix/mythos-2982591-homepage-url-validation

Conversation

@lucygramley
Copy link
Copy Markdown
Contributor

@lucygramley lucygramley commented May 18, 2026

Summary

Fixes ADO#2982591

Changes

NpmPackageInstallViewModel.csOpenHomepage() and CanOpenHomepage() now validate that the URL is a well-formed absolute URI with an http or https scheme before opening it.

NpmWorker.csAddHomepage() applies the same validation at data ingestion, so non-http(s) URLs are never stored or displayed as clickable links.

Test Plan

Added 23 unit tests in Nodejs/Tests/HomepageValidationTests/ that verify:

  • Legitimate http/https URLs are allowed
  • Malicious inputs (UNC paths, local executables, protocol handlers, file:// URIs, javascript: URIs) are blocked
  • Edge cases (null, empty, whitespace, relative paths, garbage) are blocked

Run with:
\
cd Nodejs/Tests/HomepageValidationTests
dotnet restore --source https://api.nuget.org/v3/index.json
dotnet test --no-restore
\\

All 23 tests pass.

OpenHomepage() passes registry-supplied homepage URLs directly to
VsShellUtilities.OpenBrowser with no scheme validation, allowing
UNC paths or protocol-handler URIs (e.g. \\\\attacker\\share) to
trigger SMB hash leaks or arbitrary process launch.

Add Uri.TryCreate + http/https scheme allow-list in both OpenHomepage()
and AddHomepage() to block non-web URLs at display and click time.

Fixes ADO#2982591 (NTVS-002, CWE-749)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lucygramley lucygramley force-pushed the fix/mythos-2982591-homepage-url-validation branch from 0b118cd to 0312998 Compare May 20, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant