pub struct TaintLedger { /* private fields */ }Expand description
Runtime-observed taint provenance: the state keys, per tenant, that currently hold a value derived from an untrusted tool result.
Owned by the crate::Runtime and installed alongside the VIGIL intent
gate — no intent gate, no ledger, so an unconfigured runtime pays
nothing. See the module docs for the threat model and the limitations.
Implementations§
Source§impl TaintLedger
impl TaintLedger
Sourcepub fn new(untrusted_tools: HashSet<String>) -> Self
pub fn new(untrusted_tools: HashSet<String>) -> Self
Build a ledger over the configured untrusted tool names.
Sourcepub fn untrusted_tools(&self) -> &HashSet<String>
pub fn untrusted_tools(&self) -> &HashSet<String>
The configured untrusted tool names.
Sourcepub async fn record_result(
&self,
tenant: Option<&str>,
action: &Action,
written_keys: impl IntoIterator<Item = String>,
)
pub async fn record_result( &self, tenant: Option<&str>, action: &Action, written_keys: impl IntoIterator<Item = String>, )
Record the provenance of one successful action.
written_keys is what the action actually changed (the executor’s
state_changes: declared expected_effects plus the state
transitions dispatch produced). The result is tainted when the
action’s tool is untrusted, or when it read a key that is already
tainted for tenant; a tainted result taints every written key and a
trusted one clears them.
Failed actions must NOT be recorded — a failed action commits no effects, so it changes no provenance.
Sourcepub async fn untrusted_action_ids(
&self,
tenant: Option<&str>,
actions: &[Action],
) -> HashSet<String>
pub async fn untrusted_action_ids( &self, tenant: Option<&str>, actions: &[Action], ) -> HashSet<String>
The ids of actions whose read set intersects tenant’s tainted
keys — exactly the untrusted_ids input
car_verify::intent::intent_actions_from takes.
Tools named in untrusted_tools are deliberately NOT re-derived
here: intent_actions_from already marks those from the tool name.
This answers the question the tool name cannot — did this action
read something a previous untrusted result wrote?
Auto Trait Implementations§
impl !Freeze for TaintLedger
impl !RefUnwindSafe for TaintLedger
impl !UnwindSafe for TaintLedger
impl Send for TaintLedger
impl Sync for TaintLedger
impl Unpin for TaintLedger
impl UnsafeUnpin for TaintLedger
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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