@@ -104,23 +104,9 @@ Expr getAValueForProp(ObjectCreation create, Assignment a, string prop) {
104
104
}
105
105
106
106
/**
107
- * Similar to getAValueForProp, checks if the given property was explicitly set to a value.
107
+ * Checks if the given property was explicitly set to a value.
108
108
*/
109
- predicate isPropertySet ( ObjectCreation oc , string prop ) {
110
- exists ( Assignment a , PropertyAccess pa |
111
- a .getLValue ( ) = pa and
112
- pa .getTarget ( ) .hasName ( prop ) and
113
- DataFlow:: localExprFlow ( oc , pa .getQualifier ( ) )
114
- )
115
- or
116
- exists ( Assignment a , PropertyAccess pa , Expr src |
117
- a .getLValue ( ) = pa and
118
- pa .getTarget ( ) .hasName ( prop ) and
119
- a .getRValue ( ) = src and
120
- DataFlow:: localExprFlow ( src ,
121
- oc .getInitializer ( ) .( ObjectInitializer ) .getAMemberInitializer ( ) .getRValue ( ) )
122
- )
123
- }
109
+ predicate isPropertySet ( ObjectCreation oc , string prop ) { exists ( getAValueForProp ( oc , _, prop ) ) }
124
110
125
111
/**
126
112
* Tracks if a callback used in `OnAppendCookie` sets `Secure` to `true`.
@@ -143,7 +129,7 @@ class OnAppendCookieHttpOnlyTrackingConfig extends OnAppendCookieTrackingConfig
143
129
/**
144
130
* Tracks if a callback used in `OnAppendCookie` sets a cookie property to `true`.
145
131
*/
146
- private abstract class OnAppendCookieTrackingConfig extends DataFlow:: Configuration {
132
+ abstract private class OnAppendCookieTrackingConfig extends DataFlow:: Configuration {
147
133
bindingset [ this ]
148
134
OnAppendCookieTrackingConfig ( ) { any ( ) }
149
135
@@ -186,6 +172,10 @@ private abstract class OnAppendCookieTrackingConfig extends DataFlow::Configurat
186
172
}
187
173
188
174
override predicate isAdditionalFlowStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
189
- node2 .asExpr ( ) = any ( PropertyRead other | other .getQualifier ( ) = node1 .asExpr ( ) )
175
+ node2 .asExpr ( ) =
176
+ any ( PropertyRead pr |
177
+ pr .getQualifier ( ) = node1 .asExpr ( ) and
178
+ pr .getProperty ( ) .getDeclaringType ( ) instanceof MicrosoftAspNetCoreCookiePolicyAppendCookieContext
179
+ )
190
180
}
191
181
}
0 commit comments