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

Function test_sql_injection_detection

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

Source from the content-addressed store, hash-verified

559
560 #[test]
561 fn test_sql_injection_detection() {
562 let detector = SqlInjectionDetector::new();
563
564 let malicious_queries = [
565 "SELECT * FROM users WHERE id = 1 OR 1=1",
566 "SELECT * FROM users UNION SELECT password FROM admin",
567 "SELECT * FROM users; DELETE FROM logs",
568 ];
569
570 for query in &malicious_queries {
571 let result = detector.analyze_query(query);
572 assert!(result.is_err(), "Should reject malicious query: {}", query);
573 }
574 }
575
576 #[test]
577 fn test_fallback_pattern_detection() {

Callers

nothing calls this directly

Calls 1

analyze_queryMethod · 0.45

Tested by

no test coverage detected