pub struct SandboxSettings {
pub allow_read: Vec<PathBuf>,
pub deny_read: Vec<PathBuf>,
pub network_mode: NetworkMode,
pub allowed_domains: Vec<String>,
pub egress_proxy: Option<EgressProxy>,
pub deny_write: Vec<String>,
pub allow_write: Vec<PathBuf>,
pub paths: Arc<SensitivePaths>,
pub require_enforcement: bool,
pub unattended_allows_open_network: bool,
pub disabled: bool,
pub worktree_git: Option<WorktreeGit>,
}Expand description
The engine’s sandbox settings for a session, as settings.json’s
sandbox section gave them: what a command is held to, before any one
call narrows it. Every SandboxPolicy a command or the engine’s own git
runs under is derived from this, here.
Fields§
§allow_read: Vec<PathBuf>§deny_read: Vec<PathBuf>Empty means the built-in credential list (default_deny_read); a
list replaces it whole.
network_mode: NetworkMode§allowed_domains: Vec<String>§egress_proxy: Option<EgressProxy>§deny_write: Vec<String>Filename segments no tool may write, on top of the built-in ones;
sandboxed commands are held to them too (SandboxPolicy::deny_write).
allow_write: Vec<PathBuf>Paths exempt from the write deny rules.
paths: Arc<SensitivePaths>This instance’s sensitive paths: its state root, so the profile protects the settings files that actually govern it, and the credentials the gate and the file tools refuse.
require_enforcement: bool§unattended_allows_open_network: boolsandbox.unattended_needs_network_policy: false.
disabled: boolsandbox.enabled: commands run outside the OS sandbox.
worktree_git: Option<WorktreeGit>SandboxPolicy::worktree_git, for a session working in a linked
worktree.
Implementations§
Source§impl SandboxSettings
impl SandboxSettings
Sourcepub fn policy(&self) -> SandboxPolicy
pub fn policy(&self) -> SandboxPolicy
The policy a session’s command runs under before its call adds what it may write.
Sourcepub fn session_tmp_dir(&self, session_id: &str) -> PathBuf
pub fn session_tmp_dir(&self, session_id: &str) -> PathBuf
The session’s own temporary directory: a sandboxed command’s TMPDIR,
and the only temporary directory it may write besides the one macOS
mktemp insists on. Not created here.
Under the state root rather than in the system temporary directory: on
macOS that is the per-user DARWIN_USER_TEMP_DIR every sandboxed
command may write, so one session’s commands could reach into
another’s.
Sourcepub fn confinement(
&self,
exec: &ExecProviders,
cwd: &Path,
session_id: &str,
) -> ConfinementReport
pub fn confinement( &self, exec: &ExecProviders, cwd: &Path, session_id: &str, ) -> ConfinementReport
What the session’s sandbox holds a command to, for the permission
policy to read: one probe command confined the way a command nobody
attends is, since that is the command the answer lets run. Only
exec.sandbox is asked; nothing runs.
Sourcepub fn engine_git(
&self,
exec: &ExecProviders,
trust: ProjectTrust,
tmpdir: Option<PathBuf>,
) -> EngineExec
pub fn engine_git( &self, exec: &ExecProviders, trust: ProjectTrust, tmpdir: Option<PathBuf>, ) -> EngineExec
How the engine starts its own git and helpers: through the session’s
providers, and inside its sandbox whenever the session’s shell
commands are, so what a repository such a command configured makes
git run is held to the same roots. tmpdir is the session’s, made
ready.