Struct SecurityLabel
pub struct SecurityLabel {
pub level: Level,
pub assurance: Assurance,
pub compartments: CompartmentSet,
}Expand description
A complete security label: a point in the product lattice
Level × Assurance × CompartmentSet.
The same type is used for an object’s classification and a subject’s
clearance (a clearance is just a label the subject is allowed to read up
to). Dominance and join are defined on the inherent
SecurityLabel::can_access / SecurityLabel::join helpers below — note
those helpers encode the fixed product-lattice algebra and are independent
of any site policy (the policy in [super::lattice::Lattice] only constrains
which labels are well-formed/known, never how they compare).
Copy + Ord + Hash (compartments are a packed [CompartmentSet] bitset,
not a heap set) so S4’s AVC (#570) can key on a label directly — and so two
equal labels serialize identically, which content-binding (manifest hash) and
the (UCAN, bundle_hash) approval (S5) require.
Fields§
§level: LevelMLS sensitivity level (total order).
assurance: AssuranceCrypto-assurance required to handle this label (total order, #548).
compartments: CompartmentSetNeed-to-know compartments as a fixed bitset (powerset lattice under ⊆).
Implementations§
§impl SecurityLabel
impl SecurityLabel
pub fn new(
level: Level,
assurance: Assurance,
compartments: CompartmentSet,
) -> SecurityLabel
pub fn new( level: Level, assurance: Assurance, compartments: CompartmentSet, ) -> SecurityLabel
Construct a label from its axes. There is intentionally no Default —
every label must be chosen explicitly so “unlabeled” can never silently
mean “public”.
pub fn from_bits(
level: Level,
assurance: Assurance,
bits: impl IntoIterator<Item = u32>,
) -> SecurityLabel
pub fn from_bits( level: Level, assurance: Assurance, bits: impl IntoIterator<Item = u32>, ) -> SecurityLabel
Construct a label from compartment bit indices (e.g. resolved from names by the policy). Out-of-range indices are dropped (fail-closed).
pub const fn bottom() -> SecurityLabel
pub const fn bottom() -> SecurityLabel
The fail-closed label (Public, Unverified, {}).
This is deliberately distinct from the identity for provenance joins:
the Biba assurance axis joins with min, whose identity is PqHybrid.
In particular, an empty provenance set must remain unverified rather
than acquire the join identity’s top assurance.
pub fn can_access(&self, object: &SecurityLabel) -> bool
pub fn can_access(&self, object: &SecurityLabel) -> bool
May a subject with this clearance access an object labelled object?
This is the Bell–LaPadula dominance relation — clearance self
dominates the object label (self ⊒ object) iff, on every axis, the
subject is at least the object:
self.level >= object.level(no read-up)self.assurance >= object.assurance(#548 crypto-assurance axis)object.compartments ⊆ self.compartments(cleared into all categories)
The assurance field is currently overloaded: here it is an authentication- strength gate, while provenance joining treats it as Biba integrity. Keep this gate unchanged pending the field-separation/proof follow-up in #1232.
The per-op MAC floor (design §3, §10): the fixed product-lattice order, content truth, never overridable by a token/UCAN/grant.
pub fn can_write_to(&self, object: &SecurityLabel) -> bool
pub fn can_write_to(&self, object: &SecurityLabel) -> bool
Bell–LaPadula *-property (confinement / no-write-down): may a subject
with clearance self write to an object labelled object?
The write-direction dual of can_access. A subject may write only to
objects at least as restrictive as its own clearance — preventing a
high-level subject from leaking secrets to a lower-level object:
object.level >= self.level(no-write-down)self.assurance >= object.assurance(crypto floor is NOT flipped — you cannot write to a higher-assurance object than your key proves)self.compartments.is_subset(object.compartments)(no compartment write-down: the target must be at least as compartmented as the writer)
The assurance axis intentionally does not flip: it is a
crypto-authentication floor on both read and write, not a confidentiality
axis. This is conservative — it tightens rather than relaxes the gate.
See the assurance-axis overload note on can_access and #1232.
pub fn join(&self, other: &SecurityLabel) -> SecurityLabel
pub fn join(&self, other: &SecurityLabel) -> SecurityLabel
IFC provenance join over confidentiality, integrity, and compartments.
a ⊔ b = (max(level), min(assurance), union(compartments)): secrecy
rises to the most restrictive input, while provenance integrity degrades
to its weakest link. Associative, commutative, and idempotent.
pub fn join_all<'a>(
labels: impl IntoIterator<Item = &'a SecurityLabel>,
) -> SecurityLabel
pub fn join_all<'a>( labels: impl IntoIterator<Item = &'a SecurityLabel>, ) -> SecurityLabel
Fold the IFC join over a set of input labels (provenance-DAG join).
Non-empty inputs fold from the per-axis identity (Public, PqHybrid, {}).
Empty provenance instead returns the fail-closed bottom() label, never
the top-assurance identity.
Trait Implementations§
§impl Clone for SecurityLabel
impl Clone for SecurityLabel
§fn clone(&self) -> SecurityLabel
fn clone(&self) -> SecurityLabel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for SecurityLabel
impl Debug for SecurityLabel
§impl<'de> Deserialize<'de> for SecurityLabel
impl<'de> Deserialize<'de> for SecurityLabel
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SecurityLabel, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SecurityLabel, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Display for SecurityLabel
impl Display for SecurityLabel
§impl Hash for SecurityLabel
impl Hash for SecurityLabel
§impl Ord for SecurityLabel
impl Ord for SecurityLabel
§fn cmp(&self, other: &SecurityLabel) -> Ordering
fn cmp(&self, other: &SecurityLabel) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
§impl PartialEq for SecurityLabel
impl PartialEq for SecurityLabel
§impl PartialOrd for SecurityLabel
impl PartialOrd for SecurityLabel
§impl Serialize for SecurityLabel
impl Serialize for SecurityLabel
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for SecurityLabel
impl Eq for SecurityLabel
impl StructuralPartialEq for SecurityLabel
Auto Trait Implementations§
impl Freeze for SecurityLabel
impl RefUnwindSafe for SecurityLabel
impl Send for SecurityLabel
impl Sync for SecurityLabel
impl Unpin for SecurityLabel
impl UnsafeUnpin for SecurityLabel
impl UnwindSafe for SecurityLabel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more