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

Function test_sql_injection_detector_fallback

tests/test_sql_injection_detector.rs:88–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86
87#[test]
88fn test_sql_injection_detector_fallback() {
89 let detector = SqlInjectionDetector::new();
90
91 // Test invalid SQL that should fall back to pattern matching
92 let invalid_sql = "INVALID SQL SYNTAX WITHOUT INJECTION";
93 let result = detector.analyze_query(invalid_sql);
94 // Should not error, should fall back to pattern analysis
95 assert!(result.is_ok());
96
97 // Test invalid SQL with injection pattern - should be rejected
98 let invalid_sql_with_injection = "INVALID SQL SYNTAX '; DROP TABLE users;";
99 let result = detector.analyze_query(invalid_sql_with_injection);
100 // Should error due to injection pattern
101 assert!(result.is_err());
102}

Callers

nothing calls this directly

Calls 1

analyze_queryMethod · 0.45

Tested by

no test coverage detected