pub struct TaintTracker { /* private fields */ }Expand description
Tracks taint through a single execution session.
This is the main interface for cross-function taint tracking in the Rust core. It maintains the set of sources and sinks, and records confirmed taint flows.
Implementations§
Source§impl TaintTracker
impl TaintTracker
Sourcepub fn register_source(
&mut self,
api: impl Into<String>,
description: impl Into<String>,
) -> TaintLabel
pub fn register_source( &mut self, api: impl Into<String>, description: impl Into<String>, ) -> TaintLabel
Register a new taint source.
Returns the assigned taint label for this source. CRITICAL FIX: Uses saturating arithmetic to prevent overflow.
Sourcepub fn register_sink(
&mut self,
api: impl Into<String>,
dangerous_args: Vec<usize>,
severity: Severity,
cwe: impl Into<String>,
)
pub fn register_sink( &mut self, api: impl Into<String>, dangerous_args: Vec<usize>, severity: Severity, cwe: impl Into<String>, )
Register a new taint sink.
Sourcepub fn apply_source_taint(&self, api: &str, value: Value) -> Value
pub fn apply_source_taint(&self, api: &str, value: Value) -> Value
Apply taint to a value returned from a source API.
If the API is a registered source, the value is marked with the corresponding taint label. Otherwise, the value is returned unchanged.
Sourcepub fn check_sink(&mut self, api: &str, args: &[Value]) -> Option<TaintFlow>
pub fn check_sink(&mut self, api: &str, args: &[Value]) -> Option<TaintFlow>
Check for taint flows at a sink API call.
If any of the dangerous arguments are tainted, records a taint flow and returns it. Returns None if no tainted data reached the sink.
Sourcepub fn take_flows(&mut self) -> Vec<TaintFlow>
pub fn take_flows(&mut self) -> Vec<TaintFlow>
Take all recorded taint flows (clears internal list).
Sourcepub fn flow_count(&self) -> usize
pub fn flow_count(&self) -> usize
Count of confirmed taint flows.
Trait Implementations§
Source§impl Debug for TaintTracker
impl Debug for TaintTracker
Source§impl Default for TaintTracker
impl Default for TaintTracker
Source§fn default() -> TaintTracker
fn default() -> TaintTracker
Auto Trait Implementations§
impl Freeze for TaintTracker
impl RefUnwindSafe for TaintTracker
impl Send for TaintTracker
impl Sync for TaintTracker
impl Unpin for TaintTracker
impl UnsafeUnpin for TaintTracker
impl UnwindSafe for TaintTracker
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> 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