-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C#: HttpOnly and Secure cookie queries #5579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this contribution. I've added some comments inline. Also, can I ask you to merge the similar checks to Require HttpOnly and Require SSL respectively? I think it would be a lot cleaner for an end-user to have a single check than having 4 seperate queries:
- httponly is set to false in asp.net
- httponly is set to false in asp.net core
- httponly is not set, and therefore has its default value false in asp.net
- httponly is not set, and therefore has its default value false in asp.net core
for different variations of the same vulnerability.
csharp/ql/src/experimental/Security Features/CWE-1004/CookieHttpOnlyFalseAspNetCore.qhelp
Outdated
Show resolved
Hide resolved
csharp/ql/src/experimental/Security Features/CWE-1004/CookieHttpOnlyFalseSystemWeb.qhelp
Outdated
Show resolved
Hide resolved
csharp/ql/src/experimental/Security Features/CWE-1004/CookieWithoutHttpOnlyAspNetCore.qhelp
Outdated
Show resolved
Hide resolved
csharp/ql/src/experimental/Security Features/CWE-1004/CookieWithoutHttpOnlyAspNetCore.ql
Outdated
Show resolved
Hide resolved
csharp/ql/src/experimental/Security Features/CWE-1004/CookieWithoutHttpOnlySystemWeb.ql
Outdated
Show resolved
Hide resolved
csharp/ql/src/semmle/code/csharp/dataflow/flowsources/AuthCookie.qll
Outdated
Show resolved
Hide resolved
I thought it would be easier to maintain and drop legacy .NET queries when needed. Anyway, here we go - single queries. |
Ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the long waiting time. I've added some minor change requests. And in the meantime, I'm submitting the two queries to the Security Lab team for further review.
csharp/ql/src/semmle/code/csharp/dataflow/flowsources/AuthCookie.qll
Outdated
Show resolved
Hide resolved
csharp/ql/src/semmle/code/csharp/dataflow/flowsources/AuthCookie.qll
Outdated
Show resolved
Hide resolved
csharp/ql/src/experimental/Security Features/CWE-614/CookieWithoutSecure.ql
Show resolved
Hide resolved
csharp/ql/src/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll
Outdated
Show resolved
Hide resolved
Is there anything I need to do? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor comments, otherwise LGTM.
…s already covered by higher level `exists`
Rebased the pull request on top of main. Only the the last two commits are new. Please review. |
Ping |
|
Reworks
Secure
cookie detection for asp.net. AddsHttpOnly
attribute check. Adds both attributes and various callbacks and policy settings support for asp.net core.