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

Method scanExpression

pkg/sql/security/scanner.go:732–747  ·  view source on GitHub ↗

scanExpression analyzes an expression for injection patterns.

(expr ast.Expression, result *ScanResult, context string)

Source from the content-addressed store, hash-verified

730
731// scanExpression analyzes an expression for injection patterns.
732func (s *Scanner) scanExpression(expr ast.Expression, result *ScanResult, context string) {
733 if expr == nil {
734 return
735 }
736
737 switch e := expr.(type) {
738 case *ast.BinaryExpression:
739 s.scanBinaryExpression(e, result, context)
740 case *ast.FunctionCall:
741 s.scanFunctionCall(e, result)
742 case *ast.UnaryExpression:
743 if e.Expr != nil {
744 s.scanExpression(e.Expr, result, context)
745 }
746 }
747}
748
749// scanBinaryExpression checks for tautologies and suspicious patterns.
750func (s *Scanner) scanBinaryExpression(expr *ast.BinaryExpression, result *ScanResult, context string) {

Callers 4

scanSelectStatementMethod · 0.95
scanUpdateStatementMethod · 0.95
scanDeleteStatementMethod · 0.95
scanBinaryExpressionMethod · 0.95

Calls 2

scanBinaryExpressionMethod · 0.95
scanFunctionCallMethod · 0.95

Tested by

no test coverage detected