File tree Expand file tree Collapse file tree 4 files changed +16
-0
lines changed
query-tests/Security Features/CWE-539/PersistentCookie Expand file tree Collapse file tree 4 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 1+ // semmle-extractor-options: ${testdir}/../../../../resources/stubs/System.Web.cs /r:System.Collections.Specialized.dll
2+ using System ;
3+
4+ class PersistentCookie
5+ {
6+ void M ( System . Web . HttpCookie cookie )
7+ {
8+ cookie . Expires = DateTime . Now . AddMonths ( 12 ) ; // BAD
9+ cookie . Expires = DateTime . Now . AddMinutes ( 3 ) ; // GOOD
10+ cookie . Expires = DateTime . Now . AddSeconds ( 301 ) ; // BAD
11+ }
12+ }
Original file line number Diff line number Diff line change 1+ | PersistentCookie.cs:8:9:8:51 | ... = ... | Avoid persistent cookies. |
2+ | PersistentCookie.cs:10:9:10:53 | ... = ... | Avoid persistent cookies. |
Original file line number Diff line number Diff line change 1+ Security Features/PersistentCookie.ql
Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ public class HttpCookie
183183 public NameValueCollection Values => null ;
184184 public string this [ string s ] { get => null ; set { } }
185185 public bool Secure { get ; set ; }
186+ public System . DateTime Expires { get ; set ; }
186187 }
187188
188189 public abstract class HttpCookieCollection : System . Collections . Specialized . NameObjectCollectionBase
You can’t perform that action at this time.
0 commit comments