Skip to content

Potential fix for code scanning alert no. 14: Failure to use secure cookies - #906

Closed
SaboniAmine wants to merge 1 commit into
masterfrom
fix/set_secure_flag_cookie_read
Closed

Potential fix for code scanning alert no. 14: Failure to use secure cookies#906
SaboniAmine wants to merge 1 commit into
masterfrom
fix/set_secure_flag_cookie_read

Conversation

@SaboniAmine

Copy link
Copy Markdown
Member

Potential fix for https://github.com/mlco2/codecarbon/security/code-scanning/14

To address the issue, we should ensure that the cookie is always created with secure attributes:

  1. Set the secure attribute to True to ensure the cookie is only transmitted over HTTPS.
  2. Add the samesite attribute with a value of 'Lax' to protect against CSRF attacks while allowing some cross-origin requests.
  3. Verify that the httponly attribute remains set to True to prevent JavaScript access to the cookie.

These changes should be applied to the response.set_cookie call in the provided code.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…ookies

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@benoit-cty

Copy link
Copy Markdown
Contributor

Hello @SaboniAmine is this PR still needed ?

@SaboniAmine

Copy link
Copy Markdown
Member Author

No, we can close it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants