@@ -104,23 +104,9 @@ Expr getAValueForProp(ObjectCreation create, Assignment a, string prop) {
104104}
105105
106106/**
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.
108108 */
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 ) ) }
124110
125111/**
126112 * Tracks if a callback used in `OnAppendCookie` sets `Secure` to `true`.
@@ -143,7 +129,7 @@ class OnAppendCookieHttpOnlyTrackingConfig extends OnAppendCookieTrackingConfig
143129/**
144130 * Tracks if a callback used in `OnAppendCookie` sets a cookie property to `true`.
145131 */
146- private abstract class OnAppendCookieTrackingConfig extends DataFlow:: Configuration {
132+ abstract private class OnAppendCookieTrackingConfig extends DataFlow:: Configuration {
147133 bindingset [ this ]
148134 OnAppendCookieTrackingConfig ( ) { any ( ) }
149135
@@ -186,6 +172,10 @@ private abstract class OnAppendCookieTrackingConfig extends DataFlow::Configurat
186172 }
187173
188174 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+ )
190180 }
191181}
0 commit comments