mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-03 09:50:40 -07:00
Enable network access in sandbox configuration (#24055)
This commit is contained in:
@@ -93,7 +93,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
expect(config).toEqual({
|
expect(config).toEqual({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
command: 'docker',
|
command: 'docker',
|
||||||
image: 'default/image',
|
image: 'default/image',
|
||||||
});
|
});
|
||||||
@@ -122,7 +122,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
expect(config).toEqual({
|
expect(config).toEqual({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
command: 'lxc',
|
command: 'lxc',
|
||||||
image: 'default/image',
|
image: 'default/image',
|
||||||
});
|
});
|
||||||
@@ -148,7 +148,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
expect(config).toEqual({
|
expect(config).toEqual({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
command: 'sandbox-exec',
|
command: 'sandbox-exec',
|
||||||
image: 'default/image',
|
image: 'default/image',
|
||||||
});
|
});
|
||||||
@@ -161,7 +161,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
expect(config).toEqual({
|
expect(config).toEqual({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
command: 'sandbox-exec',
|
command: 'sandbox-exec',
|
||||||
image: 'default/image',
|
image: 'default/image',
|
||||||
});
|
});
|
||||||
@@ -174,7 +174,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
expect(config).toEqual({
|
expect(config).toEqual({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
command: 'docker',
|
command: 'docker',
|
||||||
image: 'default/image',
|
image: 'default/image',
|
||||||
});
|
});
|
||||||
@@ -187,7 +187,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
expect(config).toEqual({
|
expect(config).toEqual({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
command: 'podman',
|
command: 'podman',
|
||||||
image: 'default/image',
|
image: 'default/image',
|
||||||
});
|
});
|
||||||
@@ -210,7 +210,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
expect(config).toEqual({
|
expect(config).toEqual({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
command: 'podman',
|
command: 'podman',
|
||||||
image: 'default/image',
|
image: 'default/image',
|
||||||
});
|
});
|
||||||
@@ -244,7 +244,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
expect(config).toEqual({
|
expect(config).toEqual({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
command: 'docker',
|
command: 'docker',
|
||||||
image: 'env/image',
|
image: 'env/image',
|
||||||
});
|
});
|
||||||
@@ -257,7 +257,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
expect(config).toEqual({
|
expect(config).toEqual({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
command: 'docker',
|
command: 'docker',
|
||||||
image: 'default/image',
|
image: 'default/image',
|
||||||
});
|
});
|
||||||
@@ -285,7 +285,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
expect(config).toEqual({
|
expect(config).toEqual({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
command: 'docker',
|
command: 'docker',
|
||||||
image: 'default/image',
|
image: 'default/image',
|
||||||
});
|
});
|
||||||
@@ -339,7 +339,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
command: 'podman',
|
command: 'podman',
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -356,7 +356,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
image: 'custom/image',
|
image: 'custom/image',
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -372,7 +372,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
sandbox: {
|
sandbox: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -388,7 +388,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
sandbox: {
|
sandbox: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowedPaths: ['/settings-path'],
|
allowedPaths: ['/settings-path'],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -410,7 +410,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
expect(config).toEqual({
|
expect(config).toEqual({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
command: 'runsc',
|
command: 'runsc',
|
||||||
image: 'default/image',
|
image: 'default/image',
|
||||||
});
|
});
|
||||||
@@ -425,7 +425,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
expect(config).toEqual({
|
expect(config).toEqual({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
command: 'runsc',
|
command: 'runsc',
|
||||||
image: 'default/image',
|
image: 'default/image',
|
||||||
});
|
});
|
||||||
@@ -442,7 +442,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
expect(config).toEqual({
|
expect(config).toEqual({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
command: 'runsc',
|
command: 'runsc',
|
||||||
image: 'default/image',
|
image: 'default/image',
|
||||||
});
|
});
|
||||||
@@ -460,7 +460,7 @@ describe('loadSandboxConfig', () => {
|
|||||||
expect(config).toEqual({
|
expect(config).toEqual({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowedPaths: [],
|
allowedPaths: [],
|
||||||
networkAccess: false,
|
networkAccess: true,
|
||||||
command: 'runsc',
|
command: 'runsc',
|
||||||
image: 'default/image',
|
image: 'default/image',
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ export async function loadSandboxConfig(
|
|||||||
|
|
||||||
let sandboxValue: boolean | string | null | undefined;
|
let sandboxValue: boolean | string | null | undefined;
|
||||||
let allowedPaths: string[] = [];
|
let allowedPaths: string[] = [];
|
||||||
let networkAccess = false;
|
let networkAccess = true;
|
||||||
let customImage: string | undefined;
|
let customImage: string | undefined;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -142,7 +142,7 @@ export async function loadSandboxConfig(
|
|||||||
const config = sandboxOption;
|
const config = sandboxOption;
|
||||||
sandboxValue = config.enabled ? (config.command ?? true) : false;
|
sandboxValue = config.enabled ? (config.command ?? true) : false;
|
||||||
allowedPaths = config.allowedPaths ?? [];
|
allowedPaths = config.allowedPaths ?? [];
|
||||||
networkAccess = config.networkAccess ?? false;
|
networkAccess = config.networkAccess ?? true;
|
||||||
customImage = config.image;
|
customImage = config.image;
|
||||||
} else if (typeof sandboxOption !== 'object' || sandboxOption === null) {
|
} else if (typeof sandboxOption !== 'object' || sandboxOption === null) {
|
||||||
sandboxValue = sandboxOption;
|
sandboxValue = sandboxOption;
|
||||||
|
|||||||
Reference in New Issue
Block a user