You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/05/18 03:18:32 UTC

(superset) branch tdd/issue-24713-session-cookie-after-logout created (now 1719d24a17a)

This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a change to branch tdd/issue-24713-session-cookie-after-logout
in repository https://gitbox.apache.org/repos/asf/superset.git


      at 1719d24a17a test(security): regression test for session cookie still valid after logout (#24713)

This branch includes the following new commits:

     new 1719d24a17a test(security): regression test for session cookie still valid after logout (#24713)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(superset) 01/01: test(security): regression test for session cookie still valid after logout (#24713)

Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch tdd/issue-24713-session-cookie-after-logout
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 1719d24a17a6405da981209ec7a87e61bcf7f67c
Author: Claude Code <no...@anthropic.com>
AuthorDate: Sun May 17 20:18:01 2026 -0700

    test(security): regression test for session cookie still valid after logout (#24713)
    
    TDD-style validation of #24713: captures the session cookie, calls /logout/,
    then replays the cookie in a fresh client. The replay should NOT return 200
    on a protected endpoint — if it does, the session was not properly invalidated.
    
    Closes #24713
    
    Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
 tests/integration_tests/security/api_tests.py | 34 +++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tests/integration_tests/security/api_tests.py b/tests/integration_tests/security/api_tests.py
index 24e9acc2b69..8047e053d47 100644
--- a/tests/integration_tests/security/api_tests.py
+++ b/tests/integration_tests/security/api_tests.py
@@ -30,6 +30,7 @@ from superset.utils import json
 from tests.conftest import with_config
 from tests.integration_tests.base_tests import SupersetTestCase
 from tests.integration_tests.constants import ADMIN_USERNAME, GAMMA_USERNAME
+from tests.integration_tests.test_app import app
 from tests.integration_tests.fixtures.birth_names_dashboard import (
     load_birth_names_dashboard_with_slices,  # noqa: F401
     load_birth_names_data,  # noqa: F401
@@ -402,3 +403,36 @@ class TestSecurityRolesApi(SupersetTestCase):
         assert sorted(role2_api["user_ids"]) == role2_expected["user_ids"]
         assert sorted(role2_api["permission_ids"]) == role2_expected["permission_ids"]
         assert role2_api["group_ids"] == role2_expected["group_ids"]
+
+
+class TestLogoutSessionInvalidation(SupersetTestCase):
+    """Regression for #24713: a session cookie captured pre-logout must not grant
+    access after the user logs out. The original report describes copying the
+    session cookie out, calling /logout/, and successfully reusing the cookie in
+    a second browser to bypass authentication."""
+
+    def test_session_cookie_invalidated_after_logout(self):
+        self.login(ADMIN_USERNAME)
+
+        resp_authed = self.client.get("api/v1/dashboard/", follow_redirects=False)
+        assert resp_authed.status_code == 200, (
+            f"Login did not yield an authenticated session "
+            f"(got {resp_authed.status_code})"
+        )
+
+        captured = {
+            c.name: c.value for c in self.client.cookie_jar if c.name == "session"
+        }
+        assert captured, "expected a session cookie after login"
+
+        self.client.get("/logout/", follow_redirects=True)
+
+        replay_client = app.test_client()
+        for name, value in captured.items():
+            replay_client.set_cookie("localhost", name, value)
+
+        resp_replay = replay_client.get("api/v1/dashboard/", follow_redirects=False)
+        assert resp_replay.status_code != 200, (
+            f"Captured session cookie was still accepted after logout "
+            f"(status={resp_replay.status_code}); see issue #24713"
+        )