mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
feat: allow limited git writes in workspace sandbox
Co-authored-by: Codex noreply@openai.com
This commit is contained in:
committed by
David Wiesen
co-authored by
Codex noreply@openai.com
parent
a9c111da54
commit
5efa14eaa3
@@ -3039,6 +3039,10 @@
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"allowLimitedGitWrites": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"excludeSlashTmp": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
|
||||
+8
@@ -13465,6 +13465,10 @@
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"allowLimitedGitWrites": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"excludeSlashTmp": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
@@ -13512,6 +13516,10 @@
|
||||
},
|
||||
"SandboxWorkspaceWrite": {
|
||||
"properties": {
|
||||
"allow_limited_git_writes": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"exclude_slash_tmp": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
|
||||
+8
@@ -10180,6 +10180,10 @@
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"allowLimitedGitWrites": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"excludeSlashTmp": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
@@ -10227,6 +10231,10 @@
|
||||
},
|
||||
"SandboxWorkspaceWrite": {
|
||||
"properties": {
|
||||
"allow_limited_git_writes": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"exclude_slash_tmp": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
|
||||
@@ -424,6 +424,10 @@
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"allowLimitedGitWrites": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"excludeSlashTmp": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
|
||||
@@ -732,6 +732,10 @@
|
||||
},
|
||||
"SandboxWorkspaceWrite": {
|
||||
"properties": {
|
||||
"allow_limited_git_writes": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"exclude_slash_tmp": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
|
||||
@@ -1090,6 +1090,10 @@
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"allowLimitedGitWrites": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"excludeSlashTmp": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
|
||||
@@ -1090,6 +1090,10 @@
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"allowLimitedGitWrites": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"excludeSlashTmp": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
|
||||
@@ -1090,6 +1090,10 @@
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"allowLimitedGitWrites": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"excludeSlashTmp": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
|
||||
@@ -544,6 +544,10 @@
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"allowLimitedGitWrites": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"excludeSlashTmp": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
|
||||
@@ -5,4 +5,4 @@ import type { AbsolutePathBuf } from "../AbsolutePathBuf";
|
||||
import type { NetworkAccess } from "./NetworkAccess";
|
||||
import type { ReadOnlyAccess } from "./ReadOnlyAccess";
|
||||
|
||||
export type SandboxPolicy = { "type": "dangerFullAccess" } | { "type": "readOnly", access: ReadOnlyAccess, networkAccess: boolean, } | { "type": "externalSandbox", networkAccess: NetworkAccess, } | { "type": "workspaceWrite", writableRoots: Array<AbsolutePathBuf>, readOnlyAccess: ReadOnlyAccess, networkAccess: boolean, excludeTmpdirEnvVar: boolean, excludeSlashTmp: boolean, };
|
||||
export type SandboxPolicy = { "type": "dangerFullAccess" } | { "type": "readOnly", access: ReadOnlyAccess, networkAccess: boolean, } | { "type": "externalSandbox", networkAccess: NetworkAccess, } | { "type": "workspaceWrite", writableRoots: Array<AbsolutePathBuf>, readOnlyAccess: ReadOnlyAccess, networkAccess: boolean, allowLimitedGitWrites: boolean, excludeTmpdirEnvVar: boolean, excludeSlashTmp: boolean, };
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type SandboxWorkspaceWrite = { writable_roots: Array<string>, network_access: boolean, exclude_tmpdir_env_var: boolean, exclude_slash_tmp: boolean, };
|
||||
export type SandboxWorkspaceWrite = { writable_roots: Array<string>, network_access: boolean, allow_limited_git_writes: boolean, exclude_tmpdir_env_var: boolean, exclude_slash_tmp: boolean, };
|
||||
|
||||
@@ -234,6 +234,7 @@ pub struct SandboxSettings {
|
||||
#[serde(default)]
|
||||
pub writable_roots: Vec<AbsolutePathBuf>,
|
||||
pub network_access: Option<bool>,
|
||||
pub allow_limited_git_writes: Option<bool>,
|
||||
pub exclude_tmpdir_env_var: Option<bool>,
|
||||
pub exclude_slash_tmp: Option<bool>,
|
||||
}
|
||||
|
||||
@@ -646,6 +646,8 @@ pub struct SandboxWorkspaceWrite {
|
||||
#[serde(default)]
|
||||
pub network_access: bool,
|
||||
#[serde(default)]
|
||||
pub allow_limited_git_writes: bool,
|
||||
#[serde(default)]
|
||||
pub exclude_tmpdir_env_var: bool,
|
||||
#[serde(default)]
|
||||
pub exclude_slash_tmp: bool,
|
||||
@@ -1744,6 +1746,8 @@ pub enum SandboxPolicy {
|
||||
#[serde(default)]
|
||||
network_access: bool,
|
||||
#[serde(default)]
|
||||
allow_limited_git_writes: bool,
|
||||
#[serde(default)]
|
||||
exclude_tmpdir_env_var: bool,
|
||||
#[serde(default)]
|
||||
exclude_slash_tmp: bool,
|
||||
@@ -1775,12 +1779,14 @@ impl SandboxPolicy {
|
||||
writable_roots,
|
||||
read_only_access,
|
||||
network_access,
|
||||
allow_limited_git_writes,
|
||||
exclude_tmpdir_env_var,
|
||||
exclude_slash_tmp,
|
||||
} => codex_protocol::protocol::SandboxPolicy::WorkspaceWrite {
|
||||
writable_roots: writable_roots.clone(),
|
||||
read_only_access: read_only_access.to_core(),
|
||||
network_access: *network_access,
|
||||
allow_limited_git_writes: *allow_limited_git_writes,
|
||||
exclude_tmpdir_env_var: *exclude_tmpdir_env_var,
|
||||
exclude_slash_tmp: *exclude_slash_tmp,
|
||||
},
|
||||
@@ -1813,12 +1819,14 @@ impl From<codex_protocol::protocol::SandboxPolicy> for SandboxPolicy {
|
||||
writable_roots,
|
||||
read_only_access,
|
||||
network_access,
|
||||
allow_limited_git_writes,
|
||||
exclude_tmpdir_env_var,
|
||||
exclude_slash_tmp,
|
||||
} => SandboxPolicy::WorkspaceWrite {
|
||||
writable_roots,
|
||||
read_only_access: ReadOnlyAccess::from(read_only_access),
|
||||
network_access,
|
||||
allow_limited_git_writes,
|
||||
exclude_tmpdir_env_var,
|
||||
exclude_slash_tmp,
|
||||
},
|
||||
@@ -9387,6 +9395,7 @@ mod tests {
|
||||
readable_roots: vec![readable_root.clone()],
|
||||
},
|
||||
network_access: true,
|
||||
allow_limited_git_writes: true,
|
||||
exclude_tmpdir_env_var: false,
|
||||
exclude_slash_tmp: false,
|
||||
};
|
||||
@@ -9401,6 +9410,7 @@ mod tests {
|
||||
readable_roots: vec![readable_root],
|
||||
},
|
||||
network_access: true,
|
||||
allow_limited_git_writes: true,
|
||||
exclude_tmpdir_env_var: false,
|
||||
exclude_slash_tmp: false,
|
||||
}
|
||||
@@ -9441,6 +9451,7 @@ mod tests {
|
||||
writable_roots: vec![],
|
||||
read_only_access: ReadOnlyAccess::FullAccess,
|
||||
network_access: false,
|
||||
allow_limited_git_writes: false,
|
||||
exclude_tmpdir_env_var: false,
|
||||
exclude_slash_tmp: false,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user