Skip to main content

SandboxSettings

Struct SandboxSettings 

Source
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: bool

sandbox.unattended_needs_network_policy: false.

§disabled: bool

sandbox.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

Source

pub fn policy(&self) -> SandboxPolicy

The policy a session’s command runs under before its call adds what it may write.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for SandboxSettings

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SandboxSettings

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SandboxSettings

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more