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: Enforcementfs:* — reading, listing, writing files.
network: Enforcementnet:* — reaching anything off this machine.
process: Enforcementproc:* — starting other programs.
environment: Enforcementenv:* — reading the environment.
secret: Enforcementsecret:* — using a credential.
Implementations§
Source§impl Confinement
impl Confinement
Sourcepub const NONE: Self
pub const NONE: Self
A tier that enforces nothing. The floor to build from, so a tier claims enforcement only by saying so.
Sourcepub const fn of(&self, domain: &str) -> Enforcement
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.
Sourcepub const fn domains(&self) -> [(&'static str, Enforcement); 5]
pub const fn domains(&self) -> [(&'static str, Enforcement); 5]
Each domain and how it is confined, weakest-enforced domains included.
Sourcepub fn enforces_nothing(&self) -> bool
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.
Sourcepub fn unenforceable<'g>(&self, grants: &'g GrantSet) -> Option<&'g GrantAtom>
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
impl Clone for Confinement
impl Copy for Confinement
Source§impl Debug for Confinement
impl Debug for Confinement
Source§impl<'de> Deserialize<'de> for Confinement
impl<'de> Deserialize<'de> for Confinement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for Confinement
impl Display for Confinement
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
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.