1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! 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>(())
//! ```
pub
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;