feat(installer): self-elevate an un-elevated PowerShell run + cmd-safe docs (#421) - #489
Merged
Merged
Conversation
Real users paste the one-liner into a normal PowerShell (or cmd) and the install either dies on the admin requirement or errors syntactically. #386 added elevation instructions; this automates the common case. - On an un-elevated interactive run, offer to relaunch elevated: one consent -> Start-Process -Verb RunAs (UAC) -> install proceeds. Get-ElevationCommand builds the relaunch args -- re-run the on-disk .ps1 when present, else re-fetch the one-liner (irm|iex) -- forwarding -NoReboot/-Diagnose. Non-interactive/declined/ failed falls back to the followable Win+X -> Terminal (Admin) steps (#386). - docs/INSTALL.md: add the cmd-safe form (powershell -ExecutionPolicy Bypass -Command "irm ... | iex") so a paste into cmd.exe runs instead of a syntax error, plus the exact Win11 admin steps. Env-var config (TRACEBLOC_*) is intentionally not forwarded across RunAs (no env inheritance; secrets on a command line are unsafe) -- documented; env-driven runs should be launched elevated. Tests: Get-ElevationCommand (file vs one-liner, switch forwarding) + gate source guards. Website snippet + screenshot are a separate repo (noted in the PR). Closes #421 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
👋 Heads-up — Code review queue is at 31 / 30 Above the WIP limit. The team convention is to review existing PRs before opening new work. Open PRs currently in Code review (oldest first):
Pull from review before opening new work. (This is a nudge from the kanban WIP check, not a block.) |
…wards switches (Bugbot) Two elevation-relaunch defects: - The documented irm|iex flow runs install-k8s.ps1 from a bootstrap TEMP dir the un-elevated process deletes on exit, so -File <tempfile> in the elevated window hit a missing script. Only use -File for a DURABLE (non-temp) path; otherwise re-fetch the one-liner. - The one-liner branch dropped -NoReboot/-Diagnose. iex can't take args, so when switches must be forwarded, invoke the fetched shim as a scriptblock with them; keep the plain irm|iex form when there are none. Adds temp-dir and switch-forwarding tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 07f6df3. Configure here.
…switches (Bugbot) Two elevation follow-ups: - Get-ElevationCommand now returns a single command-line STRING and quotes the -File path, so a script path with spaces survives PS 5.1's Start-Process -ArgumentList (which doesn't quote array elements; same class as #419). - The one-liner path no longer tries to forward switches via a scriptblock: the shim (i.ps1) has no param block, so & ([scriptblock]) -Diagnose fails on an unknown named parameter; and an irm|iex launch can't have set a switch anyway. Keep the exact documented irm|iex form. Tests updated for the string contract + the no-scriptblock one-liner path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
# Conflicts: # scripts/manifest.sha256
saadqbal
approved these changes
Jul 30, 2026
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.

What & why
Real users paste the one-liner into a normal PowerShell (or cmd.exe), where the install either dies later on the admin requirement or fails syntactically. #386 added elevation instructions; this automates the common case so a hospital user doesn't need to know "Terminal (Admin)" is a separate thing.
Changes (
scripts/install-k8s.ps1,docs/INSTALL.md)Start-Process -Verb RunAs(one UAC prompt) → install proceeds.Get-ElevationCommandbuilds the relaunch args: re-run the on-disk.ps1when present, else re-fetch the documented one-liner (irm … | iex), forwarding-NoReboot/-Diagnose.docs/INSTALL.mdnow shows the Command-Prompt formpowershell -ExecutionPolicy Bypass -Command "irm … | iex"so a paste intocmd.exeruns instead of erroring, plus the exact Win11 admin steps.Acceptance (from #421)
Scope notes
TRACEBLOC_*) is intentionally not forwarded across RunAs: ShellExecute doesn't inherit the caller's process env, and putting secrets on a command line is unsafe. Documented — env-driven runs should be launched elevated.tracebloc-website(separate repo), so they're out of scope here; the cmd-safe form is captured indocs/INSTALL.md.Tests
Get-ElevationCommand(on-disk-Filevs one-liner re-fetch, switch forwarding) + gate source guards (offers RunAs before instructions; only prompts when interactive).Local verification
Pester 294/0/9 · check-style pass · drift clean · manifest regenerated · PS parse OK. (No bash changes — bats unaffected.)
Closes #421
Note
Low Risk
Installer UX and documentation only; elevation logic is gated on interactivity with tested fallbacks and does not change cluster or credential handling.
Overview
Windows installer no longer exits immediately when run without Administrator rights. In an interactive session it warns, asks to relaunch elevated, and uses
Start-Process -Verb RunAs(one UAC prompt).Get-ElevationCommand/Invoke-SelfElevatebuild the relaunch: durable on-disk.ps1paths use quoted-Fileand forward-NoReboot/-Diagnose; the documentedirm | iexpath and bootstrap temp scripts re-fetch the one-liner (switches not forwarded to the paramless shim). Declined, non-interactive, or failed elevation still shows the Win+X → Terminal (Admin) steps from #386.docs/INSTALL.mdsplits PowerShell vs Command Prompt install lines, adds thepowershell -ExecutionPolicy Bypass -Command "irm … | iex"form forcmd.exe, and documents admin requirements plus optional self-elevation.Tests cover
Get-ElevationCommandquoting and paths; manifest hash updated forinstall-k8s.ps1.Reviewed by Cursor Bugbot for commit 09eb02a. Bugbot is set up for automated code reviews on this repo. Configure here.