Skip to content

Commit bf4d881

Browse files
author
Sebastian Bauersfeld
committed
Consider boxed booleans to avoid false positives for XXE.ql
1 parent 8f152b7 commit bf4d881

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

java/ql/src/semmle/code/java/security/XmlParsers.qll

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,21 @@ abstract class ParserConfig extends MethodAccess {
3636
*/
3737
predicate disables(Expr e) {
3838
this.getArgument(0) = e and
39-
this.getArgument(1).(BooleanLiteral).getBooleanValue() = false
39+
(
40+
this.getArgument(1).(BooleanLiteral).getBooleanValue() = false or
41+
this.getArgument(1).(FieldAccess).getField().hasQualifiedName("java.lang", "Boolean", "FALSE")
42+
)
4043
}
4144

4245
/**
4346
* Holds if the method enables a property.
4447
*/
4548
predicate enables(Expr e) {
4649
this.getArgument(0) = e and
47-
this.getArgument(1).(BooleanLiteral).getBooleanValue() = true
50+
(
51+
this.getArgument(1).(BooleanLiteral).getBooleanValue() = true or
52+
this.getArgument(1).(FieldAccess).getField().hasQualifiedName("java.lang", "Boolean", "TRUE")
53+
)
4854
}
4955
}
5056

0 commit comments

Comments
 (0)