Skip to content

fix(mcp): validate file path in browser_set_storage_state tool#39881

Merged
yury-s merged 1 commit intomicrosoft:mainfrom
yury-s:fix-storage-state-path-validation
Mar 26, 2026
Merged

fix(mcp): validate file path in browser_set_storage_state tool#39881
yury-s merged 1 commit intomicrosoft:mainfrom
yury-s:fix-storage-state-path-validation

Conversation

@yury-s
Copy link
Copy Markdown
Member

@yury-s yury-s commented Mar 26, 2026

Summary

  • browser_set_storage_state was passing the LLM-supplied filename directly to browserContext.setStorageState() without any path validation, allowing reads from arbitrary paths outside the workspace
  • Fix resolves the filename through response.resolveClientFilename() which enforces the same checkFile() containment check used by all other file-access tools

@yury-s yury-s force-pushed the fix-storage-state-path-validation branch from 1583c83 to 0838a2a Compare March 26, 2026 18:49
@github-actions

This comment has been minimized.

@yury-s yury-s merged commit ae521dd into microsoft:main Mar 26, 2026
10 checks passed
@yury-s yury-s deleted the fix-storage-state-path-validation branch March 26, 2026 21:04
@github-actions
Copy link
Copy Markdown
Contributor

Test results for "tests 1"

1 failed
❌ [playwright-test] › ui-mode-test-network-tab.spec.ts:397 › should not preserve selection across test runs @macos-latest-node20

5 flaky ⚠️ [chromium-library] › library/video.spec.ts:358 › screencast › should capture navigation `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/trace-viewer.spec.ts:1223 › should display language-specific locators `@chromium-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1080 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-ubuntu-22.04-node20`
⚠️ [webkit-library] › library/screencast.spec.ts:75 › start reuses existing screencast when video recording is running `@webkit-ubuntu-22.04-node20`

38931 passed, 845 skipped


Merge workflow run.

@github-actions
Copy link
Copy Markdown
Contributor

Test results for "MCP"

5549 passed, 340 skipped


Merge workflow run.

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