fix: check for existing pipeline session in tpa login + cleanup#178
fix: check for existing pipeline session in tpa login + cleanup#178jono-booth merged 1 commit intorelease-ulmofrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates third-party authentication (especially SAML) flow handling to prevent redirect loops and to behave correctly when pipeline state is partially available (e.g., session token present but DB partial object not yet readable), and adjusts local devstack cookie settings intended to support SAML POST-backs.
Changes:
- Add hinted-login tests to ensure no redirect occurs when a TPA pipeline is running or when only the partial pipeline token exists in session.
- In login/register form rendering, treat a session-held partial pipeline token as “pipeline running” to avoid redirect loops when
pipeline.get()returnsNone. - Remove the SAML provider site-fallback waffle toggle and make the
tpa-samlfallback behavior unconditional; update pipeline behavior/tests accordingly. - Update devstack SameSite settings aiming to allow SAML SP-initiated flows locally.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| openedx/core/djangoapps/user_authn/views/tests/test_logistration.py | Adds coverage for hinted-login redirect guards when pipeline state is only partially observable. |
| openedx/core/djangoapps/user_authn/views/login_form.py | Adds session-token-based pipeline detection to avoid redirect loops / false “no pipeline” conditions. |
| lms/envs/devstack.py | Changes SameSite settings for local devstack to try to support SAML cross-site POST behavior. |
| common/djangoapps/third_party_auth/toggles.py | Removes the SAML provider site-fallback waffle flag and helper. |
| common/djangoapps/third_party_auth/tests/test_pipeline_integration.py | Adds/updates tests for unconditional tpa-saml complete URL behavior and backend-based SAML detection. |
| common/djangoapps/third_party_auth/provider.py | Makes tpa-saml provider lookup fallback unconditional (no waffle flag gate). |
| common/djangoapps/third_party_auth/pipeline.py | Removes toggle usage, special-cases tpa-saml complete URL behavior, and simplifies SAML detection in ensure_user_information. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
da71cab to
40de82b
Compare
40de82b to
fcd06b5
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
fcd06b5 to
af44d38
Compare
af44d38 to
bf05fd4
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
bf05fd4 to
dc30cbb
Compare
Fix SAML redirect loop for new users and hinted login with skip dialog
Problem
New SAML users authenticated via a hinted IdP (tpa_hint) with skip_hinted_login_dialog=True could get stuck in an infinite redirect loop
A secondary failure mode existed in deployments with DB read replicas: pipeline.get() performs a database lookup for the partial pipeline object. If the partial hasn't replicated to the read replica yet, pipeline.get() returns None even though the pipeline IS running (the token
exists in the session). This caused the skip-dialog guard to incorrectly trigger a fresh redirect to the IdP
login_form.py — two changes
sees the appropriate form instead of being re-offered the IdP button
pipeline.py / provider.py / toggles.py — cleanup
devstack.py — SAML SP-initiated flows require the browser to send the session cookie on the cross-site POST from the IdP back to /auth/complete/tpa-saml/. SameSite=Lax blocks this. The devstack settings now disable SameSite on session cookies to allow local end-to-end SAML testing
Tests
Housekeeping
The third_party_auth.saml_provider_site_fallback behaviour has been tested and confirmed working, so this removes the waffle flag and makes the fallback unconditional. Also removes the verbose debug logging that was added during investigation, keeping only the two dispatch path log lines in ensure_user_information.