Skip to main content

SourceCallback

Trait SourceCallback 

Source
pub trait SourceCallback {
    // Required method
    fn is_source(&self, node: i64, entity: &GraphEntity) -> bool;
}
Expand description

Callback trait for detecting taint sources.

Implement this trait to define custom source detection logic. The callback receives a node ID and its entity data, returning true if the node is a taint source.

§Example

use sqlitegraph::algo::{SourceCallback, TaintResult};
use sqlitegraph::graph::types::GraphEntity;

struct HttpParamDetector;

impl SourceCallback for HttpParamDetector {
    fn is_source(&self, node: i64, entity: &GraphEntity) -> bool {
        // Detect HTTP parameter nodes
        entity.kind == "http_param" ||
        entity.data["taint"].as_str() == Some("untrusted")
    }
}

Required Methods§

Source

fn is_source(&self, node: i64, entity: &GraphEntity) -> bool

Checks if a node is a taint source.

§Arguments
  • node - Node ID to check
  • entity - Graph entity containing metadata
§Returns

true if the node is a taint source, false otherwise

Implementors§