Skip to content

[Repo Assist] test: expand HttpUrlRiskEvaluator and BrowserProxy coverage#271

Merged
shanselman merged 1 commit intomasterfrom
repo-assist/test-improve-risk-and-browserproxy-2026-05-05-4b0ecf755628e2cd
May 5, 2026
Merged

[Repo Assist] test: expand HttpUrlRiskEvaluator and BrowserProxy coverage#271
shanselman merged 1 commit intomasterfrom
repo-assist/test-improve-risk-and-browserproxy-2026-05-05-4b0ecf755628e2cd

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 5, 2026

🤖 This is an automated PR from Repo Assist.

Summary

Expands unit test coverage for HttpUrlRiskEvaluator and BrowserProxyCapability — two security-critical components. All 12 new tests pass; no existing tests were changed.


HttpUrlRiskEvaluatorTests (+24 tests)

IPv4 IsPublicAddress gaps — the existing suite had explicit IsPublicAddress tests only for IPv6 ranges. This adds direct IPv4 coverage:

Category Examples added
Non-public IPv4 0.1.2.3, 10.x, 100.64.x (CGNAT), 127.x, 169.254.x, 172.16-31.x, 192.168.x, 224+ multicast, 255.255.255.255
Public IPv4 8.8.8.8, 1.1.1.1, boundary values just outside each private range
IPv4-mapped public IPv6 ::ffff:8.8.8.8, ::ffff:1.1.1.1
Evaluate extras localhost host, IPv6 literal, HostKey lowercasing with non-default port, CanonicalOrigin with non-standard port

Why this matters: IsPublicAddress feeds the risk-zone classifier used before browser navigation and media hand-off. A bug that mis-classified a private IPv4 address as public could suppress the confirmation prompt, silently routing the agent to an internal host.

BrowserProxyCapabilityTests (+5 tests)

Covers path-normalization and input-validation branches in BrowserProxyCapability.ExecuteAsync that had no direct tests:

Test Covers
EmptyPath_ReturnsError TryNormalizePath empty-string rejection
SlashlessPrependedPath_NormalizesWithLeadingSlash Auto-prepend of /
DoubleSlashPath_ReturnsError // protocol-relative URL rejection
GatewayPortAbove65533_ReturnsError TryResolveControlEndpoint port overflow
QueryAndProfileAppendedToUri BuildUri with both query and profile params

Test Status

Suite Before After Change
OpenClaw.Shared.Tests 1172 passed, 2 failed*, 20 skipped 1184 passed, 2 failed*, 20 skipped +12 ✅
OpenClaw.Tray.Tests passed (exit 0) no change

* Pre-existing Linux-only canvas JSONL failures (tracked in PR #264).

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@97143ac59cb3a13ef2a77581f929f06719c7402a

- Add direct IsPublicAddress tests for all IPv4 private ranges
  (0/8, 10/8, CGNAT 100.64/10, loopback 127/8, link-local 169.254/16,
  172.16-31/12, 192.168/16, multicast ≥224) — previously only IPv6
  ranges had explicit IsPublicAddress tests.
- Add IsPublicAddress tests for public IPv4 (8.8.8.8, 1.1.1.1, etc.)
  and boundary values just outside the private ranges.
- Add IsPublicAddress tests for IPv4-mapped IPv6 public addresses
  (::ffff:8.8.8.8, ::ffff:1.1.1.1).
- Add Evaluate tests: localhost host, IPv6 literal, HostKey lowercasing
  with non-default port, CanonicalOrigin with non-standard port.
- Add BrowserProxy tests: empty path, path without leading slash
  (auto-prepend), double-slash protocol-relative path rejection,
  gateway port overflow (>65533), query+profile forwarded to URI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@shanselman shanselman marked this pull request as ready for review May 5, 2026 17:26
@shanselman shanselman merged commit 324669d into master May 5, 2026
3 checks passed
@shanselman shanselman deleted the repo-assist/test-improve-risk-and-browserproxy-2026-05-05-4b0ecf755628e2cd branch May 5, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant