@@ -9,18 +9,16 @@ import semmle.code.csharp.frameworks.microsoft.AspNetCore
9
9
* Holds if the expression is a variable with a sensitive name.
10
10
*/
11
11
predicate isCookieWithSensitiveName ( Expr cookieExpr ) {
12
- exists ( AuthCookieNameConfiguration dataflow , DataFlow:: Node sink |
13
- dataflow . hasFlowTo ( sink ) and
12
+ exists ( DataFlow:: Node sink |
13
+ AuthCookieName :: flowTo ( sink ) and
14
14
sink .asExpr ( ) = cookieExpr
15
15
)
16
16
}
17
17
18
18
/**
19
- * Tracks if a variable with a sensitive name is used as an argument.
19
+ * Configuration for tracking if a variable with a sensitive name is used as an argument.
20
20
*/
21
- private class AuthCookieNameConfiguration extends DataFlow:: Configuration {
22
- AuthCookieNameConfiguration ( ) { this = "AuthCookieNameConfiguration" }
23
-
21
+ private module AuthCookieNameConfig implements DataFlow:: ConfigSig {
24
22
private predicate isAuthVariable ( Expr expr ) {
25
23
exists ( string val |
26
24
(
@@ -32,13 +30,16 @@ private class AuthCookieNameConfiguration extends DataFlow::Configuration {
32
30
)
33
31
}
34
32
35
- override predicate isSource ( DataFlow:: Node source ) { isAuthVariable ( source .asExpr ( ) ) }
33
+ predicate isSource ( DataFlow:: Node source ) { isAuthVariable ( source .asExpr ( ) ) }
36
34
37
- override predicate isSink ( DataFlow:: Node sink ) {
38
- exists ( Call c | sink .asExpr ( ) = c .getAnArgument ( ) )
39
- }
35
+ predicate isSink ( DataFlow:: Node sink ) { exists ( Call c | sink .asExpr ( ) = c .getAnArgument ( ) ) }
40
36
}
41
37
38
+ /**
39
+ * Tracks if a variable with a sensitive name is used as an argument.
40
+ */
41
+ private module AuthCookieName = DataFlow:: Global< AuthCookieNameConfig > ;
42
+
42
43
/**
43
44
* DEPRECATED: Use `CookieOptionsTracking` instead.
44
45
*
0 commit comments