Replace SQL string concatenation with a PreparedStatement

Proprietary

Rewrites JDBC Statement.executeQuery/executeUpdate/execute/addBatch calls whose argument is a string concatenation built from a literal SQL prefix plus simple variable operands into a PreparedStatement with ? placeholders and setX(i, ...) bindings. Only fixes the narrow safe subset where the Statement is a local variable from Connection.createStatement() used for a single SQL execution; other cases are left for the FindSqlInjection recipe to surface.

org.openrewrite.java.security.FixSqlInjectionConcat
mod run . --recipe=org.openrewrite.java.security.FixSqlInjectionConcat

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.