@@ -9,18 +9,16 @@ import semmle.code.csharp.frameworks.microsoft.AspNetCore
99 * Holds if the expression is a variable with a sensitive name.
1010 */
1111predicate 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
1414 sink .asExpr ( ) = cookieExpr
1515 )
1616}
1717
1818/**
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.
2020 */
21- private class AuthCookieNameConfiguration extends DataFlow:: Configuration {
22- AuthCookieNameConfiguration ( ) { this = "AuthCookieNameConfiguration" }
23-
21+ private module AuthCookieNameConfig implements DataFlow:: ConfigSig {
2422 private predicate isAuthVariable ( Expr expr ) {
2523 exists ( string val |
2624 (
@@ -32,13 +30,16 @@ private class AuthCookieNameConfiguration extends DataFlow::Configuration {
3230 )
3331 }
3432
35- override predicate isSource ( DataFlow:: Node source ) { isAuthVariable ( source .asExpr ( ) ) }
33+ predicate isSource ( DataFlow:: Node source ) { isAuthVariable ( source .asExpr ( ) ) }
3634
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 ( ) ) }
4036}
4137
38+ /**
39+ * Tracks if a variable with a sensitive name is used as an argument.
40+ */
41+ private module AuthCookieName = DataFlow:: Global< AuthCookieNameConfig > ;
42+
4243/**
4344 * DEPRECATED: Use `CookieOptionsTracking` instead.
4445 *
0 commit comments