Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Refuse driver self-config and whole-screen capture, and gate the browser tools

Fei24114b8be9feee56
diff --git a/ds-bot/src/host/computer/catalog.js b/ds-bot/src/host/computer/catalog.js
index c812f3cd..5e5d9b29 100644
--- a/ds-bot/src/host/computer/catalog.js
+++ b/ds-bot/src/host/computer/catalog.js
@@ -70,10 +70,17 @@ export const DRIVER_GLOBAL = new Set([
'list_apps', 'list_windows', 'get_screen_size', 'get_cursor_position',
'get_config', 'set_config', 'check_permissions', 'health_report',
'get_session', 'list_sessions', 'get_session_state', 'get_recording_state',
- 'get_agent_cursor_state', 'get_browser_state', 'install_ffmpeg',
+ 'get_agent_cursor_state',
'start_session', 'end_session',
])
+// Refused at every level: a Bot must not reconfigure the driver, and whole-screen
+// capture/replay bypasses per-app consent and the protected list. The session
+// lifecycle and the list/permission/health tools stay.
+export const DRIVER_REFUSED = new Set([
+ 'set_config', 'start_recording', 'stop_recording', 'replay_trajectory', 'install_ffmpeg',
+])
+
// The kind a level admits. 'off' sees nothing.
export const LEVELS = ['off', 'view', 'background', 'foreground']
export function levelAllows(level, kind) {
diff --git a/ds-bot/src/host/computer/index.js b/ds-bot/src/host/computer/index.js
index 6ae0de3b..5906e140 100644
--- a/ds-bot/src/host/computer/index.js
+++ b/ds-bot/src/host/computer/index.js
@@ -6,7 +6,7 @@ import { randomUUID } from 'node:crypto'
import { createUserMessage } from '@deepseek-ai/dsh-llm'
import { defineTool } from '@deepseek-ai/dsh-tools'
import { LEGACY_EXECUTABLES, LEGACY_NAME } from '../legacy.mjs'
-import { classify, isComputerTool, levelAllows, LEVELS, DRIVER_GLOBAL } from './catalog.js'
+import { classify, isComputerTool, levelAllows, LEVELS, DRIVER_GLOBAL, DRIVER_REFUSED } from './catalog.js'
import { createLeases } from './leases.js'
import { REPLY_KIND } from '../constants.js'
import { output } from '../tools.js'
@@ -534,8 +534,11 @@ export function install(rt) {
}
}
if (call.provider === 'cua-driver') {
+ if (DRIVER_REFUSED.has(call.method)) {
+ return { kind: 'deny', reason: `Bots may not use ${call.method}.` }
+ }
if (app === undefined) {
- if (!DRIVER_GLOBAL.has(call.method) && !call.method.startsWith('browser_')) {
+ if (!DRIVER_GLOBAL.has(call.method)) {
return { kind: 'deny', reason: 'Name the window from list_windows first.' }
}
} else if (app.unknown === true) {
diff --git a/ds-bot/test/computer.test.js b/ds-bot/test/computer.test.js
index c7d5c840..c4ead18c 100644
--- a/ds-bot/test/computer.test.js
+++ b/ds-bot/test/computer.test.js
@@ -832,3 +832,32 @@ test('same-named apps do not share an approval; a name-only consent still matche
const answer = await consent(question, async () => 'next')
assert.deepEqual(answer.answers[0].selected, ['Allow for this session'])
})
+
+test('browser tools need a resolvable target, and the driver-refused methods deny at every level', async (t) => {
+ const { ctx, home, rt } = setup()
+ t.after(async () => { await ctx.dispose(); rmSync(home, { recursive: true, force: true, maxRetries: 5 }) })
+ await rt.load()
+ await rt.computerEndpoint('set-enabled', { enabled: true })
+ await rt.computerEndpoint('set-level', { botId: 'w1', level: 'foreground' })
+ const gate = ctx.listeners.get('tools/pre-execute').find(fn => fn.name === 'computerGate')
+ const track = ctx.listeners.get('tools/execute').find(fn => fn.name === 'computerTrack')
+ const allow = async () => 'allowed'
+ const call = (name, args = {}) => gate({ name, arguments: args, agent: { id: 'w1' }, callId: `c-${name}` }, allow)
+ // the refused list denies at every level, before any consent or target work
+ for (const method of ['set_config', 'start_recording', 'stop_recording', 'replay_trajectory', 'install_ffmpeg']) {
+ const denied = await call(`cua_driver_native__${method}`, {})
+ assert.equal(denied.kind, 'deny', method)
+ assert.match(denied.reason, /may not use/, method)
+ }
+ // get_browser_state and the browser_* tools are no longer global: no target, no call
+ assert.match((await call('cua_driver_native__get_browser_state', {})).reason, /list_windows/)
+ assert.match((await call('cua_driver_native__browser_navigate', { url: 'https://example.com' })).reason, /list_windows/)
+ // with a recorded window they resolve their app and reach consent like any target
+ await track({ name: 'cua_driver_native__list_windows', arguments: {}, agent: { id: 'w1' }, callId: 'list-b' },
+ async () => ({ windows: [{ window_id: 5, pid: 44, name: 'Browser', path: '/Applications/Browser.app' }] }))
+ const pending = call('cua_driver_native__browser_navigate', { window_id: 5, url: 'https://example.com' })
+ await new Promise(resolve => setImmediate(resolve))
+ assert.equal(Object.keys(rt.computerLive().asks).length, 1)
+ await rt.computerEndpoint('app-answer', { id: Object.keys(rt.computerLive().asks)[0], answer: 'once' })
+ assert.equal(await pending, 'allowed')
+})