Repository navigation
Conversation
WEBOPERATOR_ALLOW_UNAUTHENTICATED_BRIDGE defaulted to on (`!== '0'`), so a bridge started without WEBOPERATOR_API_TOKEN accepted every HTTP and socket call — the opposite of docs/api.md. Any local process, or a web page posting text/plain to 127.0.0.1:8765 (no CORS preflight), could drive the browser. The bridge now falls back to ~/.weboperator/bridge-token (0600, created on first start, linked into place atomically). mcp-server.js, agent-client.js and the live scripts read the same file, so MCP setups need no new config. Only WEBOPERATOR_ALLOW_UNAUTHENTICATED_BRIDGE=1 turns auth off. Token comparison is constant-time. install.sh creates the token and prints its path. bridge-smoke.mjs now starts a bridge with no token and no bypass and checks 401s (including a text/plain POST), the file's mode, and that the file token passes auth. It fails on the old default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
| assert.equal(noPreflight.status, 401); | ||
| const tokenFile = path.join(defaultHome, '.weboperator', 'bridge-token'); | ||
| assert.equal(statSync(tokenFile).mode & 0o777, 0o600); | ||
| const fileToken = readFileSync(tokenFile, 'utf8').trim(); |
| assert.equal(statSync(tokenFile).mode & 0o777, 0o600); | ||
| const fileToken = readFileSync(tokenFile, 'utf8').trim(); | ||
| assert.match(fileToken, /^[0-9a-f]{64}$/); | ||
| const withFileToken = await fetch(`${unauthBase}/v1/browser/snapshot`, { headers: { authorization: `Bearer ${fileToken}` } }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
The bridge no longer runs unauthenticated by default. Without
WEBOPERATOR_API_TOKENit uses a token in~/.weboperator/bridge-token(mode 0600, created on first start). The MCP server, the agent client and the live scripts read the same file, so MCP setups keep working with no new config.Why
WEBOPERATOR_ALLOW_UNAUTHENTICATED_BRIDGEwas read as!== '0', so the bypass was on unless explicitly disabled. That is the opposite ofdocs/api.md. With no token, any local process, or any web page sending atext/plainPOST to127.0.0.1:8765(a simple request, so no CORS preflight), could callbrowser_eval,cookies_getorweboperator_execute_goalagainst the user's logged-in browser.WEBOPERATOR_ALLOW_UNAUTHENTICATED_BRIDGE=1turns auth off now, for development.install.shcreates the token and prints its path, not the secret.Breaking for plain HTTP clients: curl or scripts against
/v1/*must now sendAuthorization: Bearer $(cat ~/.weboperator/bridge-token).How it was verified
./scripts/check.shpasses locally (419 unit tests, bridge and MCP smoke)bridge-smoke.mjsnow starts a bridge with no token and no bypass. It checks:authRequired: true;text/plainPOST;Against the old
bridge.jsthis test fails.Loaded
core/distin Chrome and ran the affected flow by hand: not done. The installed native host needsinstall.shre-run.Checklist
CHANGELOG.mdupdated underUnreleasedSecurity-sensitive areas
weboperator-bridgeparsing, binding, or authentication🤖 Generated with Claude Code