(t *testing.T)
| 174 | } |
| 175 | |
| 176 | func TestScan_TimeBasedFunction(t *testing.T) { |
| 177 | scanner := NewScanner() |
| 178 | |
| 179 | // Create AST with SLEEP function call |
| 180 | selectStmt := &ast.SelectStatement{ |
| 181 | Columns: []ast.Expression{ |
| 182 | &ast.FunctionCall{ |
| 183 | Name: "SLEEP", |
| 184 | Arguments: []ast.Expression{&ast.LiteralValue{Value: "5", Type: "INTEGER"}}, |
| 185 | }, |
| 186 | }, |
| 187 | } |
| 188 | |
| 189 | tree := &ast.AST{Statements: []ast.Statement{selectStmt}} |
| 190 | result := scanner.Scan(tree) |
| 191 | |
| 192 | if result.HighCount == 0 { |
| 193 | t.Error("expected at least one high severity finding for SLEEP function") |
| 194 | } |
| 195 | |
| 196 | found := false |
| 197 | for _, f := range result.Findings { |
| 198 | if f.Pattern == PatternTimeBased { |
| 199 | found = true |
| 200 | break |
| 201 | } |
| 202 | } |
| 203 | if !found { |
| 204 | t.Error("expected TIME_BASED pattern to be detected") |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | func TestScan_DangerousFunction_LoadFile(t *testing.T) { |
| 209 | scanner := NewScanner() |
nothing calls this directly
no test coverage detected