mirror of
https://github.com/github/codeql.git
synced 2026-04-17 21:14:02 +02:00
Java: handle MyBatis annotations for insert/update/delete
This commit is contained in:
@@ -36,9 +36,9 @@ private class SpringCsrfUnprotectedMethod extends CsrfUnprotectedMethod instance
|
||||
/** A method that updates a database. */
|
||||
abstract class DatabaseUpdateMethod extends Method { }
|
||||
|
||||
/** A MyBatis Mapper method that updates a database. */
|
||||
private class MyBatisMapperDatabaseUpdateMethod extends DatabaseUpdateMethod {
|
||||
MyBatisMapperDatabaseUpdateMethod() {
|
||||
/** A MyBatis method that updates a database. */
|
||||
private class MyBatisDatabaseUpdateMethod extends DatabaseUpdateMethod {
|
||||
MyBatisDatabaseUpdateMethod() {
|
||||
exists(MyBatisMapperSqlOperation mapperXml |
|
||||
(
|
||||
mapperXml instanceof MyBatisMapperInsert or
|
||||
@@ -47,6 +47,14 @@ private class MyBatisMapperDatabaseUpdateMethod extends DatabaseUpdateMethod {
|
||||
) and
|
||||
this = mapperXml.getMapperMethod()
|
||||
)
|
||||
or
|
||||
exists(MyBatisSqlOperationAnnotationMethod m | this = m |
|
||||
not m.getAnAnnotation().getType().hasQualifiedName("org.apache.ibatis.annotations", "Select")
|
||||
)
|
||||
or
|
||||
exists(Method m | this = m |
|
||||
m.hasAnnotation("org.apache.ibatis.annotations", ["Delete", "Update", "Insert"] + "Provider")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user