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

Method scanExpressionForDangerousFunctions

pkg/sql/security/scanner.go:979–993  ·  view source on GitHub ↗

scanExpressionForDangerousFunctions recursively checks for dangerous functions.

(expr ast.Expression, result *ScanResult)

Source from the content-addressed store, hash-verified

977
978// scanExpressionForDangerousFunctions recursively checks for dangerous functions.
979func (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.
996func (s *Scanner) detectCommentPatterns(sql string, result *ScanResult) {

Callers 4

scanSelectStatementMethod · 0.95
scanInsertStatementMethod · 0.95
scanUpdateStatementMethod · 0.95
scanFunctionCallMethod · 0.95

Calls 1

scanFunctionCallMethod · 0.95

Tested by

no test coverage detected