@@ -13,7 +13,6 @@ private import semmle.code.java.frameworks.spring.SpringHttp
1313private import semmle.code.java.Maps
1414private import semmle.code.java.dataflow.internal.ContainerFlow
1515private import semmle.code.java.frameworks.jackson.JacksonSerializability
16- private import semmle.code.java.StringFormat
1716
1817/**
1918 * Holds if taint can flow from `src` to `sink` in zero or more
@@ -391,10 +390,8 @@ private predicate taintPreservingQualifierToMethod(Method m) {
391390 )
392391 )
393392 or
394- m instanceof StringFormatMethod
395- or
396393 m .getDeclaringType ( ) instanceof TypeFormatter and
397- m .hasName ( " out")
394+ m .hasName ( [ "format" , " out"] )
398395}
399396
400397private class StringReplaceMethod extends Method {
@@ -454,10 +451,10 @@ private predicate argToMethodStep(Expr tracked, MethodAccess sink) {
454451 */
455452private predicate taintPreservingArgumentToMethod ( Method method ) {
456453 method .getDeclaringType ( ) instanceof TypeString and
457- method .hasName ( "join" )
454+ ( method .hasName ( "format" ) or method . hasName ( "formatted" ) or method . hasName ( " join") )
458455 or
459- method instanceof StringFormatMethod and
460- not method .getDeclaringType ( ) . hasQualifiedName ( "java.io" , "Console ")
456+ method . getDeclaringType ( ) instanceof TypeFormatter and
457+ method .hasName ( "format ")
461458}
462459
463460/**
@@ -637,9 +634,8 @@ private predicate argToQualifierStep(Expr tracked, Expr sink) {
637634 sink = ma .getQualifier ( )
638635 )
639636 or
640- exists ( Method m , MethodAccess ma |
641- taintPreservingArgumentToQualifier ( m ) and
642- ma .getMethod ( ) = m and
637+ exists ( MethodAccess ma |
638+ taintPreservingArgumentToQualifier ( ma .getMethod ( ) ) and
643639 tracked = ma .getAnArgument ( ) and
644640 sink = ma .getQualifier ( )
645641 )
@@ -649,9 +645,8 @@ private predicate argToQualifierStep(Expr tracked, Expr sink) {
649645 * Holds if `method` is a method that transfers taint from any of its arguments to its qualifier.
650646 */
651647private predicate taintPreservingArgumentToQualifier ( Method method ) {
652- method instanceof StringFormatMethod and
653- not method .getDeclaringType ( ) instanceof TypeString and
654- not method .getDeclaringType ( ) .hasQualifiedName ( "java.io" , "Console" )
648+ method .getDeclaringType ( ) instanceof TypeFormatter and
649+ method .hasName ( "format" )
655650}
656651
657652/**
0 commit comments