Skip to content

fix(opener): route win32 URLs through rundll32, not explorer.exe - #103

Merged
AetherAI3 merged 1 commit into
mainfrom
fix/windows-url-opener
Aug 23, 2026
Merged

AetherAI3 merged 1 commit into
mainfrom
fix/windows-url-opener

Conversation

@AetherAI3

Copy link
Copy Markdown
Owner

User problem

On Windows 11 26200, aether auth login never opens the device-approval page. src/core/opener.ts resolved 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 by auth login and github connect) calls straight into this function.

Exact scope

  • src/core/opener.ts: resolveOpenCommand gains an isUrl flag; on win32, an allowed URL now resolves to rundll32.exe url.dll,FileProtocolHandler <url> (argv array, two elements) instead of explorer.exe. File paths on win32 are unchanged (still explorer.exe). darwin/linux resolution is untouched. isAllowedUrl additionally 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.
  • No other files touched (browser.ts needed no code change — it already just calls openTarget; its explanatory comment was already accurate).

Non-goals

  • No change to src/main.ts, src/commands/cli_registry.ts, login.ts, package.json, or any release file (owned by other open PRs).
  • No change to macOS/Linux launcher behavior.
  • No new runtime dependency — rundll32.exe and url.dll are stock Windows components.

Security assumptions

  • No shell is introduced: rundll32.exe is spawned with shell: false and an argv array, same as every other launcher in this file. The URL is never interpolated into a command string (ruled out the powershell -Command Start-Process approach for exactly this reason).
  • Scheme allowlist is unchanged and still enforced before this function is reached: only http:/https: URLs (via isAllowedUrl) get a launcher at all — javascript:, file:, data:, scheme-less input, and URLs with embedded credentials are all rejected in planOpen/isAllowedUrl before resolveOpenCommand runs.
  • New: isAllowedUrl now also rejects raw input containing control characters (0x00-0x1F, 0x7F) or space, anywhere in the string. Rationale: the WHATWG URL parser 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 (not parsed.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 to rundll32.exe.

Compatibility

  • File-path opening on win32 (doctor, image/vision output, etc.) is bit-for-bit unchanged — still explorer.exe, still one argv element.
  • darwin (open) and linux (xdg-open) URL/file resolution unchanged for both branches.
  • resolveOpenCommand's new third parameter (isUrl) defaults to false, so any other in-repo caller that doesn't pass it keeps today's file-path behavior.

Rollback

Revert this commit. resolveOpenCommand/planOpen/isAllowedUrl return to their pre-fix behavior with no other file touched.

Base SHA / head SHA

  • Base: 426b12464c2a19549f421adb43348f83d028628e (origin/main)
  • Head: 75de47abc040c6f5ee73ddc6dd8cd4b287bff7d9

Changed files

  • src/core/opener.ts
  • test/opener.test.ts

Test 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.ts alone: 16 tests (was 12 before this change), all pass.
  • npm run smoke — 4 pass, 1 skip, 2 fail; the 2 failures (local turn: Ollama model qwen2.5-coder:7b not pulled on this box; cloud turn: expired session token) are pre-existing environment/credential conditions unrelated to opener.ts/browser.ts, reproduced identically before this change was made.
  • Real-binary canary: node dist/src/main.js auth login --no-browser printed the device-approval URL and code correctly (no browser launch attempted, as expected with --no-browser).
  • Direct resolver canary: calling resolveOpenCommand("https://aethersystems.net/platform/device", "win32", true) from built dist/src/core/opener.js returns {"executable":"rundll32.exe","args":["url.dll,FileProtocolHandler","https://aethersystems.net/platform/device"]}.

Mutation evidence

Temporarily reverted resolveOpenCommand's win32 branch to always return explorer.exe (mutation), rebuilt, and reran test/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, and openTarget spawns rundll32 with the URL as its own argv element, no shell — each asserting executable: 'rundll32.exe' got 'explorer.exe' instead. Restored the fix and reran clean (16/16 pass).

What was not tested

  • A real browser actually opening on this Windows box for a live URL (only argv-resolution was verified directly, plus the --no-browser canary, to avoid launching a browser window more than once as instructed).
  • Real launch verification on macOS/Linux (those code paths are untouched; existing unit coverage for open/xdg-open argv 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)

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]>
@AetherAI3
AetherAI3 merged commit a4b935c into main Aug 23, 2026
5 checks passed
@AetherAI3
AetherAI3 deleted the fix/windows-url-opener branch August 23, 2026 01:11
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