Files
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

20 lines
865 B
XML

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- WinExe so no empty console window flashes when the UI spawns it elevated. -->
<OutputType>WinExe</OutputType>
<TargetFramework>net10.0-windows</TargetFramework>
<ApplicationManifest>app.manifest</ApplicationManifest>
<RootNamespace>CommandForge.Elevator</RootNamespace>
<!-- The Elevator runs as administrator but inherits the user's environment block: never honour
DOTNET_STARTUP_HOOKS, which would load an arbitrary assembly into the elevated process. -->
<StartupHookSupport>false</StartupHookSupport>
</PropertyGroup>
<ItemGroup>
<!-- Reuse the embedded catalog + process executor + pipe protocol (internals visible). -->
<ProjectReference Include="..\..\src\CommandForge.Infrastructure\CommandForge.Infrastructure.csproj" />
</ItemGroup>
</Project>