pyrograph 0.1.0

GPU-accelerated taint analysis for supply chain malware detection
Documentation

#![cfg_attr(
    not(test),
    deny(
        clippy::unwrap_used,
        clippy::expect_used,
        clippy::todo,
        clippy::unimplemented,
        clippy::panic
    )
)]
pub mod ir;
#[cfg(feature = "gpu")]
pub mod gpu;
pub mod cpu;
pub mod error;
pub mod labels;
#[cfg(any(feature = "js", feature = "go", feature = "rust-lang", feature = "python"))]
pub mod parse;
#[cfg(feature = "js")]
pub mod package;

pub use ir::{TaintGraph, Node, Edge, NodeId, NodeKind, EdgeKind};
pub use labels::{LabelSet, SourceDef, SinkDef, TaintLabel, load_labels, label_node};
pub use error::{Error, Result};

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TaintFinding {
    pub source: usize,
    pub sink: usize,
    pub path: Vec<NodeId>,
    pub severity: Severity,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Severity { Critical, High, Medium, Low }

/// Perform taint analysis on the graph.
/// This implementation uses the CPU-based BFS.
/// For GPU-accelerated analysis, use `gpu::GpuContext`.
pub fn analyze(graph: &TaintGraph) -> Result<Vec<TaintFinding>> {
    Ok(cpu::analyze_cpu(graph))
}

// Internal types used by modules to avoid circular dependencies
pub(crate) mod lib_types {
    pub use super::{TaintFinding, Severity};
}