fix(connection): trust MSIX-packaged wslrelay.exe when Authenticode check fails - #1177
fix(connection): trust MSIX-packaged wslrelay.exe when Authenticode check fails#1177larroy wants to merge 1 commit into
Conversation
…heck fails Modern WSL distributes as an MSIX package (Program Files\WSL / WindowsApps), which doesn't embed per-file Authenticode/catalog signatures on its EXEs -- trust is established at the package level instead. This caused genuine Microsoft wslrelay.exe binaries to be rejected during setup's loopback listener provenance check with "WSL relay Authenticode verification failed (Unsigned)". Add a fallback in WindowsAuthenticodeVerifier: when the classic Authenticode check fails and the file is wslrelay.exe, corroborate trust via the installed AppX package instead. Requires an exact match on the known WSL package family name (MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe, whose suffix is derived from the publisher's signing cert), a real SignatureKind, and a Microsoft publisher (reusing the existing HasMicrosoftPublisherIdentity check). Looked up via a PowerShell Get-AppxPackage shell-out, matching this file's existing pattern for invoking schtasks.exe/wsl.exe. The primary Authenticode/catalog check is unchanged and always consulted first; the fallback narrows to wslrelay.exe specifically and never weakens the trust bar for any other binary.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 19, 2026, 12:46 PM ET / 16:46 UTC. ClawSweeper reviewWhat this changesThe PR adds an MSIX package metadata fallback for Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 8 items remain Keep open. The fallback can trust a relay executable based on metadata from a separately queried WSL package, weakening the local endpoint trust gate that protects shared and bootstrap credentials. Priority: P0 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherConnection setup proves which process owns a local WSL gateway listener before allowing credential fallback. A verified relay and matching WSL service ownership feed the managed-gateway provenance result used by the strong-credential gate. flowchart LR
A[WSL relay listener] --> B[Canonical path gate]
B --> C[Authenticode verification]
C --> D{Classic trust succeeds?}
D -->|yes| E[Managed gateway provenance]
D -->|no| F[MSIX package fallback]
F --> E
E --> G[Shared or bootstrap credential gate]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The fallback disconnects executable identity from package identity in a credential-protecting trust decision. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Bind any package-level fallback to the registered Microsoft WSL package that owns the inspected executable, fail closed for every other path, and publish redacted real Windows MSIX proof after the repair. Do we have a high-confidence way to reproduce the issue? Yes: source shows that any failed path named wslrelay.exe can receive Trusted from valid WSL package metadata without a path-to-package comparison; a focused regression can model an unrelated WindowsApps sibling relay. Is this the best way to solve the issue? No: the fallback must prove that the inspected executable belongs to the trusted WSL package, rather than treating the presence of that package as corroboration for another executable. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b37307cbd51f. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
Acceptance criteria:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Problem
Setup fails on machines running the modern MSIX-distributed WSL (
Program Files\WSL, e.g. the Store/GitHub-released package) with:MSIX packages don't embed per-file Authenticode/catalog signatures on their EXEs — trust is established at the package level instead (verified by Windows at install time). So
wslrelay.exe,wsl.exe,wslhost.exe, etc. from this distribution reportUnsignedviaWinVerifyTrust/FileSignatureInfo, even though they're genuine, unmodified Microsoft binaries (confirmed viaGet-AppxPackage:Publisher = CN=Microsoft Corporation, O=Microsoft Corporation, ...).Fix
Add a fallback to
WindowsAuthenticodeVerifier.VerifyMicrosoftSignedFile: when the primary Authenticode/catalog check fails and the file iswslrelay.exe, corroborate trust via the installed AppX package instead of rejecting outright. The fallback requires all of:MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe(the suffix is derived from the publisher's signing certificate, so an impostor package re-signed with a different cert would get a different family name).SignatureKind(notNone) — proves Windows cryptographically validated the package at install time.HasMicrosoftPublisherIdentitycheck unchanged.Looked up via a
powershell.exe -Command "Get-AppxPackage ... | ConvertTo-Json"shell-out, matching this file's existing pattern for invokingschtasks.exe/wsl.exeelsewhere inManagedLocalGatewayPortProvenanceService.cs.The primary Authenticode/catalog check is unchanged, always runs first, and is never bypassed — the fallback only narrows scope to
wslrelay.exeand never weakens the trust bar for any other binary. No.csproj/TFM changes; no changes to the canonical-path allowlist.Testing
dotnet build src/OpenClaw.Connection/OpenClaw.Connection.csproj— succeeds, 0 warnings/errors.dotnet test tests/OpenClaw.Connection.Tests/OpenClaw.Connection.Tests.csproj— 638/638 passing, including 6 new tests covering: trusted-via-fallback, no-package-found, family-name mismatch, unsigned package, non-Microsoft publisher, and a regression test proving the fallback is never consulted when Authenticode already succeeds.🤖 Generated with Claude Code