Fix: Ensure clear_auth_cookie uses the correct secure and samesite settings #1959
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request fixes an issue where
clear_auth_cookie
did not explicitly specify thesecure
andsamesite
attributes when deleting authentication cookies.Issue:
set_auth_cookie
function correctly sets cookies using the_cookie_secure
and_cookie_samesite
values.CHAINLIT_COOKIE_SAMESITE
.CHAINLIT_COOKIE_SAMESITE
is"none"
, then_cookie_secure
is set toTrue
, ensuring the cookie is only sent over HTTPS._cookie_secure
isFalse
.clear_auth_cookie
did not apply these settings when deleting cookies.CHAINLIT_COOKIE_SAMESITE
to a value other than the default ("lax"
), the logout process could fail because the browser might not clear the cookie correctly.Fix:
clear_auth_cookie
now ensures that cookies are deleted using the samesecure
andsamesite
settings asset_auth_cookie
.This change improves consistency and ensures proper authentication cleanup across different deployment environments.