File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
java/ql/src/semmle/code/java Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * Provides classes and predicates for working with the jOOQ framework.
3+ */
4+
5+ import java
6+
7+ /**
8+ * Methods annotated with this allow for generation of "plain SQL"
9+ * and is prone to SQL injection.
10+ * https://www.jooq.org/doc/current/manual/sql-building/plain-sql/
11+ */
12+ private class PlainSQLType extends Annotation {
13+ PlainSQLType ( ) { this .getType ( ) .hasQualifiedName ( "org.jooq" , "PlainSQL" ) }
14+ }
15+
16+ /**
17+ * Holds if `m` is a jOOQ SQL method taking an SQL string as its
18+ * first argument.
19+ */
20+ predicate jOOQSqlMethod ( Method m ) {
21+ m .getAnAnnotation ( ) instanceof PlainSQLType and
22+ m .getParameterType ( 0 ) instanceof TypeString
23+ }
Original file line number Diff line number Diff line change 33import java
44import semmle.code.java.dataflow.DataFlow
55import semmle.code.java.frameworks.Jdbc
6+ import semmle.code.java.frameworks.jOOQ
67import semmle.code.java.frameworks.android.SQLite
78import semmle.code.java.frameworks.javaee.Persistence
89import semmle.code.java.frameworks.SpringJdbc
@@ -30,6 +31,8 @@ private class SqlInjectionSink extends QueryInjectionSink {
3031 index = 0 and mybatisSqlMethod ( m )
3132 or
3233 index = 0 and hibernateSqlMethod ( m )
34+ or
35+ index = 0 and jOOQSqlMethod ( m )
3336 )
3437 }
3538}
You can’t perform that action at this time.
0 commit comments