File tree Expand file tree Collapse file tree
Security Features/CWE-614
experimental/Security Features/CWE-614
csharp/dataflow/flowsources Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ import csharp
1717import semmle.code.asp.WebConfig
1818import semmle.code.csharp.frameworks.system.Web
1919
20+ // the query is a subset of `cs/web/cookie-secure-not-set` and
21+ // should be removed once it is promoted from experimental
2022from XMLElement element
2123where
2224 element instanceof FormsElement and
Original file line number Diff line number Diff line change 6363 // the property wasn't explicitly set, so a default value from config is used
6464 not isPropertySet ( oc , "Secure" ) and
6565 // the default in config is not set to `true`
66+ // the `exists` below covers the `cs/web/cookie-secure-not-set`
6667 not exists ( XMLElement element |
6768 element instanceof FormsElement and
6869 element .( FormsElement ) .isRequireSSL ( )
Original file line number Diff line number Diff line change @@ -70,28 +70,40 @@ class FormsElement extends XMLElement {
7070 this = any ( SystemWebXMLElement sw ) .getAChild ( "authentication" ) .getAChild ( "forms" )
7171 }
7272
73+ /**
74+ * Gets attribute's `requireSSL` value.
75+ */
7376 string getRequireSSL ( ) { result = getAttribute ( "requireSSL" ) .getValue ( ) .trim ( ) .toLowerCase ( ) }
7477
78+ /**
79+ * Holds if `requireSSL` value is true.
80+ */
7581 predicate isRequireSSL ( ) { getRequireSSL ( ) = "true" }
7682}
7783
7884/** A `<httpCookies>` tag in an ASP.NET configuration file. */
7985class HttpCookiesElement extends XMLElement {
8086 HttpCookiesElement ( ) { this = any ( SystemWebXMLElement sw ) .getAChild ( "httpCookies" ) }
8187
88+ /**
89+ * Gets attribute's `httpOnlyCookies` value.
90+ */
8291 string getHttpOnlyCookies ( ) {
8392 result = getAttribute ( "httpOnlyCookies" ) .getValue ( ) .trim ( ) .toLowerCase ( )
8493 }
8594
8695 /**
87- * Holds if there any chance that `httpOnlyCookies` is set to `true`.
96+ * Holds if there is any chance that `httpOnlyCookies` is set to `true`.
8897 */
8998 predicate isHttpOnlyCookies ( ) { getHttpOnlyCookies ( ) = "true" }
9099
100+ /**
101+ * Gets attribute's `requireSSL` value.
102+ */
91103 string getRequireSSL ( ) { result = getAttribute ( "requireSSL" ) .getValue ( ) .trim ( ) .toLowerCase ( ) }
92104
93105 /**
94- * Holds if there any chance that `requireSSL` is set to `true` either globally or for Forms.
106+ * Holds if there is any chance that `requireSSL` is set to `true` either globally or for Forms.
95107 */
96108 predicate isRequireSSL ( ) {
97109 getRequireSSL ( ) = "true"
Original file line number Diff line number Diff line change @@ -141,10 +141,16 @@ class OnAppendCookieHttpOnlyTrackingConfig extends OnAppendCookieTrackingConfig
141141 override string propertyName ( ) { result = "HttpOnly" }
142142}
143143
144+ /**
145+ * Tracks if a callback used in `OnAppendCookie` sets a cookie property to `true`.
146+ */
144147abstract class OnAppendCookieTrackingConfig extends DataFlow:: Configuration {
145148 bindingset [ this ]
146149 OnAppendCookieTrackingConfig ( ) { any ( ) }
147150
151+ /**
152+ * Specifies the cookie property name to track.
153+ */
148154 abstract string propertyName ( ) ;
149155
150156 override predicate isSource ( DataFlow:: Node source ) {
You can’t perform that action at this time.
0 commit comments