Skip to content

fix(browser): reject credentialed page URLs safely#102952

Merged
steipete merged 1 commit into
mainfrom
codex/82490-browser-credential-urls
Jul 9, 2026
Merged

fix(browser): reject credentialed page URLs safely#102952
steipete merged 1 commit into
mainfrom
codex/82490-browser-credential-urls

Conversation

@steipete

@steipete steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Browser open and navigate accepted page URLs containing userinfo. Chromium/Playwright can reject those URLs after the credential-bearing string has crossed tool or node-proxy boundaries, and malformed credential-like URLs could also reach dispatch before validation.

Closes #55365. This carries forward and improves #82490 by @lidge-jun after the nominally maintainer-editable fork branch could not be updated.

Why This Change Was Made

Use one canonical navigation URL parser at both boundaries that matter:

  • the model-facing Browser tool, before host or Browser-node dispatch;
  • the server navigation guard, before DNS lookup and SSRF policy evaluation.

Parsed URL userinfo is rejected with guidance to supported authentication flows. Malformed credential-bearing input is fully redacted in diagnostics. The refactor removes the separate one-use helper from #82490 and keeps the steady-state path small.

The supported alternatives remain intact: explicit Browser HTTP credentials, authenticated browser profiles, and credentials on configured CDP endpoint URLs.

User Impact

Credential-bearing page URLs now fail fast without exposing the credential in the error. Ordinary navigation still works, and users who need authentication retain the dedicated Browser credential/profile/CDP flows.

Evidence

  • Focused regression lane: 4 test files, 152 tests passed (navigation-guard, Browser tool host/node dispatch, Playwright navigation guard, authenticated CDP helpers).
  • Real Dev Gateway + OpenAI + Chrome: normal agent Browser navigation passed; a second transcript-proven agent Browser call rejected a credential-bearing URL; valid and malformed inputs stayed redacted; explicit HTTP Basic credentials loaded the protected page; an authenticated CDP profile connected successfully.
  • oxfmt --check, targeted oxlint, and git diff --check passed.
  • Fresh GPT-5.5 autoreview: no accepted/actionable findings; patch judged correct (0.85 confidence).

Contributor credit is preserved in the commit trailer.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Jul 9, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b34a20f4b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +45 to +46
const diagnostic = rawUrl.includes("@") ? "[redacted credential-bearing URL]" : rawUrl;
throw new InvalidBrowserNavigationUrlError(`Invalid URL: ${diagnostic}`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Redact malformed credential URLs without raw @

When a malformed Basic-auth URL omits or encodes the @ delimiter (for example https://user:secret or https://user:secret%40example.com), new URL throws and this rawUrl.includes("@") check takes the raw branch, so the Browser tool/server error includes secret. That leaves credential-like parse failures unredacted even though this path is intended to stop credentialed navigations before dispatch; redact authority strings that look like userinfo before echoing invalid URLs.

Useful? React with 👍 / 👎.

@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready verification for exact PR head b34a20f4b9d9840be318faedae4de280dd4afda7:

  • Native review guard/artifacts: READY FOR /prepare-pr, zero findings; behavioral sweep passed.
  • Focused regression command:
    node scripts/run-vitest.mjs extensions/browser/src/browser/navigation-guard.test.ts extensions/browser/src/browser-tool.test.ts extensions/browser/src/browser/pw-tools-core.snapshot.navigate-guard.test.ts extensions/browser/src/browser/cdp.helpers.test.ts
    Result: 4 files, 152 tests passed.
  • Static proof: oxfmt --check on all four changed files, targeted oxlint --tsconfig config/tsconfig/oxlint.extensions.json, and git diff --check all passed.
  • Real Dev Gateway + OpenAI + Chrome behavior proof passed end to end. The agent transcript was parsed to require a real browser tool call for each agent turn. Markers:
    • agent-normal-browser-ok
    • agent-credential-url-blocked-ok
    • valid-and-malformed-userinfo-redacted
    • explicit-http-credentials-ok
    • authenticated-cdp-ok
    • PASS
  • Authentication boundary proof: page-navigation URL userinfo is rejected before host/node dispatch and malformed credential-bearing input is fully redacted. Dedicated Browser HTTP Basic credentials still loaded a protected page, and a configured CDP endpoint URL with credentials still connected successfully.
  • Fresh GPT-5.5 autoreview: no accepted/actionable findings; patch judged correct (0.85 confidence).
  • Exact-head hosted CI/Testbox: run 29028642700, success with no failed jobs.
  • Native OPENCLAW_TESTBOX=1 scripts/pr prepare-run 102952: passed; local prep tree and remote PR head match exactly.

Known proof gaps: none for the changed Browser navigation/authentication surface.

@steipete
steipete merged commit d5fb490 into main Jul 9, 2026
105 of 108 checks passed
@steipete
steipete deleted the codex/82490-browser-credential-urls branch July 9, 2026 15:23
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Post-merge integration verification on latest main 3c048ef0529712e0d1fab86fba02b194cd245d2a after #102946 also changed browser-tool.ts / browser-tool.test.ts:

  • Source inspection confirms the credential parser still runs before either local Browser dispatch or the node-proxy call. The newer browser-v1 error-envelope handling runs only after node dispatch and does not bypass or weaken that guard.
  • Blacksmith Testbox provider: blacksmith-testbox
  • Lease: tbx_01kx3qwq7bvp8553th5vzja9tg (pearl-shrimp)
  • Action: https://github.com/openclaw/openclaw/actions/runs/29029622880
  • Exact action head: 3c048ef0529712e0d1fab86fba02b194cd245d2a
  • Combined focused command covered navigation guard, Browser tool host/node dispatch, Playwright navigation guard, CDP auth, no-display headless recovery, node-host/gateway error-envelope mapping, client error boundaries, route mapping, and closed error metadata.
  • Result: 10 test files passed, 217 tests passed; wrapper exit code 0 (syncDelegated=true, command 19.531s, total 19.545s).

The Testbox was stopped after the successful command. Current main remains clean and contains the landed #102952 commit.

Simon-XYDT pushed a commit to Simon-XYDT/openclaw that referenced this pull request Jul 9, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 10, 2026
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Browser tool should reject or redact URLs with embedded credentials instead of passing them through

1 participant