fix(browser): default to openclaw profile when unspecified#31913
fix(browser): default to openclaw profile when unspecified#31913liuxiaopai-ai wants to merge 1 commit intoopenclaw:mainfrom
Conversation
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🔵 Insecure default: unauthenticated local Chrome CDP becomes default profile (openclaw)
DescriptionThe change makes the built-in Why this matters:
Code references:
Vulnerable behavior is introduced by making the unauthenticated CDP-backed profile the default, increasing exposure in default installs/configs. RecommendationAvoid making an unauthenticated CDP endpoint the default, or add an authentication boundary in front of it. Options:
// Prefer extension relay by default
export const DEFAULT_BROWSER_DEFAULT_PROFILE_NAME = "chrome";
Additionally, consider explicitly pinning loopback binding via Chrome flags (defense-in-depth): args.push("--remote-debugging-address=127.0.0.1");
args.push(`--remote-debugging-port=${profile.cdpPort}`);This does not add auth, but reduces the risk of unexpected non-loopback binding across platforms/versions. Analyzed PR: #31913 at commit Last updated on: 2026-03-02T17:03:22Z |
Greptile SummaryChanges the default browser profile from Confidence Score: 5/5
Last reviewed commit: 106ab55 |
| const defaultProfile = | ||
| defaultProfileFromConfig ?? | ||
| (preferOpenClawProfile && profiles[DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME] | ||
| ? DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME | ||
| : profiles[DEFAULT_BROWSER_DEFAULT_PROFILE_NAME] | ||
| ? DEFAULT_BROWSER_DEFAULT_PROFILE_NAME | ||
| : DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME); | ||
| (profiles[DEFAULT_BROWSER_DEFAULT_PROFILE_NAME] | ||
| ? DEFAULT_BROWSER_DEFAULT_PROFILE_NAME | ||
| : DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME); |
There was a problem hiding this comment.
Ternary is now redundant since DEFAULT_BROWSER_DEFAULT_PROFILE_NAME and DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME are both "openclaw". Could simplify to:
| const defaultProfile = | |
| defaultProfileFromConfig ?? | |
| (preferOpenClawProfile && profiles[DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME] | |
| ? DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME | |
| : profiles[DEFAULT_BROWSER_DEFAULT_PROFILE_NAME] | |
| ? DEFAULT_BROWSER_DEFAULT_PROFILE_NAME | |
| : DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME); | |
| (profiles[DEFAULT_BROWSER_DEFAULT_PROFILE_NAME] | |
| ? DEFAULT_BROWSER_DEFAULT_PROFILE_NAME | |
| : DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME); | |
| const defaultProfile = defaultProfileFromConfig ?? DEFAULT_BROWSER_DEFAULT_PROFILE_NAME; |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/browser/config.ts
Line: 267-271
Comment:
Ternary is now redundant since `DEFAULT_BROWSER_DEFAULT_PROFILE_NAME` and `DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME` are both `"openclaw"`. Could simplify to:
```suggestion
const defaultProfile = defaultProfileFromConfig ?? DEFAULT_BROWSER_DEFAULT_PROFILE_NAME;
```
How can I resolve this? If you propose a fix, please make it concise.|
"Thanks for the quick PR! I've been doing a deeper dive into the logs and realized that the bug actually exists at two levels. While this PR addresses the Layer 1 (config fallback), there’s a Layer 2 (driver instantiation) issue in ensureBrowserAvailable() that will still cause relay timeouts even with your change. To ensure a complete fix and prevent regressions, I’ve prepared a comprehensive PR that refactors both layers. I'll link it here shortly so the maintainers can compare." |
|
"Update: I've submitted PR #31972which comprehensively fixes this. It cleans up the underlying config logic and fixes the outdated documentation. Ready for review!" |
Summary
chromeextension-relay profile whenbrowser.defaultProfilewas unset, causing no-profile tool calls to hit relay timeout paths.openclaw(managed local browser) and kept thechromeprofile available for explicit opt-in.chromeprofile creation.browser.defaultProfilecontinues to override defaults; extension relay behavior and availability checks are unchanged.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
browser.defaultProfileis not configured, browser actions now default toopenclawinstead ofchrome.chromerelay profile is still auto-created and can still be selected explicitly.Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
browser.defaultProfileSteps
defaultProfile.openclaw/chromeprofile definitions.defaultProfile: "chrome"overrides still work.Expected
openclaw.chromerelay profile remains available for explicit usage.Actual
Evidence
Human Verification (required)
defaultProfile = "openclaw".chromeprofile still resolves as extension-driver relay profile.defaultProfile: "chrome"remains honored.openclaw.Compatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
browser.defaultProfile: "chrome"in config.src/browser/constants.tssrc/browser/config.tssrc/browser/config.test.tsbrowser.defaultProfileis unset.Risks and Mitigations
chromedefault behavior may observe changed routing.browser.defaultProfile: "chrome"continues to force legacy behavior.