Skip to content

A browser binary path's file name is read per its own path form - #1449

Merged
nedtwigg merged 2 commits into
mainfrom
audit-s168-posix-filename
Oct 30, 2026
Merged

nedtwigg merged 2 commits into
mainfrom
audit-s168-posix-filename

Conversation

@nedtwigg

Copy link
Copy Markdown
Member

The browser-provider executable gate (isAllowedBrowserBinary in dor-lib-common/src/browser-providers.ts) took a candidate's file name as the last segment after splitting on both / and \. On macOS and Linux a backslash is an ordinary file-name character, so a path like /r/x\agent-browser, whose file is literally named x\agent-browser, read as agent-browser and passed the provider-filename check.

Now each path form splits on its own separators:

  • a POSIX-absolute path (leading /) splits on / only, so its file name is what follows the last /;
  • a drive path (C:\ or C:/) keeps splitting on both.

The .. check sees the same segments, so a \..\ inside a POSIX path is part of a file name, as the OS reads it. There is no platform check, because the same gate runs in the webview, dor, and both hosts.

Tests in lib/src/lib/agent-browser-binary.test.ts: /r/x\agent-browser and /r/x\playwright-cli are refused, a drive path with .. between backslashes is refused, and a drive path that mixes separators is still accepted. Both refusing cases fail with the old split restored.

🤖 Generated with Claude Code

The browser-provider executable gate took a candidate's file name as the
last segment after splitting on both `/` and `\`. On macOS and Linux a
backslash is an ordinary file-name character, so `/r/x\agent-browser` (a
file literally named `x\agent-browser`) passed the provider-filename check.

Rule chosen: a POSIX-absolute path (leading `/`) splits on `/` only, and a
drive path (`C:\` or `C:/`) keeps splitting on both. That is how each
platform itself reads the path, so the file name and the `..` check now
see the same segments the OS does: a `\..\` inside a POSIX path is part of
a file name, not a parent step. No platform check, since the same gate runs
in the webview, `dor`, and both hosts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 17e19a6
Status: ✅  Deploy successful!
Preview URL: https://47c347d4.mouseterm.pages.dev
Branch Preview URL: https://audit-s168-posix-filename.mouseterm.pages.dev

View logs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nedtwigg
nedtwigg merged commit 4cb2ae7 into main Oct 30, 2026
18 checks passed
@nedtwigg
nedtwigg deleted the audit-s168-posix-filename branch October 30, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants