BenchmarkScanner_MixedPatterns benchmarks detection of multiple injection patterns
(b *testing.B)
| 346 | |
| 347 | // BenchmarkScanner_MixedPatterns benchmarks detection of multiple injection patterns |
| 348 | func BenchmarkScanner_MixedPatterns(b *testing.B) { |
| 349 | sql := "SELECT * FROM users WHERE id = 1 OR 1=1 UNION SELECT null, username, password FROM admin_users -- bypass" |
| 350 | scanner := NewScanner() |
| 351 | |
| 352 | tree := parseSQL(b, sql) |
| 353 | defer ast.ReleaseAST(tree) |
| 354 | |
| 355 | b.ReportAllocs() |
| 356 | b.ResetTimer() |
| 357 | for i := 0; i < b.N; i++ { |
| 358 | result := scanner.Scan(tree) |
| 359 | _ = result // Prevent optimization |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | // generateLargeSelectQuery generates a SELECT query with specified number of columns |
| 364 | func generateLargeSelectQuery(columns int) string { |
nothing calls this directly
no test coverage detected