mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-11 13:51:10 -07:00
feat(core): integrate SandboxManager to sandbox all process-spawning tools (#22231)
This commit is contained in:
@@ -45,6 +45,7 @@ import { initializeShellParsers } from '../utils/shell-utils.js';
|
||||
import { ShellTool, OUTPUT_UPDATE_INTERVAL_MS } from './shell.js';
|
||||
import { debugLogger } from '../index.js';
|
||||
import { type Config } from '../config/config.js';
|
||||
import { NoopSandboxManager } from '../services/sandboxManager.js';
|
||||
import {
|
||||
type ShellExecutionResult,
|
||||
type ShellOutputEvent,
|
||||
@@ -137,6 +138,7 @@ describe('ShellTool', () => {
|
||||
getEnableInteractiveShell: vi.fn().mockReturnValue(false),
|
||||
getEnableShellOutputEfficiency: vi.fn().mockReturnValue(true),
|
||||
sanitizationConfig: {},
|
||||
sandboxManager: new NoopSandboxManager(),
|
||||
} as unknown as Config;
|
||||
|
||||
const bus = createMockMessageBus();
|
||||
@@ -281,7 +283,11 @@ describe('ShellTool', () => {
|
||||
expect.any(Function),
|
||||
expect.any(AbortSignal),
|
||||
false,
|
||||
{ pager: 'cat', sanitizationConfig: {} },
|
||||
expect.objectContaining({
|
||||
pager: 'cat',
|
||||
sanitizationConfig: {},
|
||||
sandboxManager: expect.any(Object),
|
||||
}),
|
||||
);
|
||||
expect(result.llmContent).toContain('Background PIDs: 54322');
|
||||
// The file should be deleted by the tool
|
||||
@@ -306,7 +312,11 @@ describe('ShellTool', () => {
|
||||
expect.any(Function),
|
||||
expect.any(AbortSignal),
|
||||
false,
|
||||
{ pager: 'cat', sanitizationConfig: {} },
|
||||
expect.objectContaining({
|
||||
pager: 'cat',
|
||||
sanitizationConfig: {},
|
||||
sandboxManager: expect.any(Object),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -327,7 +337,11 @@ describe('ShellTool', () => {
|
||||
expect.any(Function),
|
||||
expect.any(AbortSignal),
|
||||
false,
|
||||
{ pager: 'cat', sanitizationConfig: {} },
|
||||
expect.objectContaining({
|
||||
pager: 'cat',
|
||||
sanitizationConfig: {},
|
||||
sandboxManager: expect.any(Object),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -373,7 +387,11 @@ describe('ShellTool', () => {
|
||||
expect.any(Function),
|
||||
expect.any(AbortSignal),
|
||||
false,
|
||||
{ pager: 'cat', sanitizationConfig: {} },
|
||||
{
|
||||
pager: 'cat',
|
||||
sanitizationConfig: {},
|
||||
sandboxManager: new NoopSandboxManager(),
|
||||
},
|
||||
);
|
||||
},
|
||||
20000,
|
||||
|
||||
Reference in New Issue
Block a user