Enhance AI network access control for integrated browser - #328880
Draft
dmitrivMS wants to merge 1 commit into
Draft
Enhance AI network access control for integrated browser#328880dmitrivMS wants to merge 1 commit into
dmitrivMS wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR strengthens integrated-browser network policy enforcement across Electron requests, Playwright actions, screenshots, and page sharing.
Changes:
- Adds per-view request filtering and retained policy errors in Electron sessions.
- Validates frame URLs before and after Playwright/screenshot operations.
- Adds unit and extension-level coverage for denied frames, redirects, and allowed complex pages.
Show a summary per file
| File | Description |
|---|---|
src/vs/workbench/contrib/browserView/test/electron-browser/tools/screenshotBrowserTool.test.ts |
Tests screenshot policy checks and telemetry. |
src/vs/workbench/contrib/browserView/test/common/browserViewModelSharing.test.ts |
Tests sharing lifecycle and denied URLs. |
src/vs/workbench/contrib/browserView/electron-browser/tools/screenshotBrowserTool.ts |
Brackets screenshot capture with policy validation. |
src/vs/workbench/contrib/browserView/common/browserView.ts |
Exposes policy errors through the renderer model. |
src/vs/platform/browserView/test/node/playwrightTab.test.ts |
Tests frame and action policy enforcement. |
src/vs/platform/browserView/test/electron-main/browserViewNetworkFilter.test.ts |
Tests filtering-source lifecycle. |
src/vs/platform/browserView/test/electron-main/browserSessionNetworkFilter.test.ts |
Tests Electron request filtering behavior. |
src/vs/platform/browserView/node/playwrightTab.ts |
Applies policy checks to frames, actions, summaries, and logs. |
src/vs/platform/browserView/electron-main/browserViewMainService.ts |
Exposes main-process policy errors. |
src/vs/platform/browserView/electron-main/browserViewGroup.ts |
Toggles filtering with agent group membership. |
src/vs/platform/browserView/electron-main/browserViewAgentNetworkFilter.ts |
Tracks agent filtering sources. |
src/vs/platform/browserView/electron-main/browserView.ts |
Connects each native view to session filtering. |
src/vs/platform/browserView/electron-main/browserSessionNetworkFilter.ts |
Implements per-WebContents request filtering. |
src/vs/platform/browserView/electron-main/browserSession.ts |
Installs the Electron request interceptor. |
src/vs/platform/browserView/common/browserView.ts |
Adds the cross-process policy-error operation. |
extensions/vscode-api-tests/src/singlefolder-tests/browser.tools.test.ts |
Adds end-to-end browser-tool policy scenarios. |
Review details
- Files reviewed: 16/16 changed files
- Comments generated: 5
- Review effort level: Balanced
Comment on lines
275
to
+278
| override dispose(): void { | ||
| for (const view of this.views.values()) { | ||
| setBrowserViewGroupAgentNetworkFiltering(view, this.owner, false); | ||
| } |
Comment on lines
+40
to
+42
| if (webContentsId === undefined || !this.filteredWebContents.has(webContentsId)) { | ||
| callback({ cancel: false }); | ||
| return; |
Comment on lines
+228
to
230
| // When the current page or any frame is blocked by network policy, return only a | ||
| // policy error — do not expose title, URL, console logs, or snapshot to | ||
| // avoid prompt-injection via blocked content. |
Comment on lines
+54
to
+56
| const allowed = this.agentNetworkFilterService.isUriAllowed(uri); | ||
| if (!allowed) { | ||
| this.policyErrors.set(webContentsId, this.agentNetworkFilterService.formatError(uri)); |
| */ | ||
| getSelectedText(id: string): Promise<string>; | ||
|
|
||
| getNetworkPolicyError(id: string): Promise<string | undefined>; |
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.
No description provided.