pub struct TaintState {
pub tainted: HashSet<String>,
pub sanitized: HashSet<String>,
}Expand description
A simple variable-level taint tracking state.
Fields§
§tainted: HashSet<String>Tainted variables.
sanitized: HashSet<String>Sanitized variables (explicitly cleaned).
Implementations§
Source§impl TaintState
impl TaintState
pub fn new() -> Self
Sourcepub fn add_source(&mut self, var: impl Into<String>)
pub fn add_source(&mut self, var: impl Into<String>)
Mark a variable as a taint source.
Sourcepub fn propagate(&mut self, dst: impl Into<String>, srcs: &[&str])
pub fn propagate(&mut self, dst: impl Into<String>, srcs: &[&str])
Propagate taint: dst is tainted if any of srcs is tainted.
Sourcepub fn violates(&self, var: &str) -> bool
pub fn violates(&self, var: &str) -> bool
Check for a taint violation: var is tainted and reaches a sink.
Sourcepub fn join(&self, other: &TaintState) -> TaintState
pub fn join(&self, other: &TaintState) -> TaintState
Join two taint states (union of tainted sets).
Trait Implementations§
Source§impl Clone for TaintState
impl Clone for TaintState
Source§fn clone(&self) -> TaintState
fn clone(&self) -> TaintState
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 TaintState
impl Debug for TaintState
Source§impl Default for TaintState
impl Default for TaintState
Source§fn default() -> TaintState
fn default() -> TaintState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TaintState
impl RefUnwindSafe for TaintState
impl Send for TaintState
impl Sync for TaintState
impl Unpin for TaintState
impl UnsafeUnpin for TaintState
impl UnwindSafe for TaintState
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