[Repo Assist] fix(security): stop leaking ex.Message in node client, device capability, and approval prompts - #306
Merged
shanselman merged 3 commits intoMay 14, 2026
Conversation
…ity, and approval prompts WindowsNodeClient had two catch blocks that embedded ex.Message directly in the error string sent to the gateway. DeviceCapability's SafeCollect helpers returned ex.Message verbatim in the per-section payload dict. ExecApprovalPromptService and UrlNavigationApprovalService embedded ex.Message in denial reasons that surface in local log warnings. In all cases the detailed exception message is already written to the local logger immediately before being placed in the response; removing it from the outbound surface keeps diagnostics intact while preventing internal exception details (file paths, platform messages, etc.) from reaching the gateway or remote callers. Follows the same pattern as the earlier CanvasCapability and BrowserProxyCapability fix (commit 990395c). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced May 11, 2026
Assert the battery failure payload keeps internal exception details out of the response. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
shanselman
marked this pull request as ready for review
May 14, 2026 01:56
shanselman
deleted the
repo-assist/fix-ex-message-leaks-remaining-2026-05-11-83f5733e4978f96a
branch
May 14, 2026 02:13
30 tasks
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.
🤖 Repo Assist — automated AI assistant.
Follows up on #294 (merged) by removing the remaining
ex.Messagesurface leaks that send internal exception details outside the local process.Problem
Four locations still embedded
ex.Messagein gateway-bound responses or in approval-decisionReasonstrings that surface in local logs:WindowsNodeClient.cscatchinHandleNodeInvokeAsync(×2)SendNodeInvokeResultAsync/SendErrorResponseAsyncDeviceCapability.csSafeCollect/SafeCollectAsyncdevice.statusresponse payload sent to gateway ({ "error": "..." })ExecApprovalPromptService.csdialog.ShowAsync()ExecApprovalPromptDecision.Reason→ local log viaSystemCapabilityUrlNavigationApprovalService.csMessageBoxWUrlNavigationApprovalDecision.Reason→ local log viaNodeServiceIn all cases, the full exception message is already written to the local logger immediately before being placed in the outbound string — so diagnostic fidelity is preserved. The only change is that remote callers and the gateway no longer receive internal implementation details (file paths, platform error messages, COM HRESULTs, etc.).
Fix
Replace
ex.Messagein outbound strings with a fixed generic message:WindowsNodeClient.cs:"Command execution failed"(was$"Execution failed: {ex.Message}")DeviceCapability.cs:"collection failed"(wasex.Message)ExecApprovalPromptService.cs:"Approval prompt failed"(was$"Prompt failed: {ex.Message}")UrlNavigationApprovalService.cs:"Approval prompt failed"(was$"Prompt failed: {ex.Message}")Test Status
dotnet test OpenClaw.Shared.Tests --no-restore— ✅ exit 0dotnet test OpenClaw.Tray.Tests --no-restore— ✅ exit 0build.ps1— requires Windows; infrastructure limitation on Linux runner