Skip to content

fix(browser): harden browser control override loading#62663

Merged
drobison00 merged 5 commits into
openclaw:mainfrom
eleqtrizit:355
Apr 8, 2026
Merged

fix(browser): harden browser control override loading#62663
drobison00 merged 5 commits into
openclaw:mainfrom
eleqtrizit:355

Conversation

@eleqtrizit

@eleqtrizit eleqtrizit commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Hardens browser control override loading so untrusted workspace .env files cannot inject browser override module settings
  • Keeps the extension oxlint lanes deterministic on clean checkouts when the Plugin SDK declaration artifacts have not been generated yet

Changes

  • Blocked OPENCLAW_BROWSER_CONTROL_MODULE and OPENCLAW_SKIP_BROWSER_CONTROL_SERVER from workspace .env loading
  • Added optional override-specifier validation to startLazyPluginServiceModule() and used it for the browser plugin service to reject unsafe URL-style specifiers
  • Added regression tests for workspace .env blocking, lazy override validation, and the browser plugin service validator
  • Regenerated the Plugin SDK API baseline hash for the added optional loader parameter
  • Updated the extension oxlint wrapper to prepare Plugin SDK boundary artifacts before linting extension trees on a clean checkout

Validation

  • Ran corepack pnpm test src/infra/dotenv.test.ts src/plugins/lazy-service-module.test.ts extensions/browser/src/plugin-service.test.ts
  • Ran corepack pnpm format
  • Ran corepack pnpm build
  • Ran corepack pnpm plugin-sdk:api:gen
  • Ran corepack pnpm tsgo
  • Ran rm -rf dist/plugin-sdk packages/plugin-sdk/dist && corepack pnpm lint:extensions:channels
  • Ran corepack pnpm lint:extensions:bundled
  • Attempted local Claude review before PR creation; the /review flow requested an existing PR selection instead of reviewing the local diff

Notes

  • This keeps trusted explicit overrides working for supported local module specifiers while rejecting the unsafe URL-style override forms used by the repro path
  • Earlier closed work on this topic was reviewed for approach, but this PR uses the current loader structure and test layout on main

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S maintainer Maintainer-authored PR labels Apr 7, 2026
@greptile-apps

greptile-apps Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR hardens browser control override loading through two complementary layers: blocking OPENCLAW_BROWSER_CONTROL_MODULE and OPENCLAW_SKIP_BROWSER_CONTROL_SERVER from untrusted workspace .env files, and adding optional specifier validation to startLazyPluginServiceModule() with a regex-based validator in the browser plugin service that rejects URL-style override specifiers. A third change ensures Plugin SDK boundary artifacts are prepared before extension oxlint runs on clean checkouts. Test coverage is thorough across all three surfaces.

Confidence Score: 5/5

Safe to merge; the dotenv-level block is the primary defense and is correctly implemented.

All remaining findings are P2. The only gap is the missing file: scheme in the validator regex, which is a defense-in-depth completeness issue rather than an exploitable weakness given the dotenv-level guard already in place. The core logic, test coverage, and script changes are correct.

extensions/browser/src/plugin-service.ts — consider adding file: to the UNSAFE_BROWSER_CONTROL_OVERRIDE_SPECIFIER regex for completeness.

Vulnerabilities

  • The two-layer defense (dotenv blocklist + specifier validator) correctly addresses the workspace .env injection threat for OPENCLAW_BROWSER_CONTROL_MODULE.
  • The validator regex omits the file: URL scheme, which is a valid Node.js ESM import form. Since the dotenv block is the primary guard and file: requires write access to the local filesystem plus the ability to set a trusted env var, this is low-risk in practice but worth noting for completeness.
  • No credential exposure, secrets leakage, or injection vulnerabilities introduced.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/browser/src/plugin-service.ts
Line: 8

Comment:
**`file:` URL not blocked by override validator**

The regex blocks `data:`, `http:`, `https:`, and `node:` schemes but omits `file:`. A `file:///attacker/module.js` specifier passes the validator and is a valid ESM import in Node.js. The dotenv-level block is the primary guard (already in place), so this is defense-in-depth only — but since the intent is to reject "URL-style specifiers", `file:` fits the same threat model as the others.

```suggestion
const UNSAFE_BROWSER_CONTROL_OVERRIDE_SPECIFIER = /^(?:data|file|http|https|node):/i;
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (2): Last reviewed commit: "fix(lint): prepare boundary artifacts fo..." | Re-trigger Greptile

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Apr 7, 2026
@eleqtrizit

Copy link
Copy Markdown
Contributor Author

@greptile review

@eleqtrizit

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@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: 3cb88918e6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread scripts/lib/run-extension-oxlint.mjs Outdated
@openclaw-barnacle openclaw-barnacle Bot removed the scripts Repository scripts label Apr 8, 2026
@drobison00
drobison00 merged commit dafcaf9 into openclaw:main Apr 8, 2026
8 checks passed
mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Apr 8, 2026
* main: (522 commits)
  fix(browser): re-check interaction-driven navigations (openclaw#63226)
  test: reuse verbose directive reply imports
  test: reuse exec directive reply imports
  fix(browser): harden browser control override loading (openclaw#62663)
  Matrix: report startup failures as errors
  auth: persist explicit profile upserts directly
  test(doctor): mock memory-core runtime seam
  auth: avoid external cli sync on profile upsert
  feat: parallelize character eval runs
  fix: load QA live provider overrides
  build: stage nostr runtime dependencies
  fix(dotenv): block workspace runtime env vars (openclaw#62660)
  build: narrow plugin SDK declaration build
  test: harden Parallels macOS smoke fallback
  fix(memory): accept embedded dreaming heartbeat tokens
  test: harden provider mock isolation
  docs(config): tighten wording in reference
  test: reuse followup runner imports
  test: reuse image generate tool imports
  Align remote node exec event system messages with untrusted handling (openclaw#62659)
  ...
eleqtrizit added a commit that referenced this pull request Apr 8, 2026
* fix(browser): harden browser control overrides

* fix(lint): prepare boundary artifacts for extension oxlint

* docs(changelog): add browser override hardening entry

* fix(lint): avoid duplicate boundary prep

---------

Co-authored-by: Devin Robison <[email protected]>
Co-authored-by: Devin Robison <[email protected]>
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
* fix(browser): harden browser control overrides

* fix(lint): prepare boundary artifacts for extension oxlint

* docs(changelog): add browser override hardening entry

* fix(lint): avoid duplicate boundary prep

---------

Co-authored-by: Devin Robison <[email protected]>
Co-authored-by: Devin Robison <[email protected]>
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* fix(browser): harden browser control overrides

* fix(lint): prepare boundary artifacts for extension oxlint

* docs(changelog): add browser override hardening entry

* fix(lint): avoid duplicate boundary prep

---------

Co-authored-by: Devin Robison <[email protected]>
Co-authored-by: Devin Robison <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
* fix(browser): harden browser control overrides

* fix(lint): prepare boundary artifacts for extension oxlint

* docs(changelog): add browser override hardening entry

* fix(lint): avoid duplicate boundary prep

---------

Co-authored-by: Devin Robison <[email protected]>
Co-authored-by: Devin Robison <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* fix(browser): harden browser control overrides

* fix(lint): prepare boundary artifacts for extension oxlint

* docs(changelog): add browser override hardening entry

* fix(lint): avoid duplicate boundary prep

---------

Co-authored-by: Devin Robison <[email protected]>
Co-authored-by: Devin Robison <[email protected]>
@eleqtrizit
eleqtrizit deleted the 355 branch June 30, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants