fix(browser): check fs access in builtin commands [backport to v4]#10680
Merged
sheremet-va merged 6 commits intoJul 1, 2026
Conversation
…cess [backport to v4] Provider commands dispatched through `triggerCommand` (takeScreenshot, stopChunkTrace, deleteTracing, screenshotMatcher writes, and file upload) bypassed the `allowWrite` permission gate and Vite's `server.fs` path validation. Add shared `assertBrowserApiWrite`/`assertBrowserFileAccess` helpers, apply them to those commands, reuse them from the `fs` commands, and cover the gates with browser tests. Co-authored-by: OpenCode (claude-opus-4-8) <[email protected]>
These tests run against a single project, so keying the error tree by project name made the snapshot provider-dependent (chromium vs chrome). Use `errorTree()` without `project` for provider-agnostic snapshots. Co-authored-by: OpenCode (claude-opus-4-8) <[email protected]>
…rt to v4] `annotateTraces` recorded a client-supplied trace path as an attachment without any gate, and `onTaskArtifactRecord` only stripped attachments when `allowWrite` was false — neither confined the path. Since attachments are copied into `attachmentsDir`, an arbitrary path (e.g. `/etc/passwd`) could be disclosed. Gate `annotateTraces` like the other trace commands and add `checkFileAccess` for attachment paths in `onTaskArtifactRecord`. Co-authored-by: OpenCode (claude-opus-4-8) <[email protected]>
hi-ogawa
marked this pull request as ready for review
June 30, 2026 08:41
sheremet-va
previously approved these changes
Jun 30, 2026
Member
|
playwright test on windows is failing, is this expected? |
…port to v4] `path.resolve(root, "/test-file.txt")` prepends the current drive and uses backslashes on Windows, which changed the "Cannot modify file" message and broke the cross-platform command-permission test. Restore the upstream ordering so the raw client path is passed to the write check while the resolved path is still used for the fs-access check. Co-authored-by: OpenCode (claude-opus-4-8) <[email protected]>
…4' into fix/browser-command-write-gate-v4
Member
|
I think rolldown failure is an actual bug, but not from your changes 🤔 |
sheremet-va
approved these changes
Jul 1, 2026
This was referenced Jul 10, 2026
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.
Description
This is mostly same diff as original.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.