File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed
src/vs/workbench/contrib/terminalContrib/chatAgentTools/common Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -160,17 +160,10 @@ export class TerminalSandboxService extends Disposable implements ITerminalSandb
160160 : { } ;
161161 const configFileUri = URI . joinPath ( this . _tempDir , `vscode-sandbox-settings-${ this . _sandboxSettingsId } .json` ) ;
162162
163- const allowedDomainsSet = new Set ( networkSetting . allowedDomains ?? [ ] ) ;
163+ let allowedDomains = networkSetting . allowedDomains ?? [ ] ;
164164 if ( networkSetting . allowTrustedDomains ) {
165- for ( const domain of this . _trustedDomainService . trustedDomains ) {
166- // Filter out sole wildcard '*' as sandbox runtime doesn't allow it
167- // Wildcards like '*.github.com' are OK
168- if ( domain !== '*' ) {
169- allowedDomainsSet . add ( domain ) ;
170- }
171- }
165+ allowedDomains = this . _addTrustedDomainsToAllowedDomains ( allowedDomains ) ;
172166 }
173- const allowedDomains = Array . from ( allowedDomainsSet ) ;
174167
175168 const sandboxSettings = {
176169 network : {
@@ -211,4 +204,19 @@ export class TerminalSandboxService extends Disposable implements ITerminalSandb
211204 }
212205 }
213206 }
207+
208+ private _addTrustedDomainsToAllowedDomains ( allowedDomains : string [ ] ) : string [ ] {
209+ const allowedDomainsSet = new Set ( allowedDomains ) ;
210+ for ( const domain of this . _trustedDomainService . trustedDomains ) {
211+ try {
212+ const uri = new URL ( domain ) ;
213+ allowedDomainsSet . add ( uri . hostname ) ;
214+ } catch {
215+ if ( domain !== '*' ) {
216+ allowedDomainsSet . add ( domain ) ;
217+ }
218+ }
219+ }
220+ return Array . from ( allowedDomainsSet ) ;
221+ }
214222}
You can’t perform that action at this time.
0 commit comments