Skip to main content

SinkCallback

Trait SinkCallback 

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

Callback trait for detecting security-sensitive sinks.

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

§Example

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

struct SqlQueryDetector;

impl SinkCallback for SqlQueryDetector {
    fn is_sink(&self, node: i64, entity: &GraphEntity) -> bool {
        // Detect SQL query execution nodes
        entity.kind == "sql_execute" ||
        entity.data["operation"].as_str() == Some("query")
    }
}

Required Methods§

Source

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

Checks if a node is a security-sensitive sink.

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

true if the node is a sink, false otherwise

Implementors§