Skip to content

fix: improve cookie handling in chat and login views for HTTPS support - #6561

Merged
wxg0103 merged 1 commit into
v2from
pr@v2@fix_file_auth
Aug 3, 2026
Merged

fix: improve cookie handling in chat and login views for HTTPS support#6561
wxg0103 merged 1 commit into
v2from
pr@v2@fix_file_auth

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

fix: improve cookie handling in chat and login views for HTTPS support

Copilot AI review requested due to automatic review settings August 3, 2026 05:52
@shaohuzhang1

Copy link
Copy Markdown
Contributor Author

Seems you are using me but didn't get OPENAI_API_KEY seted in Variables/Secrets for this repo. you could follow readme for more information

@wxg0103
wxg0103 merged commit 12396b0 into v2 Aug 3, 2026
5 of 7 checks passed
@wxg0103
wxg0103 deleted the pr@v2@fix_file_auth branch August 3, 2026 05:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Ready to approve

The changes are small, localized, and correct the invalid SameSite=None + non-secure cookie combination that modern browsers reject.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

This PR adjusts how the mk_file_auth cookie is set in both the admin login flow and the chat anonymous-auth flow to better support HTTPS vs. non-HTTPS environments, avoiding browser rejection of SameSite=None cookies when not served securely.

Changes:

  • Introduces an is_https flag and uses it to control secure and samesite cookie attributes.
  • Switches samesite to "Lax" when not HTTPS, keeping "None" only for HTTPS.
  • Minor cleanup of set_cookie call style (explicit key=..., removal of redundant domain=None).
File summaries
File Description
apps/users/views/login.py Sets mk_file_auth cookie with SameSite=None only on HTTPS; otherwise uses Lax to prevent browser rejection.
apps/chat/views/chat.py Applies the same HTTPS-aware mk_file_auth cookie handling for anonymous chat authentication responses.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants