Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion browse/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ function spawnClaude(userMessage: string, extensionUrl?: string | null, forTabId
// Never resume — each message is a fresh context. Resuming carries stale
// page URLs and old navigation state that makes the agent fight the user.
const args = ['-p', prompt, '--model', 'opus', '--output-format', 'stream-json', '--verbose',
'--allowedTools', 'Bash,Read,Glob,Grep'];
'--allowedTools', 'Bash,Read,Glob,Grep,Write'];

addChatEntry({ ts: new Date().toISOString(), role: 'agent', type: 'agent_start' });

Expand Down
10 changes: 10 additions & 0 deletions browse/test/sidebar-security.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ describe('Sidebar prompt injection defense', () => {
expect(SERVER_SRC).toContain('refuse');
});

// --- Allowed Tools (server + agent must stay in sync) ---

test('server allowedTools includes Write', () => {
// Write does not expand attack surface beyond Bash (which can already
// write files). The server args are the source of truth — if Write is
// missing here, the sidebar agent cannot use it even if the agent
// fallback includes it, because the server-provided args take precedence.
expect(SERVER_SRC).toContain("'--allowedTools', 'Bash,Read,Glob,Grep,Write'");
});

// --- Sidebar Agent Arg Plumbing ---

test('sidebar-agent uses queued args from server, not hardcoded', () => {
Expand Down