@@ -1298,6 +1298,19 @@ describe("browser tool url alias support", () => {
12981298 expect ( opts . profile ) . toBeUndefined ( ) ;
12991299 } ) ;
13001300
1301+ it ( "rejects embedded credentials before opening a tab" , async ( ) => {
1302+ const tool = createBrowserTool ( ) ;
1303+ await expect (
1304+ tool . execute ?.( "call-1" , {
1305+ action : "open" ,
1306+ url :
"https://user:[email protected] /path" , 1307+ } ) ,
1308+ ) . rejects . toThrow ( "embedded credentials" ) ;
1309+
1310+ expect ( browserClientMocks . browserOpenTab ) . not . toHaveBeenCalled ( ) ;
1311+ expect ( gatewayMocks . callGatewayTool ) . not . toHaveBeenCalled ( ) ;
1312+ } ) ;
1313+
13011314 it ( "tracks opened tabs when session context is available" , async ( ) => {
13021315 browserClientMocks . browserOpenTab . mockResolvedValueOnce ( {
13031316 targetId : "tab-123" ,
@@ -1354,6 +1367,20 @@ describe("browser tool url alias support", () => {
13541367 expect ( request . profile ) . toBeUndefined ( ) ;
13551368 } ) ;
13561369
1370+ it ( "rejects embedded credentials before navigating a tab" , async ( ) => {
1371+ const tool = createBrowserTool ( ) ;
1372+ await expect (
1373+ tool . execute ?.( "call-1" , {
1374+ action : "navigate" ,
1375+ url :
"https://user:[email protected] /path" , 1376+ targetId : "tab-1" ,
1377+ } ) ,
1378+ ) . rejects . toThrow ( "embedded credentials" ) ;
1379+
1380+ expect ( browserActionsMocks . browserNavigate ) . not . toHaveBeenCalled ( ) ;
1381+ expect ( gatewayMocks . callGatewayTool ) . not . toHaveBeenCalled ( ) ;
1382+ } ) ;
1383+
13571384 it ( "keeps targetUrl required error label when both params are missing" , async ( ) => {
13581385 const tool = createBrowserTool ( ) ;
13591386
0 commit comments