mirror of
https://github.com/openai/codex.git
synced 2026-11-26 23:40:43 +00:00
permissions: canonicalize workspace_roots and danger-full-access names
This commit is contained in:
@@ -297,6 +297,15 @@ impl ManagedFileSystemPermissions {
|
||||
}
|
||||
}
|
||||
|
||||
/// Reserved identifier for the built-in read-only permission profile.
|
||||
pub const BUILT_IN_PERMISSION_PROFILE_READ_ONLY: &str = ":read-only";
|
||||
|
||||
/// Reserved identifier for the built-in workspace-write permission profile.
|
||||
pub const BUILT_IN_PERMISSION_PROFILE_WORKSPACE: &str = ":workspace";
|
||||
|
||||
/// Reserved identifier for the built-in full-access permission profile.
|
||||
pub const BUILT_IN_PERMISSION_PROFILE_DANGER_FULL_ACCESS: &str = ":danger-full-access";
|
||||
|
||||
/// Canonical active runtime permissions for a conversation, turn, or command.
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Serialize, JsonSchema, TS)]
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
@@ -402,7 +411,7 @@ impl PermissionProfile {
|
||||
/// Managed workspace-write filesystem access with restricted network
|
||||
/// access.
|
||||
///
|
||||
/// The returned profile contains symbolic `:project_roots` entries that
|
||||
/// The returned profile contains symbolic `:workspace_roots` entries that
|
||||
/// must be resolved against the active permission root before enforcement.
|
||||
pub fn workspace_write() -> Self {
|
||||
Self::workspace_write_with(
|
||||
@@ -416,7 +425,7 @@ impl PermissionProfile {
|
||||
/// Managed workspace-write filesystem access with the legacy
|
||||
/// `sandbox_workspace_write` knobs applied directly to the profile.
|
||||
///
|
||||
/// The returned profile contains symbolic `:project_roots` entries that
|
||||
/// The returned profile contains symbolic `:workspace_roots` entries that
|
||||
/// must be resolved against the active permission root before enforcement.
|
||||
pub fn workspace_write_with(
|
||||
writable_roots: &[AbsolutePathBuf],
|
||||
|
||||
@@ -695,7 +695,7 @@ impl FileSystemSandboxPolicy {
|
||||
)
|
||||
}
|
||||
|
||||
/// Replaces symbolic `:project_roots` entries with absolute paths resolved
|
||||
/// Replaces symbolic `:workspace_roots` entries with absolute paths resolved
|
||||
/// against `cwd`.
|
||||
///
|
||||
/// Use this when a durable permission profile must survive a cwd-only
|
||||
@@ -763,7 +763,7 @@ impl FileSystemSandboxPolicy {
|
||||
///
|
||||
/// Unlike [`Self::with_additional_writable_roots`], this mirrors legacy
|
||||
/// writable-roots semantics by adding exact roots even when they are
|
||||
/// already writable through `:project_roots`, and by adding the default
|
||||
/// already writable through `:workspace_roots`, and by adding the default
|
||||
/// read-only protected subpaths for each new root.
|
||||
pub fn with_additional_legacy_workspace_writable_roots(
|
||||
mut self,
|
||||
|
||||
Reference in New Issue
Block a user