#11435: fix(security): validate OPENCLAW_BROWSER_CONTROL_MODULE before dynamic import
gateway
stale
## Fix Summary
Validate `OPENCLAW_BROWSER_CONTROL_MODULE` env var before passing to `import()`. Reject `data:`, `http:`, `https:`, and `node:` specifiers to prevent code injection via CWD `.env` files.
## Issue Linkage
Fixes #11434
## Security Snapshot
| Metric | Value |
|--------|-------|
| **Score** | 9.6 / 10.0 |
| **Severity** | Critical |
## Implementation Details
### Files Changed
- `src/gateway/server-browser.ts` (+12/-1)
### Technical Analysis
Validate `OPENCLAW_BROWSER_CONTROL_MODULE` env var before passing to `import()`. Reject `data:`, `http:`, `https:`, and `node:` specifiers to prevent code injection via CWD `.env` files.
## Validation Evidence
- Command: `N/A`
- Status: failed
## Risk and Compatibility
non-breaking; compatibility impact was not explicitly documented in the original PR body.
## AI-Assisted Disclosure
- AI-assisted: yes
- Model: Claude Code
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds validation around the `OPENCLAW_BROWSER_CONTROL_MODULE` env var before it’s used as a dynamic `import()` specifier in `startBrowserControlServerIfEnabled()`, rejecting a set of URL-like schemes (`data:`, `http:`, `https:`, `node:`) to mitigate code injection via local `.env` overrides. The rest of the gateway continues to lazily load the default browser control module when no override is provided.
<h3>Confidence Score: 4/5</h3>
- Mostly safe to merge once the scheme validation can’t be trivially bypassed.
- Change is small and localized, and callers already catch startup failures; however the new security check is currently case-sensitive, which can allow disallowed schemes through depending on specifier parsing semantics.
- src/gateway/server-browser.ts
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#23364: Gateway: add risk-ack interlock for dangerous Control UI flags
by bmendonca3 · 2026-02-22
78.8%
#11439: fix(security): warn on relative OPENCLAW_CONFIG_PATH and disable co...
by coygeek · 2026-02-07
78.0%
#21119: Security/Browser: fail closed when control server has no auth
by bmendonca3 · 2026-02-19
77.8%
#8124: fix(browser): add path validation for file upload and download
by yubrew · 2026-02-03
77.4%
#21326: Security/UI: harden Control UI gatewayUrl URL overrides
by bmendonca3 · 2026-02-19
76.8%
#21100: Security/Gateway: require explicit break-glass env for Control UI b...
by bmendonca3 · 2026-02-19
76.6%
#21120: Security/Gateway: guard dangerous HTTP /tools/invoke re-enables
by bmendonca3 · 2026-02-19
76.3%
#14197: fix(security): harden browser API auth, token comparisons, and hook...
by leecarollyn-gif · 2026-02-11
76.2%
#8517: Browser: sandbox download/trace paths
by coygeek · 2026-02-04
76.2%
#20089: fix(gateway): preserve control-ui scopes when dangerouslyDisableDev...
by vashkartik · 2026-02-18
75.4%