Skip to content

Commit 69531b9

Browse files
committed
Sync ResponseSplittingLocalQuery
1 parent ef28295 commit 69531b9

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

java/ql/lib/semmle/code/java/security/ResponseSplittingLocalQuery.qll

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,21 @@ module ResponseSplittingLocalConfig implements DataFlow::ConfigSig {
1313
predicate isSink(DataFlow::Node sink) { sink instanceof HeaderSplittingSink }
1414

1515
predicate isBarrier(DataFlow::Node node) {
16-
node.getType() instanceof PrimitiveType or
16+
node.getType() instanceof PrimitiveType
17+
or
1718
node.getType() instanceof BoxedType
19+
or
20+
exists(MethodAccess ma, string methodName, CompileTimeConstantExpr target |
21+
node.asExpr() = ma and
22+
ma.getMethod().hasQualifiedName("java.lang", "String", methodName) and
23+
target = ma.getArgument(0) and
24+
(
25+
methodName = "replace" and target.getIntValue() = [10, 13] // 10 == "\n", 13 == "\r"
26+
or
27+
methodName = "replaceAll" and
28+
target.getStringValue().regexpMatch(".*([\n\r]|\\[\\^[^\\]\r\n]*\\]).*")
29+
)
30+
)
1831
}
1932
}
2033

0 commit comments

Comments
 (0)