File tree Expand file tree Collapse file tree 4 files changed +13
-13
lines changed
src/experimental/Security/CWE/CWE-089
test/experimental/query-tests/security/CWE-089/src/main Expand file tree Collapse file tree 4 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ predicate isMybatisXmlOrAnnotationSqlInjection(
135
135
"%}" ) and
136
136
annotation .getType ( ) instanceof TypeParam and
137
137
ma .getAnArgument ( ) = node .asExpr ( ) and
138
- annotation .getTarget ( ) = ma .getMethod ( ) .getParameter ( node .asExpr ( ) .getIndex ( ) )
138
+ annotation .getTarget ( ) = ma .getMethod ( ) .getParameter ( node .asExpr ( ) .( Argument ) . getParameterPos ( ) )
139
139
)
140
140
or
141
141
// MyBatis default parameter sql injection vulnerabilities.the default parameter form of the method is arg[0...n] or param[1...n].
Original file line number Diff line number Diff line change @@ -90,13 +90,13 @@ public void badInsert(@RequestParam String name) {
90
90
mybatisSqlInjectionService .badInsert (name );
91
91
}
92
92
93
- @ GetMapping (value = "kkbad1 " )
94
- public void kkbad1 (@ RequestParam String name , @ RequestParam Integer age ) {
95
- mybatisSqlInjectionService .kkbad1 (name , age );
93
+ @ GetMapping (value = "good2 " )
94
+ public void good2 (@ RequestParam String name , @ RequestParam Integer age ) {
95
+ mybatisSqlInjectionService .good2 (name , age );
96
96
}
97
97
98
- @ GetMapping (value = "kkbad2 " )
99
- public void kkbad2 (@ RequestParam String age ) {
100
- mybatisSqlInjectionService .kkbad2 (age );
98
+ @ GetMapping (value = "good3 " )
99
+ public void good3 (@ RequestParam String age ) {
100
+ mybatisSqlInjectionService .good3 (age );
101
101
}
102
102
}
Original file line number Diff line number Diff line change @@ -73,11 +73,11 @@ public void badInsert(String input) {
73
73
sqlInjectionMapper .badInsert (input );
74
74
}
75
75
76
- public void kkbad1 (String name , Integer age ){
77
- sqlInjectionMapper .kkbad1 (name , age );
76
+ public void good2 (String name , Integer age ){
77
+ sqlInjectionMapper .good2 (name , age );
78
78
}
79
79
80
- public void kkbad2 (String age ){
81
- sqlInjectionMapper .kkbad2 (age );
80
+ public void good3 (String age ){
81
+ sqlInjectionMapper .good3 (age );
82
82
}
83
83
}
Original file line number Diff line number Diff line change @@ -61,9 +61,9 @@ public interface SqlInjectionMapper {
61
61
void badInsert (String input );
62
62
63
63
@ Select ("select * from user_info where name = #{name} and age = ${age}" )
64
- String kkbad1 (@ Param ("name" ) String name , Integer age );
64
+ String good2 (@ Param ("name" ) String name , Integer age );
65
65
66
66
@ Select ("select * from user_info where age = #{age}" )
67
- String kkbad2 (@ Param ("age" ) String age );
67
+ String good3 (@ Param ("age" ) String age );
68
68
69
69
}
You can’t perform that action at this time.
0 commit comments