Skip to content

Commit 8e9f21d

Browse files
Jami CogswellJami Cogswell
authored andcommitted
Java: add a class for MyBatis Mapper methods that update a database
1 parent 506d668 commit 8e9f21d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

java/ql/lib/semmle/code/java/security/CsrfUnprotectedRequestTypeQuery.qll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,20 @@ private class SpringCsrfUnprotectedMethod extends CsrfUnprotectedMethod instance
2727
)
2828
}
2929
}
30+
31+
/** A method that updates a database. */
32+
abstract class DatabaseUpdateMethod extends Method { }
33+
34+
/** A MyBatis Mapper method that updates a database. */
35+
private class MyBatisMapperDatabaseUpdateMethod extends DatabaseUpdateMethod {
36+
MyBatisMapperDatabaseUpdateMethod() {
37+
exists(MyBatisMapperSqlOperation mapperXml |
38+
(
39+
mapperXml instanceof MyBatisMapperInsert or
40+
mapperXml instanceof MyBatisMapperUpdate or
41+
mapperXml instanceof MyBatisMapperDelete
42+
) and
43+
this = mapperXml.getMapperMethod()
44+
)
45+
}
46+
}

0 commit comments

Comments
 (0)