pub struct TaintResult {
pub sources: AHashSet<i64>,
pub sinks_reached: AHashSet<i64>,
pub tainted_nodes: AHashSet<i64>,
pub source_sink_paths: Vec<(i64, i64)>,
pub size: usize,
}Expand description
Result of taint analysis operation.
Contains the complete taint propagation result with sources, sinks reached, tainted nodes, and source-sink vulnerability paths.
§Fields
sources: Source nodes that were analyzed (taint origins)sinks_reached: Sink nodes that are reachable from sources (vulnerabilities)tainted_nodes: All nodes tainted by source data (forward reachability from sources)source_sink_paths: Vulnerability paths as (source, sink) pairssize: Number of tainted nodes (len of tainted_nodes)
§Example
ⓘ
let result = propagate_taint_forward(&graph, &sources, &sinks)?;
println!("Tainted {} nodes from {} sources",
result.size, result.sources.len());
// Check if specific node is tainted
if result.is_tainted(node_id) {
println!("Node {} is tainted", node_id);
}
// Check for vulnerabilities
if result.has_vulnerability() {
println!("Found {} source-sink vulnerabilities",
result.source_sink_paths.len());
for (source, sink) in result.sorted_vulnerabilities() {
println!(" VULN: source {} -> sink {}", source, sink);
}
}Fields§
§sources: AHashSet<i64>Source nodes that taint originated from
sinks_reached: AHashSet<i64>Sink nodes that were reached by tainted data (vulnerabilities)
tainted_nodes: AHashSet<i64>All nodes that are tainted (reachable from any source)
source_sink_paths: Vec<(i64, i64)>Source-sink paths that represent vulnerabilities
size: usizeNumber of tainted nodes
Implementations§
Source§impl TaintResult
impl TaintResult
Sourcepub fn is_tainted(&self, node: i64) -> bool
pub fn is_tainted(&self, node: i64) -> bool
Sourcepub fn has_vulnerability(&self) -> bool
pub fn has_vulnerability(&self) -> bool
Sourcepub fn sorted_tainted_nodes(&self) -> Vec<i64>
pub fn sorted_tainted_nodes(&self) -> Vec<i64>
Sourcepub fn sorted_vulnerabilities(&self) -> Vec<(i64, i64)>
pub fn sorted_vulnerabilities(&self) -> Vec<(i64, i64)>
Trait Implementations§
Source§impl Clone for TaintResult
impl Clone for TaintResult
Source§fn clone(&self) -> TaintResult
fn clone(&self) -> TaintResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TaintResult
impl Debug for TaintResult
Auto Trait Implementations§
impl Freeze for TaintResult
impl RefUnwindSafe for TaintResult
impl Send for TaintResult
impl Sync for TaintResult
impl Unpin for TaintResult
impl UnwindSafe for TaintResult
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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