Repository navigation
fix(opener): route win32 URLs through rundll32, not explorer.exe - #103
Merged
Merged
Conversation
explorer.exe was used as the win32 launcher for both file paths and URLs. For a URL it opens a File Explorer window instead of the default browser, so `aether auth login`'s device-approval page never opens and the login poll sits on "Waiting for approval in your browser..." forever. resolveOpenCommand now takes an isUrl flag (set by planOpen from the existing isAllowedUrl/looksLikeUrl checks) and, on win32 only, routes http/https URLs to `rundll32.exe url.dll,FileProtocolHandler <url>` — the no-shell equivalent of ShellExecute on a URL. The URL stays one argv element; nothing is re-parsed by cmd.exe or interpolated into a PowerShell string. File paths keep going through explorer.exe, and darwin/linux resolution is unchanged. Also tightens isAllowedUrl to reject any raw URL containing control characters or whitespace: the WHATWG URL parser silently drops tab/CR/LF from anywhere in the input and trims other C0/space from the ends, and this code launches the raw string (not parsed.href), so a target with these could otherwise slip an unexpected byte into the launcher's argv. Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User problem
On Windows 11 26200,
aether auth loginnever opens the device-approval page.src/core/opener.tsresolved the win32 launcher to{ executable: "explorer.exe", args: [target] }for both file paths and URLs. Handed a URL, explorer.exe opens a File Explorer window instead of the default browser, so the login poll sits on "Waiting for approval in your browser..." indefinitely.src/core/browser.ts(used byauth loginandgithub connect) calls straight into this function.Exact scope
src/core/opener.ts:resolveOpenCommandgains anisUrlflag; on win32, an allowed URL now resolves torundll32.exe url.dll,FileProtocolHandler <url>(argv array, two elements) instead ofexplorer.exe. File paths on win32 are unchanged (stillexplorer.exe). darwin/linux resolution is untouched.isAllowedUrladditionally rejects any raw URL containing control characters or whitespace.test/opener.test.ts: extended/added coverage for the new win32 URL path, the unchanged win32 file-path path, unchanged darwin/linux URL resolution, and the new control-character/whitespace rejection.openTarget; its explanatory comment was already accurate).Non-goals
src/main.ts,src/commands/cli_registry.ts,login.ts,package.json, or any release file (owned by other open PRs).rundll32.exeandurl.dllare stock Windows components.Security assumptions
rundll32.exeis spawned withshell: falseand an argv array, same as every other launcher in this file. The URL is never interpolated into a command string (ruled out thepowershell -Command Start-Processapproach for exactly this reason).http:/https:URLs (viaisAllowedUrl) get a launcher at all —javascript:,file:,data:, scheme-less input, and URLs with embedded credentials are all rejected inplanOpen/isAllowedUrlbeforeresolveOpenCommandruns.isAllowedUrlnow also rejects raw input containing control characters (0x00-0x1F, 0x7F) or space, anywhere in the string. Rationale: the WHATWGURLparser silently drops tab/CR/LF from anywhere in the input and trims other C0/space from the ends, but this code launches the raw string (notparsed.href) — without this check a crafted raw string could parse into a "clean"-looking URL while smuggling an unexpected byte into the argv element handed torundll32.exe.Compatibility
doctor, image/vision output, etc.) is bit-for-bit unchanged — stillexplorer.exe, still one argv element.open) and linux (xdg-open) URL/file resolution unchanged for both branches.resolveOpenCommand's new third parameter (isUrl) defaults tofalse, so any other in-repo caller that doesn't pass it keeps today's file-path behavior.Rollback
Revert this commit.
resolveOpenCommand/planOpen/isAllowedUrlreturn to their pre-fix behavior with no other file touched.Base SHA / head SHA
426b12464c2a19549f421adb43348f83d028628e(origin/main)75de47abc040c6f5ee73ddc6dd8cd4b287bff7d9Changed files
src/core/opener.tstest/opener.test.tsTest commands + counts
npm ci— clean install, 0 vulnerabilities.npm run typecheck— clean, no errors.npm test— 1164 tests, 1163 pass, 1 skipped (pre-existing, unrelated), 0 fail.test/opener.test.tsalone: 16 tests (was 12 before this change), all pass.npm run smoke— 4 pass, 1 skip, 2 fail; the 2 failures (local turn: Ollama modelqwen2.5-coder:7bnot pulled on this box;cloud turn: expired session token) are pre-existing environment/credential conditions unrelated toopener.ts/browser.ts, reproduced identically before this change was made.node dist/src/main.js auth login --no-browserprinted the device-approval URL and code correctly (no browser launch attempted, as expected with--no-browser).resolveOpenCommand("https://aethersystems.net/platform/device", "win32", true)from builtdist/src/core/opener.jsreturns{"executable":"rundll32.exe","args":["url.dll,FileProtocolHandler","https://aethersystems.net/platform/device"]}.Mutation evidence
Temporarily reverted
resolveOpenCommand's win32 branch to always returnexplorer.exe(mutation), rebuilt, and rerantest/opener.test.ts: 3 tests failed exactly as expected —a win32 URL is routed to rundll32's FileProtocolHandler, not explorer.exe,planOpen picks rundll32 for a win32 URL, not explorer.exe, andopenTarget spawns rundll32 with the URL as its own argv element, no shell— each assertingexecutable: 'rundll32.exe'got'explorer.exe'instead. Restored the fix and reran clean (16/16 pass).What was not tested
--no-browsercanary, to avoid launching a browser window more than once as instructed).open/xdg-openargv resolution was re-run and is unchanged).Dependency
None — independent leaf. No other open PR touches
src/core/opener.ts,src/core/browser.ts, or their tests.Author model: claude-sonnet (requested gpt56_terra — ROUTING_DRIFT: hosted fleet unreachable due to the aek_ 401)