Skip to main content

ContentBoundLabel

Trait ContentBoundLabel 

Source
pub trait ContentBoundLabel: LabeledObject {
    // Required method
    fn content_id(&self) -> &[u8] ⓘ;

    // Provided method
    fn verify_binding(&self) -> bool { ... }
}
Expand description

The binding contract a real CAS manifest must satisfy: the label is bound to the content hash, so an attacker cannot relabel without producing a new CID (and thus a new object). This is the property that makes the object label content-truth rather than a mutable xattr.

S1 specifies the contract; the implementation lands with the manifest layer. A conforming manifest serializes security_label inside the bytes that the CID covers — verifying this is the manifest layer’s test, asserted here as a documented invariant.

Required Methods§

Source

fn content_id(&self) -> &[u8] ⓘ

The content identifier (hash) of the manifest. The label returned by LabeledObject::security_label MUST be part of the preimage of this CID.

Provided Methods§

Source

fn verify_binding(&self) -> bool

Recompute the CID over the manifest bytes (including the label) and check it equals content_id. A real impl uses this to verify the binding when a manifest is loaded from the store — a mismatch ⇒ tampered ⇒ deny.

Default impl is false (fail-closed) so a stub that forgets to implement verification denies rather than trusts.

Implementors§