-
Notifications
You must be signed in to change notification settings - Fork 0
/
CA5382.yaml
36 lines (35 loc) · 1.01 KB
/
CA5382.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
rules:
- id: CA5382
patterns:
# - pattern-not: |
# public class Startup
# {
# public void Configure(...)
# {
# app.UseCookiePolicy(
# new CookiePolicyOptions
# {
# Secure = CookieSecurePolicy.Always
# });
# }
# }
- pattern-inside: |
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Internal;
...
- pattern: |
var $VAR = new CookieOptions();
...
$VAR.Secure = false;
...
var $X = new ResponseCookies(...);
...
$X.Append(..., $VAR);
message: Use secure cookies in ASP.NET Core
metadata:
cwe: 'CWE-614: Sensitive Cookie in HTTPS Session Without 'Secure' Attribute'
references:
- https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca5382
languages: [csharp]
fix: $VAR.Secure = true;
severity: WARNING