3 Commits
Author SHA1 Message Date
poli0981andClaude Opus 5.5 81657aa058 fix(elevation): harden the broker and the Elevator
- Elevated children get an allow-listed environment rebuilt from trusted sources: per-user
  variables (COR_PROFILER/CORECLR_* DLL injection, PSModulePath module hijacking, windir/
  SystemRoot retargeting of recursive deletes) no longer reach commands run as administrator.
  PSModulePath is $PSHOME\Modules only, the one value Windows PowerShell 5.1 keeps as-is.
- Both ends verify the peer: the UI accepts only the Elevator process it launched
  (GetNamedPipeClientProcessId); the Elevator serves only CommandForge.Wpf.exe from its own folder
  (GetNamedPipeServerProcessId) and connects with Identification impersonation.
- The Elevator writes no files any more (an elevated append to the user-writable profile could be
  redirected with a junction); diagnostics go back to the UI's log as pipe Log messages.
- StartupHookSupport=false on the Elevator: DOTNET_STARTUP_HOOKS is ignored.
- Broker: cancelling while UAC/connecting returns Cancelled instead of throwing; a command that
  ignores a cancel for 10 s ends the session; pipe/JSON errors fail the run cleanly; the output
  channel is always completed.
- IElevationService: IsSessionActive and EndSessionAsync (needed before an update replaces the
  files the elevated process runs from) replace the unused IsElevationAvailable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 20:19:03 +07:00
poli0981andClaude Opus 4.8 6e9e5dc3c5 Phase 3a: elevation broker + Safe admin commands
- Elevator pipe server: accepts only a commandId, validates it against its OWN
  embedded catalog (id exists + requiresAdmin), runs via ProcessCommandExecutor,
  streams output, supports mid-run cancel. Never builds a command from pipe input.
- Pipe: per-session GUID name + current-user DACL; UI is the pipe server
  (medium IL), Elevator connects as client (high IL) to avoid the integrity barrier.
- BrokerElevationService: spawns the Elevator once per session via runas (one UAC),
  relays Run/Cancel and streamed output; graceful UAC-declined handling.
- RunCommandUseCase routes admin commands to the broker, others in-process.
- 6 Safe admin commands (DISM CheckHealth/ScanHealth/Analyze, chkdsk read,
  BitLocker status, Windows features) + EN/VI strings; system-maintenance populated.
- Wpf copies CommandForge.Elevator.exe next to the app (build + publish).
- Security hardening (from review): pin process WorkingDirectory to System32 so a
  bare executable name can't resolve from an attacker-controlled CWD when elevated.
- Tests: pipe protocol round-trip, ElevationServer over an in-process named pipe
  (fakes), admin/non-admin routing (35 total).

Build -c Release: 0 warnings. dotnet test: 35/35. UAC flow verified manually.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 20:54:10 +07:00
poli0981andClaude Opus 4.8 76a6e632c6 Scaffold Phase 0: Clean Architecture solution + app shell
- Solution (.slnx): Domain/Application/Infrastructure/Wpf + Elevator + Tests
  (Domain/Application = net10.0 pure; Windows layers = net10.0-windows)
- Domain entities + Application ports; Infrastructure adapters (JSON settings,
  clock, in-memory Serilog sink, CsWin32, DI extension)
- WPF: Generic Host + DI + Serilog, Material Design theme, EN/VI .resx,
  asInvoker manifest
- Shell windows: LegalGateWindow (first-run gate) + MainWindow (menu bar,
  collapsible sidebar, three placeholder panes)
- Elevator helper with requireAdministrator manifest (broker, wired in Phase 3)
- Tests: DI smoke + architecture boundary + LegalGateService (6 pass)
- Root config: global.json (pin .NET 10), Directory.Build.props, .editorconfig
- Add root CLAUDE.md, public legal/ docs, standard .gitignore (docs/ stays local)

Build -c Release: 0 warnings. dotnet test: 6/6 pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 19:02:30 +07:00