MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / BenchmarkScanner_CommentBypass

Function BenchmarkScanner_CommentBypass

pkg/sql/security/scanner_bench_test.go:127–140  ·  view source on GitHub ↗

BenchmarkScanner_CommentBypass benchmarks comment-based bypass detection

(b *testing.B)

Source from the content-addressed store, hash-verified

125
126// BenchmarkScanner_CommentBypass benchmarks comment-based bypass detection
127func 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
143func BenchmarkScanner_DangerousFunctions(b *testing.B) {

Callers

nothing calls this directly

Calls 2

ScanSQLMethod · 0.95
NewScannerFunction · 0.85

Tested by

no test coverage detected