@@ -427,6 +427,36 @@ suite('TerminalSandboxService - network domains', () => {
427427 strictEqual ( jsonResult . blockedDomains , undefined , 'File extensions such as .json should not be reported as domains' ) ;
428428 } ) ;
429429
430+ test ( 'should ignore bare dotted values with unknown domain suffixes' , async ( ) => {
431+ const sandboxService = store . add ( instantiationService . createInstance ( TerminalSandboxService ) ) ;
432+ await sandboxService . getSandboxConfigPath ( ) ;
433+
434+ const commands = [
435+ 'echo test.invalidtld' ,
436+ 'echo test.org.invalidtld' ,
437+ 'echo session.completed' ,
438+ ] ;
439+
440+ for ( const command of commands ) {
441+ const wrapResult = sandboxService . wrapCommand ( command , false , 'bash' ) ;
442+ strictEqual ( wrapResult . isSandboxWrapped , true , `Command ${ command } should remain sandboxed` ) ;
443+ strictEqual ( wrapResult . blockedDomains , undefined , `Command ${ command } should not report a blocked domain` ) ;
444+ }
445+ } ) ;
446+
447+ test ( 'should still detect bare hosts with well-known domain suffixes' , async ( ) => {
448+ const sandboxService = store . add ( instantiationService . createInstance ( TerminalSandboxService ) ) ;
449+ await sandboxService . getSandboxConfigPath ( ) ;
450+
451+ const testComResult = sandboxService . wrapCommand ( 'curl test.com' , false , 'bash' ) ;
452+ strictEqual ( testComResult . isSandboxWrapped , false , 'Well-known bare domain suffixes should trigger domain checks' ) ;
453+ deepStrictEqual ( testComResult . blockedDomains , [ 'test.com' ] ) ;
454+
455+ const testOrgComResult = sandboxService . wrapCommand ( 'curl test.org.com' , false , 'bash' ) ;
456+ strictEqual ( testOrgComResult . isSandboxWrapped , false , 'Well-known bare domain suffixes should trigger domain checks for multi-label hosts' ) ;
457+ deepStrictEqual ( testOrgComResult . blockedDomains , [ 'test.org.com' ] ) ;
458+ } ) ;
459+
430460 test ( 'should still treat URL authorities with file-like suffixes as domains' , async ( ) => {
431461 const sandboxService = store . add ( instantiationService . createInstance ( TerminalSandboxService ) ) ;
432462 await sandboxService . getSandboxConfigPath ( ) ;
@@ -437,6 +467,16 @@ suite('TerminalSandboxService - network domains', () => {
437467 deepStrictEqual ( wrapResult . blockedDomains , [ 'example.zip' ] ) ;
438468 } ) ;
439469
470+ test ( 'should still treat URL authorities with unknown suffixes as domains' , async ( ) => {
471+ const sandboxService = store . add ( instantiationService . createInstance ( TerminalSandboxService ) ) ;
472+ await sandboxService . getSandboxConfigPath ( ) ;
473+
474+ const wrapResult = sandboxService . wrapCommand ( 'curl https://example.bar/path' , false , 'bash' ) ;
475+
476+ strictEqual ( wrapResult . isSandboxWrapped , false , 'URL authorities should not require a well-known bare-host suffix' ) ;
477+ deepStrictEqual ( wrapResult . blockedDomains , [ 'example.bar' ] ) ;
478+ } ) ;
479+
440480 test ( 'should still treat ssh remotes with file-like suffixes as domains' , async ( ) => {
441481 const sandboxService = store . add ( instantiationService . createInstance ( TerminalSandboxService ) ) ;
442482 await sandboxService . getSandboxConfigPath ( ) ;
0 commit comments