Commit Graph
3 Commits
Author SHA1 Message Date
poli0981andClaude Opus 5.5 37950a05ff feat(execution): trusted executable paths, encoding-aware output, kill-on-close job
- ExecutableResolver: catalog executables resolve to absolute paths in System32/Windows (and
  the winget alias), so CreateProcess never searches the per-user, user-writable app folder —
  a planted reg.exe/powershell.exe there would otherwise run elevated. Launch-mode commands now
  pin their working directory too.
- OutputDecoder: stdout/stderr are read as raw bytes and decoded per line (UTF-16LE when the
  stream is UTF-16, else strict UTF-8 with an OEM-code-page fallback). sfc/wsl output and every
  native tool on Vietnamese/Japanese/Chinese Windows used to show as mojibake. Lone \r (progress
  updates) still breaks lines.
- ProcessJob: captured commands join a kill-on-close job object, so closing or crashing the app
  can no longer leave a half-finished command running.
- ArgumentTokens ({SystemDrive}, {SystemRoot}, {UserProfile}) filled from SystemPaths, which reads
  the kernel-reported system directory, known folders and HKLM — never %SystemRoot%-style
  variables a standard user can redefine. The command preview shows the expanded values.
- Exit code 3010 always flags a restart; Launch commands honour RestartPolicy.Always; output is
  only captured (bounded) when a restart regex needs it. ExecutionResult.OutputLines is gone
  (nothing read it, and it held the entire output in memory).
- RunCommandUseCase always completes the output channel and maps cancellation, so a failing run
  can no longer leave the console waiting forever.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 20:19:03 +07:00
poli0981andClaude Opus 5.5 3fc7f0edf2 fix: resolve SonarCloud and SonarAnalyzer findings
- UpdateViewModel: every check/download owns a disposed CancellationTokenSource that Close
  cancels; an unexpected exception now shows an error instead of leaving the dialog on "Checking".
- Regex calls (catalog validation, restart detection) run with a match timeout.
- Elevation: CancelAsync/DisposeAsync instead of the blocking variants; implementations declare
  the interface's default CancellationToken.
- SystemProcessRunner: drop the redundant blocking WaitForExit (WaitForExitAsync already drains
  redirected output); "Restart now" launches System32\shutdown.exe by absolute path.
- ProductLinks: one home for the repository/issue/license/user-guide URLs that were duplicated
  across five files (the dead wiki link now points at the user guide).
- Smaller rule fixes (readonly fields, LINQ filters, no empty loops, nested ternaries, static
  handlers); remove the unused LegalGateViewModel.TermsVersion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 19:56:27 +07:00
poli0981andClaude Opus 4.8 5351c114d1 Phase 2: execution engine (run, stream, cancel, restart-detect)
- Domain: OutputLine, ExecutionMode (Capture/Launch), Cancelled +
  RebootRequiredExitCode on ExecutionResult
- Catalog: executionMode=Launch for the 7 GUI commands (winver, cleanmgr,
  perfmon, eventvwr, resmon, dxdiag, God Mode)
- Ports: ICommandExecutor/IElevationService stream via ChannelWriter<OutputLine>
- Infrastructure: IProcessRunner + SystemProcessRunner (redirect, kill tree) +
  ProcessCommandExecutor (Capture tees a channel for live output + regex capture;
  Launch fire-and-forget; restart-detect 3010/Always/regex; cancellation)
- WPF: ExecutionViewModel (off-UI-thread channel consumer), console pane
  (stderr amber, AutoScroll-with-pause), result panel (status/exit/duration/copy),
  Cancel + Restart (confirm) buttons; Run button enabled
- Tests: executor via FakeProcessRunner (3010/Always/regex/cancel/order/launch)
  + real-process echo smoke test (29 total)

Build -c Release: 0 warnings. dotnet test: 29/29.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 20:11:50 +07:00