- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.8k
 
Python: Split Insecure Cookie query into multiple queries #20494
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
Python: Split Insecure Cookie query into multiple queries #20494
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.
Pull Request Overview
This PR splits the existing py/insecure-cookie query into three separate, more focused queries to better align with JavaScript's cookie security query structure. The original query checked for multiple cookie security attributes in a single query, while the new approach separates concerns into distinct queries.
- Refactors 
py/insecure-cookieto only check for missingSecureattribute - Creates new 
py/client-exposed-cookiequery for missingHttpOnlyattribute - Creates new 
py/samesite-none-cookiequery forSameSite=Noneattribute issues 
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description | 
|---|---|
python/ql/src/Security/CWE-614/InsecureCookie.ql | 
Simplified to only check for missing Secure attribute | 
python/ql/src/Security/CWE-1004/NonHttpOnlyCookie.ql | 
New query for missing HttpOnly attribute | 
python/ql/src/Security/CWE-1275/SameSiteNoneCookie.ql | 
New query for SameSite=None issues | 
python/ql/test/query-tests/Security/CWE-614-InsecureCookie/test.py | 
Updated test with inline expectations for new query behavior | 
python/ql/src/change-notes/2025-09-19-insecure-cookie.md | 
Documents the query split changes | 
Comments suppressed due to low confidence (2)
| 
           QHelp previews: python/ql/src/Security/CWE-1004/NonHttpOnlyCookie.qhelpSensitive cookie missing 
 | 
    
| from Http::Server::CookieWrite cookie | ||
| where | ||
| cookie.hasHttpOnlyFlag(false) and | ||
| cookie.isSensitive() | ||
| select cookie, "Sensitive server cookie is set without HttpOnly flag." | 
Check warning
Code scanning / CodeQL
Consistent alert message Warning
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.
Looks good to me! The added documentation is especially nice. 👍
Splits the
py/insecure-cookiequery intopy/insecure-cookie,py/client-exposed-cookie, andpy/samesite-none-cookie.This is closer to how these queries are handled in JS with
js/clear-text-cookie,js/client-exposed-cookie, andjs/samesite-none-cookiequeries.