Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

A guest's engine check tells only which engines are installed (#4259) (#3480)

0xken15f33177151c2a
diff --git a/cli/src/backendSocket.guest.spec.ts b/cli/src/backendSocket.guest.spec.ts
index 5e36dcd08..86350c68b 100644
--- a/cli/src/backendSocket.guest.spec.ts
+++ b/cli/src/backendSocket.guest.spec.ts
@@ -92,6 +92,34 @@ describe('a guest session', () => {
expect(askers).toEqual([expect.objectContaining({ owner: true })])
})
+ // A guest starts its own agents on its own sign-in: it needs which engines are installed, never whether the owner
+ // is signed in to each or when the owner last used it (#4259, from #4216's security review).
+ it('learns which engines are installed, and nothing of the owner\'s sign-in or last use', async () => {
+ const probe = async (guest?: string) => {
+ const { socket, ask, answered } = session(guest)
+ const reads: unknown[] = []
+ socket.engineProbeProvider = async (_engines, options) => {
+ reads.push(options?.accounts === true)
+ return options?.accounts
+ ? [{ engine: 'claude', installed: true, command: 'claude', installable: false, signedIn: true, lastUsedAt: 1_794_000_000_000 }]
+ : [{ engine: 'claude', installed: true, command: 'claude', installable: false }]
+ }
+ await ask('engines_probe', { engines: ['claude'] })
+ await vi.waitFor(() => expect(answered().some((a) => a.type === 'engines_probe')).toBe(true))
+ const reply = answered().find((a) => a.type === 'engines_probe')!.payload as { engines: Array<Record<string, unknown>> }
+ return { readAccounts: reads, entry: reply.engines[0] }
+ }
+ const guest = await probe('[email protected]')
+ expect(guest.readAccounts).toEqual([false])
+ expect(guest.entry).toMatchObject({ engine: 'claude', installed: true })
+ expect(guest.entry).not.toHaveProperty('signedIn')
+ expect(guest.entry).not.toHaveProperty('lastUsedAt')
+ // The owner's own app still opens its New Harness box on the agent the owner uses.
+ const owner = await probe()
+ expect(owner.readAccounts).toEqual([true])
+ expect(owner.entry).toMatchObject({ signedIn: true, lastUsedAt: 1_794_000_000_000 })
+ })
+
it('manages none of the machine\'s pairings, and joins no trust group: the gateway refuses it', async () => {
const { ask, answered } = session('[email protected]')
await ask('e2ee_pairings_list')
diff --git a/cli/src/backendSocket.ts b/cli/src/backendSocket.ts
index 0db44cd78..cc7e69a26 100644
--- a/cli/src/backendSocket.ts
+++ b/cli/src/backendSocket.ts
@@ -1197,7 +1197,9 @@ export class BackendSocket {
// A full probe starts interactive login shells and is intentionally detached from this
// connection's ordered RPC chain. Request ids make its eventual reply safe to deliver out
// of order; keeping it awaited here made a Create click sit behind an unrelated sweep.
- void this.engineProbeProvider(asked && asked.length > 0 ? asked : undefined, { accounts: true })
+ // A guest starts agents on its own sign-in, so it needs only which engines are installed: the
+ // owner's sign-in and last use are never read for it (#4259, from #4216's security review).
+ void this.engineProbeProvider(asked && asked.length > 0 ? asked : undefined, { accounts: guest === undefined })
.then((availability) => reply(type, requestId, {
engines: availability.map((entry) => ({
engine: entry.engine,