Skip to main content

Confinement

Struct Confinement 

Source
pub struct Confinement {
    pub filesystem: Enforcement,
    pub network: Enforcement,
    pub process: Enforcement,
    pub environment: Enforcement,
    pub secret: Enforcement,
}
Expand description

What a tier actually enforces, per domain, on this host.

Per host, not per tier in the abstract: the subprocess tier confines a filesystem grant with a preopened directory everywhere, and confines a network grant only where the operating system will give it a network namespace. Reporting the abstract answer would be reporting the answer for somebody else’s machine.

Fields§

§filesystem: Enforcement

fs:* — reading, listing, writing files.

§network: Enforcement

net:* — reaching anything off this machine.

§process: Enforcement

proc:* — starting other programs.

§environment: Enforcement

env:* — reading the environment.

§secret: Enforcement

secret:* — using a credential.

Implementations§

Source§

impl Confinement

Source

pub const NONE: Self

A tier that enforces nothing. The floor to build from, so a tier claims enforcement only by saying so.

Source

pub const fn of(&self, domain: &str) -> Enforcement

How this tier confines the given grant domain.

An unknown domain is Enforcement::None. The grant vocabulary is meant to grow (KNOWN_DOMAINS says so), and a tier that treated a domain it had never heard of as confined would be guessing in the one direction that is unsafe.

Source

pub const fn domains(&self) -> [(&'static str, Enforcement); 5]

Each domain and how it is confined, weakest-enforced domains included.

Source

pub fn enforces_nothing(&self) -> bool

Whether nothing at all is enforced.

Not the same as saying nothing: a tier that reports this has been asked and has answered “none”, which is exactly the fact a reviewer of a Profile C run came looking for.

Source

pub fn unenforceable<'g>(&self, grants: &'g GrantSet) -> Option<&'g GrantAtom>

The first atom of grants this tier cannot enforce, if there is one.

What a tier refuses a capability set on: a grant nothing enforces is an advisory permission, and handing one over would make the compiler’s proof false at run time.

Trait Implementations§

Source§

impl Clone for Confinement

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 Copy for Confinement

Source§

impl Debug for Confinement

Source§

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

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

impl<'de> Deserialize<'de> for Confinement

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Confinement

Source§

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

fs=kernel net=none proc=interposed env=kernel secret=interposed.

Every domain, every time, including the ones enforcing nothing. A rendering that omitted them would make “not confined” and “not mentioned” look the same, which is the distinction this type exists to keep.

Source§

impl Eq for Confinement

Source§

impl PartialEq for Confinement

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Confinement

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Confinement

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> Canonical for T
where T: Serialize + ?Sized,

Source§

fn canonical_bytes(&self) -> Result<Vec<u8>, CanonicalError>

The canonical CBOR encoding of this value.
Source§

fn digest(&self) -> Result<Digest, CanonicalError>

The blake3 digest of this value’s canonical encoding.
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V