Skip to content

Commit d3a81eb

Browse files
authored
improvement(desktop): sign-in prompts for the agent browser — site passwords, passkey accounts, client certificates, and app links (#9521)
* improvement(desktop): sign-in prompts for the agent browser — site passwords, passkey accounts, client certificates, and app links * fix(desktop): require an explicit accept for every sign-in prompt answer and arm prompts only while visible * fix(desktop): refuse window.open app links, gate every launch on a prompt-capable renderer, and keep page-raised prompts from taking focus * fix(desktop): clearing browsing data forgets the agent browser's certificate and app-launch choices
1 parent 4dd5ef3 commit d3a81eb

18 files changed

Lines changed: 2422 additions & 33 deletions

File tree

‎apps/desktop/build/entitlements.mac.plist‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,5 @@
1414
Hardened Runtime denies the camera no matter what the user allowed. -->
1515
<key>com.apple.security.device.camera</key>
1616
<true/>
17-
<!-- WebAuthn hybrid transport (passkey on the user's phone via QR) rides
18-
Bluetooth proximity; without this the QR option silently never
19-
completes in signed builds. -->
20-
<key>com.apple.security.device.bluetooth</key>
21-
<true/>
2217
</dict>
2318
</plist>

‎apps/desktop/e2e/browser-sign-in-prompts.spec.ts‎

Lines changed: 560 additions & 0 deletions
Large diffs are not rendered by default.

‎apps/desktop/electron-builder.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ mac:
7272
NSScreenCaptureUsageDescription: Mothership captures approved app windows to understand and verify computer-use actions.
7373
NSMicrophoneUsageDescription: Sim uses your microphone for voice input in Chat and for meetings you join in the built-in browser.
7474
NSCameraUsageDescription: Sim uses your camera for meetings you join in the built-in browser, such as Google Meet.
75-
NSBluetoothAlwaysUsageDescription: Sim uses Bluetooth to complete passkey sign-ins with a nearby phone in the built-in browser.
7675
entitlements: build/entitlements.mac.plist
7776
entitlementsInherit: build/entitlements.mac.plist
7877
notarize: true

‎apps/desktop/src/main/browser-agent/driver.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ import {
8181
setFocusedInputValue,
8282
typeIntoElement,
8383
} from '@/main/browser-agent/page-functions'
84+
import {
85+
appLaunchNoticeForContents,
86+
pagePromptForContents,
87+
respondToPagePrompt,
88+
} from '@/main/browser-agent/page-prompts'
8489
import { isPanelVisible, panelWindow } from '@/main/browser-agent/panel'
8590
import {
8691
withFailedPostActionObservation,
@@ -560,6 +565,8 @@ function pageStateFor(contents: WebContents, tabId: string): BrowserPageState {
560565
const issue = session.pageIssueForContents(contents)
561566
const mediaPermissionRequest = session.mediaPermissionRequestForContents(contents)
562567
const dialog = session.pageDialogForContents(contents)
568+
const prompt = pagePromptForContents(contents)
569+
const appLaunchNotice = appLaunchNoticeForContents(contents)
563570
return {
564571
scopeId: session.getBrowserScopeId(),
565572
tabId,
@@ -571,6 +578,8 @@ function pageStateFor(contents: WebContents, tabId: string): BrowserPageState {
571578
...(issue ? { issue } : {}),
572579
...(mediaPermissionRequest ? { mediaPermissionRequest } : {}),
573580
...(dialog ? { dialog } : {}),
581+
...(prompt ? { prompt } : {}),
582+
...(appLaunchNotice ? { appLaunchNotice } : {}),
574583
}
575584
}
576585

@@ -809,6 +818,7 @@ export function initDriver(
809818
})
810819
},
811820
onDownloadsChanged: (state) => callbacks.onDownloadsChanged?.(state),
821+
onAgentNotice: recordNotice,
812822
},
813823
getMainWindow,
814824
persistence,
@@ -5505,6 +5515,11 @@ export async function handlePanelAction(
55055515
}
55065516
if (action.action === 'enable-page-dialogs') {
55075517
session.enablePageDialogs()
5518+
if (action.pagePrompts === true) session.enablePagePrompts()
5519+
return
5520+
}
5521+
if (action.action === 'respond-prompt') {
5522+
respondToPagePrompt(session.getBrowserScopeId(), action)
55085523
return
55095524
}
55105525
if (action.action === 'respond-dialog') {

0 commit comments

Comments
 (0)