fix: match cookie parameters when deleting cookies in logout endpoint - #10527
Conversation
This fixes a critical logout bug where users would appear logged out but remain authenticated in the background. The issue occurred because the logout endpoint was deleting cookies without matching the security parameters (httponly, samesite, secure, domain) used when creating them. Browsers require exact parameter matching to delete cookies, so the authentication cookies remained active despite logout confirmation. Changes: - Updated logout endpoint to use the same cookie parameters as login - Ensures proper cookie deletion in all environments (HTTP/HTTPS) - Fixes security issue in shared computer scenarios Fixes langflow-ai#8641
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe logout endpoint now deletes cookies using parameters sourced from auth_settings, ensuring consistent secure attributes (HttpOnly, Secure, SameSite, domain) between cookie creation during login and cookie deletion during logout. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touchesImportant Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (3 warnings, 2 inconclusive)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hey @Cristhianzl, Original PR #8643 lost its commits after an accidental Sync Fork overwrote the branch. This PR contains the same fix - just recreated. Thanks for your previous approval! |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/backend/base/langflow/api/v1/login.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
{src/backend/**/*.py,tests/**/*.py,Makefile}
📄 CodeRabbit inference engine (.cursor/rules/backend_development.mdc)
{src/backend/**/*.py,tests/**/*.py,Makefile}: Run make format_backend to format Python code before linting or committing changes
Run make lint to perform linting checks on backend Python code
Files:
src/backend/base/langflow/api/v1/login.py
🧬 Code graph analysis (1)
src/backend/base/langflow/api/v1/login.py (1)
src/backend/base/langflow/services/deps.py (1)
get_settings_service(122-135)
🪛 GitHub Actions: Ruff Style Check
src/backend/base/langflow/api/v1/login.py
[error] 164-164: Ruff check failed. W293 Blank line contains whitespace. Command: uv run --only-dev ruff check --output-format=github .
🪛 GitHub Check: Ruff Style Check (3.13)
src/backend/base/langflow/api/v1/login.py
[failure] 164-164: Ruff (W293)
src/backend/base/langflow/api/v1/login.py:164:1: W293 Blank line contains whitespace
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (17)
- GitHub Check: Run Frontend Tests / Determine Test Suites and Shard Distribution
- GitHub Check: Test Docker Images / Test docker images
- GitHub Check: Lint Backend / Run Mypy (3.12)
- GitHub Check: Lint Backend / Run Mypy (3.10)
- GitHub Check: Lint Backend / Run Mypy (3.11)
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 5
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 2
- GitHub Check: Lint Backend / Run Mypy (3.13)
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 4
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 3
- GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 1
- GitHub Check: Run Backend Tests / LFX Tests - Python 3.10
- GitHub Check: Run Backend Tests / Integration Tests - Python 3.10
- GitHub Check: Test Starter Templates
- GitHub Check: Optimize new Python code in this PR
- GitHub Check: Update Component Index
- GitHub Check: Update Starter Projects
🔇 Additional comments (1)
src/backend/base/langflow/api/v1/login.py (1)
165-185: Excellent fix for the logout cookie deletion bug!The cookie deletion parameters now correctly match those used during login, ensuring browsers can properly remove the cookies. Each cookie is deleted with the exact
httponly,samesite,secure, anddomainattributes used when the cookie was set:
refresh_token_lf: usesREFRESH_*settings (matches lines 45-49)access_token_lf: usesACCESS_*settings (matches lines 54-58)apikey_tkn_lflw: usesACCESS_*settings (matches lines 63-67)This addresses the security issue where users remained authenticated after logout in shared-computer scenarios.
This fixes a critical logout bug where users would appear logged out but remain authenticated in the background. The issue occurred because the logout endpoint was deleting cookies without matching the security parameters (httponly, samesite, secure, domain) used when creating them.
Browsers require exact parameter matching to delete cookies, so the authentication cookies remained active despite logout confirmation.
Changes:
Fixes #8641
Summary by CodeRabbit