Skip to content

Commit efc3a25

Browse files
Java: Don't pass taint through the format methods of Console
1 parent eccfa5d commit efc3a25

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

java/ql/src/semmle/code/java/dataflow/internal/TaintTrackingUtil.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@ private predicate taintPreservingArgumentToMethod(Method method) {
456456
method.getDeclaringType() instanceof TypeString and
457457
method.hasName("join")
458458
or
459-
method instanceof StringFormatMethod
459+
method instanceof StringFormatMethod and
460+
not method.getDeclaringType().hasQualifiedName("java.io", "Console")
460461
}
461462

462463
/**
@@ -649,7 +650,8 @@ private predicate argToQualifierStep(Expr tracked, Expr sink) {
649650
*/
650651
private predicate taintPreservingArgumentToQualifier(Method method) {
651652
method instanceof StringFormatMethod and
652-
not method.getDeclaringType() instanceof TypeString
653+
not method.getDeclaringType() instanceof TypeString and
654+
not method.getDeclaringType().hasQualifiedName("java.io", "Console")
653655
}
654656

655657
/**

0 commit comments

Comments
 (0)