Skip to content

Conversation

joefarebrother
Copy link
Contributor

Splits the py/insecure-cookie query into py/insecure-cookie, py/client-exposed-cookie, and py/samesite-none-cookie.
This is closer to how these queries are handled in JS with js/clear-text-cookie, js/client-exposed-cookie, and js/samesite-none-cookie queries.

@joefarebrother joefarebrother requested a review from a team as a code owner September 19, 2025 14:32
@Copilot Copilot AI review requested due to automatic review settings September 19, 2025 14:32
Copy link
Contributor

@Copilot Copilot AI left a 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-cookie to only check for missing Secure attribute
  • Creates new py/client-exposed-cookie query for missing HttpOnly attribute
  • Creates new py/samesite-none-cookie query for SameSite=None attribute 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)

Comment on lines +17 to +19
from Http::Server::CookieWrite cookie
where cookie.hasHttpOnlyFlag(false)
select cookie, "Cookie is added without the HttpOnly attribute properly set."

Check warning

Code scanning / CodeQL

Consistent alert message Warning

The py/client-exposed-cookie query does not have the same alert message as js.
Comment on lines +17 to +19
from Http::Server::CookieWrite cookie
where cookie.hasSameSiteAttribute(any(Http::Server::CookieWrite::SameSiteNone v))
select cookie, "Cookie is added with the SameSite attribute set to None."

Check warning

Code scanning / CodeQL

Consistent alert message Warning

The py/samesite-none-cookie query does not have the same alert message as js.
Comment on lines +18 to +20
from Http::Server::CookieWrite cookie
where cookie.hasSecureFlag(false)
select cookie, "Cookie is added without the Secure attribute properly set."

Check warning

Code scanning / CodeQL

Consistent alert message Warning

The py/insecure-cookie query does not have the same alert message as java.
@joefarebrother joefarebrother marked this pull request as draft September 19, 2025 21:41
@joefarebrother joefarebrother changed the title Python: Split Insecure Cookie query into multiple queries [Draft] Python: Split Insecure Cookie query into multiple queries Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant