Skip to main content

Crate boundgraph_grant

Crate boundgraph_grant 

Source
Expand description

The BoundGraph permission lattice.

boundgraph-core owns the shape of a permission — [GrantAtom] and [GrantSet] are plain data there. This crate owns its meaning: what it means for one grant to permit less than another, how grants combine, and whether two of them can ever touch the same resource.

That makes it the machinery behind Law I. The attenuation check that refuses a flow whose child widens its parent’s authority is a call to set_leq; the proof that two par branches cannot interfere is a call to the disjointness solver.

§Conservative by default

Every question here is answered with Tri, not bool. Where the pattern language cannot decide an answer, the result is Tri::Unknown, and the compiler treats that as a refusal. A build error is a cheap failure; a wrongly-granted permission is not.

use boundgraph_core::GrantSet;
use boundgraph_grant::{Tri, set_leq};

let parent = GrantSet::parse(["fs:read:/src/**"])?;
let child  = GrantSet::parse(["fs:read:/src/lib/a.rs"])?;
let rogue  = GrantSet::parse(["fs:read:/etc/passwd"])?;

assert_eq!(set_leq(&child, &parent), Tri::Yes);  // narrowing: allowed
assert_eq!(set_leq(&rogue, &parent), Tri::No);   // widening: refused

Re-exports§

pub use access::Access;
pub use access::classify;
pub use access::is_known_action;
pub use disjoint::Conflict;
pub use disjoint::ConflictKind;
pub use disjoint::Disjointness;
pub use disjoint::all_disjoint;
pub use disjoint::disjoint;
pub use lattice::clamp;
pub use lattice::join;
pub use lattice::join_all;
pub use lattice::meet;
pub use lattice::meet_all;
pub use normalize::is_normal;
pub use normalize::normalize;
pub use order::atom_eq;
pub use order::atom_leq;
pub use order::set_eq;
pub use order::set_leq;
pub use order::set_lt;
pub use pattern::Pattern;
pub use pattern::Tri;
pub use pattern::Undecidable;
pub use pattern::covers;
pub use pattern::intersect;
pub use pattern::overlaps;
pub use require::Refusal;
pub use require::require_attenuated;
pub use require::require_disjoint;

Modules§

access
Read or write: which side of the disjointness condition an action falls on.
disjoint
The disjointness proof behind par.
lattice
Meet (⊓) and join (⊔).
normalize
Normalisation to an antichain.
order
The partial order ⊑ — “permits no more than”.
pattern
Resource patterns, and what one pattern says about another.
require
Turning an undecided answer into a refusal.