MCPcopy Create free account
hub / github.com/erans/pgsqlite / new

Method new

src/security/sql_injection_detector.rs:30–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28
29impl SqlInjectionDetector {
30 pub fn new() -> Self {
31 let mut dangerous_functions = HashSet::new();
32 dangerous_functions.insert("exec".to_string());
33 dangerous_functions.insert("execute".to_string());
34 dangerous_functions.insert("sp_executesql".to_string());
35 dangerous_functions.insert("xp_cmdshell".to_string());
36 dangerous_functions.insert("eval".to_string());
37 dangerous_functions.insert("system".to_string());
38 dangerous_functions.insert("shell".to_string());
39 dangerous_functions.insert("cmd".to_string());
40
41 Self {
42 max_depth: 10,
43 max_statements: 3,
44 max_unions: 5,
45 dangerous_functions,
46 allowed_table_patterns: HashSet::new(),
47 }
48 }
49
50 /// Analyze SQL query for injection attempts using AST-based detection
51 pub fn analyze_query(&self, query: &str) -> Result<SqlAnalysisResult, PgSqliteError> {

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected