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(
135135 "%}" ) and
136136 annotation .getType ( ) instanceof TypeParam and
137137 ma .getAnArgument ( ) = node .asExpr ( ) and
138- annotation .getTarget ( ) = ma .getMethod ( ) .getParameter ( node .asExpr ( ) .getIndex ( ) )
138+ annotation .getTarget ( ) = ma .getMethod ( ) .getParameter ( node .asExpr ( ) .( Argument ) . getParameterPos ( ) )
139139 )
140140 or
141141 // 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) {
9090 mybatisSqlInjectionService .badInsert (name );
9191 }
9292
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 );
9696 }
9797
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 );
101101 }
102102}
Original file line number Diff line number Diff line change @@ -73,11 +73,11 @@ public void badInsert(String input) {
7373 sqlInjectionMapper .badInsert (input );
7474 }
7575
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 );
7878 }
7979
80- public void kkbad2 (String age ){
81- sqlInjectionMapper .kkbad2 (age );
80+ public void good3 (String age ){
81+ sqlInjectionMapper .good3 (age );
8282 }
8383}
Original file line number Diff line number Diff line change @@ -61,9 +61,9 @@ public interface SqlInjectionMapper {
6161 void badInsert (String input );
6262
6363 @ 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 );
6565
6666 @ Select ("select * from user_info where age = #{age}" )
67- String kkbad2 (@ Param ("age" ) String age );
67+ String good3 (@ Param ("age" ) String age );
6868
6969}
You can’t perform that action at this time.
0 commit comments