[Repo Assist] fix(security): stop leaking ex.Message in CanvasCapability and BrowserProxyCapability - #294
Merged
shanselman merged 2 commits intoMay 10, 2026
Conversation
…rProxyCapability CanvasCapability leaked raw exception messages (from WebView2/OS handlers) in navigate, eval, snapshot, a2ui.dump, and a2ui.caps error responses. BrowserProxyCapability leaked HttpRequestException, JsonException, IOException, and UnauthorizedAccessException messages through its error responses. All now log exceptions internally and return generic error codes. The jsonlPath path-validation path is preserved as-is since its exceptions are thrown by our own private method with controlled message strings. Tests updated: handler-throws tests now assert on the generic error code and verify the raw exception message is absent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
23 tasks
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
shanselman
marked this pull request as ready for review
May 10, 2026 22:06
Collaborator
|
Validated locally on Windows after latest changes: \.\build.ps1, \dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore, and \dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore\ all passed. Note: build.ps1 still reports the existing Windows 10 SDK detection warning, but the build completed successfully. |
shanselman
deleted the
repo-assist/fix-canvas-proxy-exception-message-leaks-2026-05-08-185ebfefe7f69c8e
branch
May 10, 2026 22:16
This was referenced May 11, 2026
github-actions Bot
added a commit
that referenced
this pull request
May 13, 2026
PR #294 sanitised the main canvas command handlers (navigate, eval, snapshot, a2ui) but left one ex.Message leak at the jsonlPath read path: Error($"Failed to read jsonlPath: {ex.Message}"). The exception detail was already written to the local logger on the line above, so diagnostic fidelity is preserved; only the gateway-bound error string is stripped. Closes: the residual canvas capability gap identified post-#294. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
PR #291 fixed exception message leaks across
SystemCapability,CameraCapability,ScreenCapability, andLocationCapability. This PR closes the remaining gaps inCanvasCapabilityandBrowserProxyCapability.Root cause
Both capabilities echoed raw
ex.Messagevalues from external code (WebView2 handlers, OS APIs, network stack) directly into node response payloads. Any exception thrown by a handler — including messages that might contain internal paths, system state, or error detail — was forwarded to the gateway caller.CanvasCapability — affected commands:
canvas.navigate— handler exception message leakedcanvas.eval— handler exception message leakedcanvas.snapshot— handler exception message leakedcanvas.a2ui.dump— handler exception message leakedcanvas.a2ui.caps— handler exception message leakedcanvas.a2ui.push (jsonlPath)— system exception message could propagate viaInvalidOperationExceptionwrapperBrowserProxyCapability — affected exceptions:
HttpRequestException— connection error detail leakedJsonException— JSON structure detail leakedIOException— file read error (potential path disclosure) leakedUnauthorizedAccessException— access denied detail leakedFix
All affected sites now log the exception internally (preserving full diagnostics) and return generic error codes. The
jsonlPathpath-validation path is unchanged — its exceptions originate from our own private method with controlled message strings.BrowserProxyCapability exception handlers now follow the existing pattern from PR #291: log with
Logger.Warn(message +ex.Messagefor internal diagnostics), return sanitized error string.Test Status
dotnet test OpenClaw.Shared.Tests— 1405 passed / 20 skipped / 4 pre-existing failures (same 4 as baseline:ExecApprovalV2NormalizationTests× 3 andMcpHttpServerTests× 1, all pre-existing on Linux)dotnet test OpenClaw.Tray.Tests— 465 passed / 1 skipped ✅build.ps1— requires Windows; infrastructure limitation on Linux runnerHandler-throws tests updated to assert on generic error codes and verify raw exception messages are absent from responses.