Skip to content

Commit 16d7dc0

Browse files
authored
Restrict DF configuration
1 parent 04f1fe5 commit 16d7dc0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

java/ql/src/Security/CWE/CWE-614/InsecureCookie.ql

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,18 @@ predicate isSafeSecureCookieSetting(Expr e) {
2929
class SecureCookieConfiguration extends DataFlow::Configuration {
3030
SecureCookieConfiguration() { this = "SecureCookieConfiguration" }
3131

32-
override predicate isSource(DataFlow::Node source) { any() }
32+
override predicate isSource(DataFlow::Node source) {
33+
exists(Variable cookie, MethodAccess m |
34+
source.asExpr() = cookie.getAnAccess() and
35+
cookie.getAnAccess() = m.getQualifier() and
36+
m.getMethod().getName() = "setSecure"
37+
)
38+
}
3339

34-
override predicate isSink(DataFlow::Node sink) { any() }
40+
override predicate isSink(DataFlow::Node sink) {
41+
sink.asExpr() =
42+
any(MethodAccess add | add.getMethod() instanceof ResponseAddCookieMethod).getArgument(0)
43+
}
3544
}
3645

3746
from MethodAccess add, SecureCookieConfiguration df

0 commit comments

Comments
 (0)