scanExpressionForDangerousFunctions recursively checks for dangerous functions.
(expr ast.Expression, result *ScanResult)
| 977 | |
| 978 | // scanExpressionForDangerousFunctions recursively checks for dangerous functions. |
| 979 | func (s *Scanner) scanExpressionForDangerousFunctions(expr ast.Expression, result *ScanResult) { |
| 980 | if expr == nil { |
| 981 | return |
| 982 | } |
| 983 | |
| 984 | switch e := expr.(type) { |
| 985 | case *ast.FunctionCall: |
| 986 | s.scanFunctionCall(e, result) |
| 987 | case *ast.BinaryExpression: |
| 988 | s.scanExpressionForDangerousFunctions(e.Left, result) |
| 989 | s.scanExpressionForDangerousFunctions(e.Right, result) |
| 990 | case *ast.UnaryExpression: |
| 991 | s.scanExpressionForDangerousFunctions(e.Expr, result) |
| 992 | } |
| 993 | } |
| 994 | |
| 995 | // detectCommentPatterns checks raw SQL for comment-based injection. |
| 996 | func (s *Scanner) detectCommentPatterns(sql string, result *ScanResult) { |
no test coverage detected