aminghadersohi opened a new pull request, #43606: URL: https://github.com/apache/superset/pull/43606
### SUMMARY When several tabs reach `/login/?next=...` after a session expires, completing login in one tab authenticates the shared browser session. Refreshing another tab then takes the login view's already-authenticated branch, which previously discarded `next` and sent the user to the index. This marks safe redirect destinations while the request is known to be anonymous. An already-authenticated login request may honor `next` only when a short-lived signed marker proves that the same destination was observed before authentication. Unmarked authenticated login requests still go to the index, preserving the existing protection against redirect loops when an authenticated user is sent to login after a permission denial. Markers expire after 15 minutes, are bound to the exact `next` value, and do not grant authorization. Destinations still pass Flask-AppBuilder's safe-redirect validation; backslash-containing destinations are rejected so browser and server URL parsing cannot disagree. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Not applicable; this changes server-side redirect behavior without changing the UI. ### TESTING INSTRUCTIONS Automated: ```bash PYTHONPATH="$PWD/superset-core/src:$PWD" pytest -q tests/unit_tests/views/test_auth.py uvx pre-commit run --files superset/views/auth.py tests/unit_tests/views/test_auth.py ``` The regression suite covers: - marking a safe `next` while anonymous; - restoring the original dashboard after another tab authenticates; - retaining the index fallback for unmarked authenticated requests; - tampered, expired, mismatched, and non-string markers; - external, scheme-relative, script-scheme, control-character, triple-slash, and backslash redirect forms; - repeated query parameters and `SCRIPT_NAME`/application-root deployments. Manual: 1. Configure a short `PERMANENT_SESSION_LIFETIME`. 2. Log in and open multiple dashboard tabs. 3. Let the session expire and allow each tab to reach the login page. 4. Complete login in one tab. 5. Refresh the remaining tabs and verify each returns to its original dashboard. 6. As an authenticated user, request a page without permission and verify the login redirect does not loop back to the denied page. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
