File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
java/ql/src/Security/CWE/CWE-614 Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,8 @@ predicate isSafeSecureCookieSetting(Expr e) {
26
26
)
27
27
}
28
28
29
- class SecureCookieConfiguration extends DataFlow:: Configuration {
30
- SecureCookieConfiguration ( ) { this = "SecureCookieConfiguration" }
31
-
32
- override predicate isSource ( DataFlow:: Node source ) {
29
+ private module SecureCookieConfiguration implements DataFlow:: ConfigSig {
30
+ predicate isSource ( DataFlow:: Node source ) {
33
31
exists ( MethodAccess ma , Method m | ma .getMethod ( ) = m |
34
32
m .getDeclaringType ( ) instanceof TypeCookie and
35
33
m .getName ( ) = "setSecure" and
@@ -43,14 +41,16 @@ class SecureCookieConfiguration extends DataFlow::Configuration {
43
41
)
44
42
}
45
43
46
- override predicate isSink ( DataFlow:: Node sink ) {
44
+ predicate isSink ( DataFlow:: Node sink ) {
47
45
sink .asExpr ( ) =
48
46
any ( MethodAccess add | add .getMethod ( ) instanceof ResponseAddCookieMethod ) .getArgument ( 0 )
49
47
}
50
48
}
51
49
50
+ module SecureCookieFlow = DataFlow:: Make< SecureCookieConfiguration > ;
51
+
52
52
from MethodAccess add
53
53
where
54
54
add .getMethod ( ) instanceof ResponseAddCookieMethod and
55
- not any ( SecureCookieConfiguration df ) . hasFlowToExpr ( add .getArgument ( 0 ) )
55
+ not SecureCookieFlow :: hasFlowToExpr ( add .getArgument ( 0 ) )
56
56
select add , "Cookie is added to response without the 'secure' flag being set."
You can’t perform that action at this time.
0 commit comments