Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 3, 2026, 10:08 PM ET / September 4, 2026, 02:08 UTC. ClawSweeper reviewWhat this changesThe PR passes inbound owner status to the browser tool, hides system-profile cookie import for known non-owners, and rejects those calls before routing. Merge readiness⛔ Blocked before merge - 3 items remain Keep open pending a Browser-owner policy decision. The patch correctly carries the trusted per-run owner fact into the browser plugin and blocks a known non-owner before browser routing; it deliberately removes an existing action from authorized non-owner runs, so the owner-only policy needs confirmation before merge. Priority: P2 Review scores
Verification
How this fits togetherThe Browser plugin exposes agent actions against managed browser profiles. System-profile import reads host browser cookies into a managed profile, while the plugin tool context carries the inbound sender’s trusted owner status. flowchart LR
A[Inbound sender] --> B[Agent tool context]
B --> C[Browser plugin]
C --> D[Owner-status action filter]
D --> E[Import profile request]
E --> F[Managed browser profile]
Decision needed
Why: This is a deliberate access-policy change for a cookie-import action, not a mechanical correctness question that source inspection can resolve. Before merge
Agent review detailsSecurityNone. PR surfaceSource +13, Tests +36. Total +49 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the small dual schema/runtime guard if the Browser owner confirms that system-profile cookie import is owner-only; otherwise preserve the existing authorized-sender behavior and close or redesign the proposal. Do we have a high-confidence way to reproduce the issue? Yes. The supplied before/after trace gives identical current-main and patched factory inputs for a known non-owner, and source confirms the base has no owner check while the patch rejects before routing. Is this the best way to solve the issue? Unclear pending policy confirmation. The implementation is the narrowest owner-boundary enforcement using an existing trusted context, but maintainers must choose whether owner-only is the intended authorization rule. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6b97bae2e157. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
The browser tool exposes action=importprofile to every run that gets the tool. The action copies decrypted cookies from a real Chrome-family system profile into a managed OpenClaw profile, but the tool never consulted the trusted owner bit that the plugin tool context already carries, so a non-owner inbound run could reach the import path. The macOS Keychain consent prompt remains the primary control and is deliberate. It is a one-time gate: once /usr/bin/security is allowed for the Safe Storage item, later reads are silent and no gate remains for an agent-generated call. Read ctx.senderIsOwner in the browser plugin registration, drop importprofile from the advertised actions when the sender is known not to be the owner, and refuse the action in the tool before it resolves any routing. Runs with no inbound sender context, such as the CLI and local operator runs, keep the current behavior.
261a100 to
5e18aca
Compare
|
Closing this implementation PR and moving the unresolved Browser-owner policy decision to #159827. This remains a defense-in-depth proposal, not a security-boundary bypass report. Current source still has no inbound-owner gate for agent importprofile; the follow-up preserves the compatibility tradeoff and attributes the original runtime evidence to its original commits. |
Summary
This is defense-in-depth hardening, not a security fix, and it is not required for any advisory. Prompt-injection-only chains are out of scope under
SECURITY.mdand authenticated Gateway callers are trusted operators, so nothing here claims a boundary bypass.The browser tool exposes
action=importprofileto every run that receives the tool. The action copies decrypted cookies from a real Chrome-family system profile into a managed OpenClaw profile. System profile import is enabled by default and the tool never consulted the trusted owner bit, so a non-owner inbound run could reach the import path.The macOS Keychain consent prompt is the existing control and it is deliberate (
system-chrome-cookies.tssays so, anddocs/cli/browser.mddocuments the prompt). The reason this is still worth closing is that the prompt is a one-time gate rather than a per-call one. Once a user approves/usr/bin/securityfor the Chrome Safe Storage item, which anyone who has runopenclaw browser import-profileorcookie-syncmay already have done, later reads are silent. From that point an agent-generated call has no remaining gate at all.Root cause
extensions/browser/plugin-registration.tsbuilds the browser tool fromOpenClawPluginToolContext, which already carriessenderIsOwner("Trusted owner bit from inbound context, runtime-provided, not tool args"). The browser extension never read it.senderIsOwnerappears in 381 files elsewhere in the repo and zero times underextensions/browser.extensions/browser/src/browser-tool.tspins the action to the host but never authorizes it:resolveBrowserToolCapabilitiesfilters actions by profile capability and byevaluateEnabled, but never by sender identity, soimportprofilewas advertised to every run.Fix
Read the bit that already exists, and apply it at the two points that already do this kind of filtering.
The guard is keyed on
senderIsOwner === false, matching the convention insrc/agents/agent-tools.ts(GATEWAY_OWNER_ONLY_CORE_TOOLSis applied only whenoptions?.senderIsOwner === false). Absent sender context stays allowed, so local operator runs and the CLI are unchanged.Why this is the right boundary
plugin-registration.tsis the single agent entry point intocreateBrowserTool; there is no sibling agent surface for this action. The CLI (registerBrowserCli) and the Gateway method reachimportSystemProfileCookiesthrough separate trusted-operator surfaces and are intentionally untouched, so the documentedopenclaw browser import-profileand macOS app workflows keep working. The guard sits before routing resolution because it is a policy decision on the action name alone and needs no config.Both layers are kept on purpose: the capability filter removes the action from the advertised schema so a non-owner run is never offered it, and the runtime guard is the actual enforcement. The guard is ordered before the capability check so the denial reports the owner requirement instead of the generic "unavailable for this run" message.
Functional tradeoff, called out explicitly: an agent run that the runtime marks as a known non-owner sender can no longer trigger cookie import. That is the intent of the change. Runs with no inbound sender context are unaffected.
Verification
node scripts/run-vitest.mjs extensions/browser/src/browser-tool.test.ts -t "importprofile owner gate": 4 passed.main: 2 failed (the non-owner refusal and the advertised-action filter), 2 passed (the owner and no-sender cases, which must not regress).node scripts/run-oxlint.mjson the 4 changed files: exit 0.oxfmt --checkon the 4 changed files: clean.node scripts/run-tsgo.mjs -p tsconfig.core.json: clean.oxfmt --checkwith the version this repo pins (0.65.0) on the 4 changed files: clean.run-tsgo -p test/tsconfig/tsconfig.core.test.json, and full build.Real behavior proof
Behavior addressed: a browser tool run whose inbound sender is known not to be the owner could invoke
action=importprofileand reach the system-profile cookie import path.Real environment tested: the real
createBrowserToolfactory and the realresolveBrowserToolCapabilities/createBrowserToolSchemafromextensions/browser, driven directly on pristine main6b97bae2e15and on the patched tree with identical inputs. The browser control service, the extension relay, the capability resolver, the tool schema builder and the import routing all stayed real. Nothing was stubbed; the only environmental substitution was pointingOPENCLAW_CONFIG_PATHat an empty config file so the run did not read the local operator config.Exact steps or command run after this patch: constructed the browser tool via
createBrowserTool({ senderIsOwner: false })andcreateBrowserTool({ senderIsOwner: true }), invokedexecute("call-1", { action: "importprofile", target: "host", into: "stolen", systemProfile: "Default" })on each, and separately printed theactionenum thatcreateBrowserToolSchemaemits for a non-owner run.Evidence after fix:
Observed result after fix: on pristine main the non-owner call and the owner call behaved identically, both penetrating into the import routine itself and failing only on the late managed-profile ownership check inside
system-profiles.ts. With the patch the non-owner call is refused up front and never reaches that routine, while the owner call still reaches it and fails at exactly the same later point as before, andimportprofiledisappears from the advertised action list for the non-owner run only. The owner and no-sender paths are unchanged.What was not tested: no real Keychain approval and no real cookie decryption were exercised, so the import was not carried through to a populated profile on either tree; the owner run was cut short by a deliberate 4 second abort once it had passed the gate. The macOS app import flow and the
cookie-syncpath were not driven. The full build and the core test typecheck lane were not run.