зеркало из https://github.com/github/codeql.git
Apply suggestions from code review
This commit is contained in:
Родитель
d113fb23c8
Коммит
443d0f50c1
|
@ -135,7 +135,7 @@ predicate isMybatisXmlOrAnnotationSqlInjection(
|
|||
"%}") and
|
||||
annotation.getType() instanceof TypeParam and
|
||||
ma.getAnArgument() = node.asExpr() and
|
||||
annotation.getTarget() = ma.getMethod().getParameter(node.asExpr().getIndex())
|
||||
annotation.getTarget() = ma.getMethod().getParameter(node.asExpr().(Argument).getParameterPos())
|
||||
)
|
||||
or
|
||||
// MyBatis default parameter sql injection vulnerabilities.the default parameter form of the method is arg[0...n] or param[1...n].
|
||||
|
|
|
@ -90,13 +90,13 @@ public class MybatisSqlInjection {
|
|||
mybatisSqlInjectionService.badInsert(name);
|
||||
}
|
||||
|
||||
@GetMapping(value = "kkbad1")
|
||||
public void kkbad1(@RequestParam String name, @RequestParam Integer age) {
|
||||
mybatisSqlInjectionService.kkbad1(name, age);
|
||||
@GetMapping(value = "good2")
|
||||
public void good2(@RequestParam String name, @RequestParam Integer age) {
|
||||
mybatisSqlInjectionService.good2(name, age);
|
||||
}
|
||||
|
||||
@GetMapping(value = "kkbad2")
|
||||
public void kkbad2(@RequestParam String age) {
|
||||
mybatisSqlInjectionService.kkbad2(age);
|
||||
@GetMapping(value = "good3")
|
||||
public void good3(@RequestParam String age) {
|
||||
mybatisSqlInjectionService.good3(age);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,11 +73,11 @@ public class MybatisSqlInjectionService {
|
|||
sqlInjectionMapper.badInsert(input);
|
||||
}
|
||||
|
||||
public void kkbad1(String name, Integer age){
|
||||
sqlInjectionMapper.kkbad1(name, age);
|
||||
public void good2(String name, Integer age){
|
||||
sqlInjectionMapper.good2(name, age);
|
||||
}
|
||||
|
||||
public void kkbad2(String age){
|
||||
sqlInjectionMapper.kkbad2(age);
|
||||
public void good3(String age){
|
||||
sqlInjectionMapper.good3(age);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,9 +61,9 @@ public interface SqlInjectionMapper {
|
|||
void badInsert(String input);
|
||||
|
||||
@Select("select * from user_info where name = #{name} and age = ${age}")
|
||||
String kkbad1(@Param("name") String name, Integer age);
|
||||
String good2(@Param("name") String name, Integer age);
|
||||
|
||||
@Select("select * from user_info where age = #{age}")
|
||||
String kkbad2(@Param("age") String age);
|
||||
String good3(@Param("age") String age);
|
||||
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче