Class SQLParameterizer
java.lang.Object
io.codemodder.remediation.sqlinjection.SQLParameterizer
Contains most of the logic for detecting and fixing parameterizable SQL statements for a given
MethodCallExpr
.-
Constructor Summary
ConstructorsConstructorDescriptionSQLParameterizer
(com.github.javaparser.ast.expr.MethodCallExpr methodCallExpr) -
Method Summary
Modifier and TypeMethodDescriptionOptional<com.github.javaparser.ast.expr.MethodCallExpr>
Checks ifmethodCall
is a query call that needs to be fixed and fixes if that's the case.Returns a set of fixable JDBC method names.static boolean
isParameterizationCandidate
(com.github.javaparser.ast.expr.MethodCallExpr methodCallExpr) static boolean
isSupportedJdbcMethodCall
(com.github.javaparser.ast.expr.MethodCallExpr methodCall) Returns true if this is a fixable JDBC method name.static com.github.javaparser.ast.expr.Expression
resolveExpression
(com.github.javaparser.ast.expr.Expression expr) Tries to find the source of an expression if it can be uniquely defined, otherwise, returns self.
-
Constructor Details
-
SQLParameterizer
public SQLParameterizer(com.github.javaparser.ast.expr.MethodCallExpr methodCallExpr)
-
-
Method Details
-
isParameterizationCandidate
public static boolean isParameterizationCandidate(com.github.javaparser.ast.expr.MethodCallExpr methodCallExpr) -
isSupportedJdbcMethodCall
public static boolean isSupportedJdbcMethodCall(com.github.javaparser.ast.expr.MethodCallExpr methodCall) Returns true if this is a fixable JDBC method name. -
fixableJdbcMethodNames
Returns a set of fixable JDBC method names. -
resolveExpression
public static com.github.javaparser.ast.expr.Expression resolveExpression(com.github.javaparser.ast.expr.Expression expr) Tries to find the source of an expression if it can be uniquely defined, otherwise, returns self. -
checkAndFix
Checks ifmethodCall
is a query call that needs to be fixed and fixes if that's the case. If the parameterization happened, returns the PreparedStatement creation.
-