Dashboard: a session check in flight at logout can briefly bring the previous user back

Đang mở
#1,579 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript
Lĩnh vực
authentication, frontend

Hướng nghiên cứu

The race involves the dashboard's user loader for /auth/me, the logout handler, the storage-event listener that reloads the user, and refresh() after SSO sign-in; start by finding where each of these sets the user and the token. Reproduce with the jsdom probe described in the issue: hold /auth/me open, log out, then let it answer 200. Done means a stale answer from before logout is dropped, and a test covers the storage sign-in resetting the post-logout ?next= landing page.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

After #1577, logging out clears the dashboard's session at once instead of waiting for the server. A session check that was already in flight at that moment can still answer afterwards and put the previous user back in the dashboard's memory, with no token.

How it is reached: only while a /auth/me check is outstanding when the user clicks Log out. That happens when another tab changed the stored token (the storage listener reloads the user) or right after an SSO sign-in (refresh()).

What the user sees: the previous user's name for a moment. Nothing loads, because the next API call has no token, answers 401, and the dashboard goes to the sign-in page. The same can happen on main, but less often, because main cleared the session only after the logout request answered.

Measured in jsdom by holding /auth/me open, logging out, then letting it answer 200: the user comes back as signed in with no token, on main and on #1577.

Suggested fix: a generation counter that logout and sign-in bump, with the user loader dropping any answer from an older generation. The probe above becomes its test.

Also a test gap from the same review: nothing pins that a sign-in arriving through another tab (the storage event) resets the post-logout landing page. A test that logs out, fires a storage sign-in, then drops the token and expects ?next= again would cover it.

Ngôn ngữ chính
Python
Star
0
Fork
4
Merge trung bình
5 giờ 36 phút
Pull request đã merge (30 ngày)
509

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Controlvar/controlvar

Tất cả issue của Controlvar/controlvar

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.