BenchmarkScanner_CommentBypass benchmarks comment-based bypass detection
(b *testing.B)
| 125 | |
| 126 | // BenchmarkScanner_CommentBypass benchmarks comment-based bypass detection |
| 127 | func BenchmarkScanner_CommentBypass(b *testing.B) { |
| 128 | sqls := []string{ |
| 129 | "SELECT * FROM users WHERE id = 1 -- AND password = 'x'", |
| 130 | "SELECT * FROM users WHERE id = 1 /* comment */ OR 1=1", |
| 131 | "SELECT * FROM users # comment", |
| 132 | } |
| 133 | scanner := NewScanner() |
| 134 | |
| 135 | b.ReportAllocs() |
| 136 | b.ResetTimer() |
| 137 | for i := 0; i < b.N; i++ { |
| 138 | scanner.ScanSQL(sqls[i%len(sqls)]) |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | // BenchmarkScanner_DangerousFunctions benchmarks dangerous function detection |
| 143 | func BenchmarkScanner_DangerousFunctions(b *testing.B) { |
nothing calls this directly
no test coverage detected