Add terminal.integrated.allowInUntrustedWorkspace setting#287130
Add terminal.integrated.allowInUntrustedWorkspace setting#287130
Conversation
Co-authored-by: Tyriar <2193314+Tyriar@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a new setting terminal.integrated.allowInUntrustedWorkspace to allow users to bypass workspace trust checks when creating terminals, addressing the friction users face when they only need basic terminal functionality without requiring other trust-gated features.
Changes:
- Added new
AllowInUntrustedWorkspacesetting ID toTerminalSettingIdenum - Registered the setting in terminal configuration with appropriate security restrictions
- Modified
_trust()method to check the setting and bypass trust request when enabled
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vs/platform/terminal/common/terminal.ts | Added AllowInUntrustedWorkspace to the TerminalSettingId enum |
| src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts | Registered the new setting with restricted: true, comprehensive security warning, and false default value |
| src/vs/workbench/contrib/terminal/browser/terminalInstance.ts | Modified _trust() method to check setting and bypass workspace trust request when enabled, with logging |
| message: nls.localize('terminal.requestTrust', "Creating a terminal process requires executing code") | ||
| })) === true; | ||
| if (this._configurationService.getValue(TerminalSettingId.AllowInUntrustedWorkspace)) { | ||
| this._logService.info(`Workspace trust check bypassed due to ${TerminalSettingId.AllowInUntrustedWorkspace}`); |
There was a problem hiding this comment.
The log message should use the setting key's actual string value instead of interpolating the enum value. Consider using backticks around the setting ID for better readability, similar to other log messages in the codebase.
| this._logService.info(`Workspace trust check bypassed due to ${TerminalSettingId.AllowInUntrustedWorkspace}`); | |
| this._logService.info(`Workspace trust check bypassed due to \`${TerminalSettingId.AllowInUntrustedWorkspace}\``); |
| private async _trust(): Promise<boolean> { | ||
| return (await this._workspaceTrustRequestService.requestWorkspaceTrust( | ||
| { | ||
| message: nls.localize('terminal.requestTrust', "Creating a terminal process requires executing code") | ||
| })) === true; | ||
| if (this._configurationService.getValue(TerminalSettingId.AllowInUntrustedWorkspace)) { | ||
| this._logService.info(`Workspace trust check bypassed due to ${TerminalSettingId.AllowInUntrustedWorkspace}`); | ||
| return true; | ||
| } | ||
| const trustRequest = await this._workspaceTrustRequestService.requestWorkspaceTrust({ | ||
| message: nls.localize('terminal.requestTrust', "Creating a terminal process requires executing code") | ||
| }); | ||
| return trustRequest === true; | ||
| } |
There was a problem hiding this comment.
This new security-sensitive feature lacks test coverage. The _trust method should have tests verifying that when AllowInUntrustedWorkspace is enabled, the workspace trust check is bypassed, and when disabled, the trust request is made as expected. Given the security implications, comprehensive testing is important.
…ement-terminal Add terminal.integrated.allowInUntrustedWorkspace setting
Users are currently forced to grant workspace trust to use the terminal, even when they only need basic terminal functionality. This creates unnecessary security friction since the same trust privilege gates other higher-risk features like extension code execution.
Adds
terminal.integrated.allowInUntrustedWorkspacesetting to bypass the workspace trust check for terminal creation.TerminalSettingIdenum and registered in terminal configurationrestricted: trueso only user settings (not workspace settings) can enable it; defaults tofalse_trust()method interminalInstance.tsreturnstrueimmediately when setting is enabledWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
redirector.gvt1.com/proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --crashpad-handler-pid=6523 --enable-crash-reporter=4b8cc43a-e964-4161-b2ad-93b8cbb4e082,no_channel --user-data-dir=/tmp/vscode-tests-1768236639455 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,1767961354823271388,3107929433555519600,262144 --enable-features=PdfUseShowSaveFilePicker --disable-features=LocalNetworkAccessChecks,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TraceSiteInstanceGetProcessCreation --variations-seed-version --trace-process-track-uuid=3190708989122997041(dns block).build/electron/code-oss .build/electron/code-oss test/unit/electron/index.js --crash-reporter-directory=/home/REDACTED/work/vscode/vscode/.build/crashes --grep TerminalInstance --no-sandbox(dns block)/proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --crashpad-handler-pid=6885 --enable-crash-reporter=4b8cc43a-e964-4161-b2ad-93b8cbb4e082,no_channel --user-data-dir=/tmp/vscode-tests-1768236877242 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,7561926732789474700,10125450658317701606,262144 --enable-features=PdfUseShowSaveFilePicker --disable-features=LocalNetworkAccessChecks,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TraceSiteInstanceGetProcessCreation --variations-seed-version --trace-process-track-uuid=3190708989122997041(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.