Skip to content

Fix --browser path traversal; make --timeout govern per-action timeouts - #120

Open
ao-kamal wants to merge 2 commits into
SawyerHood:mainfrom
ao-kamal:ergo/security-and-timeout
Open

Fix --browser path traversal; make --timeout govern per-action timeouts#120
ao-kamal wants to merge 2 commits into
SawyerHood:mainfrom
ao-kamal:ergo/security-and-timeout

Conversation

@ao-kamal

Copy link
Copy Markdown

Two daemon fixes surfaced by a systematic agent-ergonomics review.

Security — --browser path traversal. A --browser name becomes a directory segment in the on-disk profile path (<baseDir>/<name>/chromium-profile) but was never validated, so --browser ../../../x escaped baseDir. Adds assertSafeBrowserName (mirroring the containment guard already in temp-files.ts), enforced at ensureBrowser/connectBrowser/launchBrowser.

--timeout didn't reach per-action timeouts. --timeout bounded only the QuickJS script clock; every Playwright action (goto/click/screenshot) kept its own fixed 30s default, so --timeout 90 still died at 30s mid-action. Propagates the script budget to context.setDefaultTimeout/setDefaultNavigationTimeout.

Both covered by new vitest tests; full daemon suite green.

ao-kamal and others added 2 commits July 12, 2026 14:52
A --browser name becomes a directory segment in the on-disk profile path
(<baseDir>/<name>/chromium-profile), but was never validated — so
`--browser ../../../x` escaped baseDir. Add assertSafeBrowserName (mirroring
temp-files.ts's containment guard) and call it at ensureBrowser, connectBrowser,
and launchBrowser before the name reaches path.join.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit ce0d5c8)
…P0-1)

The script-level --timeout budget bounded only the QuickJS script clock; every
Playwright action (goto/click/screenshot/snapshotForAI) kept its own fixed 30s
default, so `--timeout 90` still died at 30s mid-action — the costliest timeout
confusion in the field (32 incidents). Add BrowserManager.setDefaultTimeouts and
call it from the daemon's runScript with the script's remaining budget, so
per-action timeouts inherit --timeout. The script clock stays the real ceiling.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit d73652c)
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.

1 participant