@@ -30,11 +30,15 @@ predicate cookieAppendSecureByDefault() {
3030 OnAppendCookieSecureTracking:: flowTo ( _)
3131}
3232
33- predicate secureFalseOrNotSet ( ObjectCreation oc ) {
33+ predicate secureFalse ( ObjectCreation oc ) {
3434 exists ( Assignment a |
3535 getAValueForProp ( oc , a , "Secure" ) = a .getRValue ( ) and
3636 a .getRValue ( ) .getValue ( ) = "false"
3737 )
38+ }
39+
40+ predicate secureFalseOrNotSet ( ObjectCreation oc ) {
41+ secureFalse ( oc )
3842 or
3943 not isPropertySet ( oc , "Secure" )
4044}
@@ -58,12 +62,13 @@ predicate insecureCookieAppend(Expr sink) {
5862 )
5963}
6064
61- predicate insecureCookieCreationFromConfig ( Expr sink ) {
62- // `Secure` property in `System.Web.HttpCookie` wasn't set, so a default value from config is used
63- exists ( ObjectCreation oc |
64- oc = sink and
65- oc .getType ( ) instanceof SystemWebHttpCookie and
66- not isPropertySet ( oc , "Secure" ) and
65+ predicate insecureCookieCreation ( ObjectCreation oc ) {
66+ oc .getType ( ) instanceof SystemWebHttpCookie and
67+ (
68+ secureFalse ( oc )
69+ or
70+ // `Secure` property in `System.Web.HttpCookie` wasn't set, so a default value from config is used
71+ isPropertySet ( oc , "Secure" ) and
6772 // the default in config is not set to `true`
6873 // the `exists` below covers the `cs/web/requiressl-not-set`
6974 not exists ( XmlElement element |
@@ -84,27 +89,9 @@ predicate insecureCookieCall(Call c) {
8489 insecureCookieAppend ( c )
8590 )
8691 or
87- insecureCookieCreationFromConfig ( c )
92+ insecureCookieCreation ( c )
8893}
8994
90- // predicate insecureCookieCreationAssignment(Assignment a, Expr val) {
91- // exists(ObjectCreation oc |
92- // getAValueForProp(oc, a, "Secure") = val and
93- // val.getValue() = "false" and
94- // (
95- // oc.getType() instanceof SystemWebHttpCookie
96- // or
97- // oc.getType() instanceof MicrosoftAspNetCoreHttpCookieOptions and
98- // // there is no callback `OnAppendCookie` that sets `Secure` to true
99- // not OnAppendCookieSecureTracking::flowTo(_) and
100- // // the cookie option is passed to `Append`
101- // exists(DataFlow::Node creation |
102- // CookieOptionsTracking::flow(creation, _) and
103- // creation.asExpr() = oc
104- // )
105- // )
106- // )
107- // }
10895predicate insecureSecurePolicyAssignment ( Assignment a , Expr val ) {
10996 exists ( PropertyWrite pw |
11097 (
0 commit comments