boundgraph-grant 0.1.0

The BoundGraph permission lattice: containment, meet and join, normalisation, and the disjointness solver behind Law I.
Documentation
//! 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
//! # Ok::<(), boundgraph_core::GrantAtomParseError>(())
//! ```

#![doc(html_root_url = "https://docs.rs/boundgraph-grant")]

pub mod access;
pub mod disjoint;
pub mod lattice;
pub mod normalize;
pub mod order;
pub mod pattern;
pub mod require;
pub(crate) mod trie;

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