fix(browser): check fs access in builtin commands#10674
Merged
sheremet-va merged 10 commits intoJul 1, 2026
Conversation
…cess 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, and reuse them from the existing `fs` commands so all file-touching commands share one gate. Co-authored-by: OpenCode (claude-opus-4-8) <[email protected]>
Add browser tests asserting that `upload` and `takeScreenshot` are blocked when the target file is denied via `server.fs.deny`, and that `takeScreenshot` is blocked when `allowWrite` is disabled. Normalize the project root in `errorTree` messages so the assertions are deterministic. Co-authored-by: OpenCode (claude-opus-4-8) <[email protected]>
`screenshot` defaults `save` to `true`, so the explicit option is unnecessary. Co-authored-by: OpenCode (claude-opus-4-8) <[email protected]>
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
A screenshot writes a PNG, so deny/target a `.png` path rather than a `.txt`, which also avoids relying on Playwright's mime rejection. Co-authored-by: OpenCode (claude-opus-4-8) <[email protected]>
This was referenced Jun 30, 2026
…-write-gate # Conflicts: # packages/browser-webdriverio/src/commands/screenshot.ts # packages/browser-webdriverio/src/commands/upload.ts
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]>
`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
Member
|
Windows is failing: (Similar to v4 backport) |
`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]>
…into fix/browser-command-write-gate
Collaborator
Author
|
CI is fixed by preserving previous error message on main and v4. |
sheremet-va
approved these changes
Jul 1, 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
Resolves #issue-number
TODO
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:.