Webstaff fails to auto-logout in some scenarios

Bug #1724915 reported by Bill Erickson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned
2.12
Won't Fix
Medium
Unassigned

Bug Description

Evergreen 2.12+

Sometimes the browser client fails to automatically log out the authenticated staff member and redirect to the login page. I left 2 tabs open over night (running master) and they both failed to redirect. The JS console showed no errors, just the regular auth session polling.

My theory is its a result of how the browser client determines if a session is still valid. Unlike the XUL client, which simply fails in real-time if an action is attempted on a stale session, the browser client polls for session validity at regular intervals. (The goal here is to force the page to refresh, since it may contain sensitive data). This polling is likely resetting the session timeout, essentially forcing the session to be valid indefinitely.

One solution may be to add a "no-timeout-reset" parameter to open-ils.auth.session.retrieve (used by the poller) so that it can fetch the auth session without magically resetting the timeout.

--

Note there is an OUS "ui.general.idle_timeout" responsible for minimizing the XUL client after a period of inactivity. It or similar behavior should be ported to the browser client, but since we can't guarantee a value for this setting will be applied, we can't rely on it as a way to force the session to log out in the browser.

Revision history for this message
Bill Erickson (berick) wrote :

More info: the issue appears to require having multiple tabs open. A single tab polls at slightly longer than the auth timeout, so it normally attempts to retrieve sessions after they have expired, allowing the log out to proceed. With multiple tabs, though, action in either tab extends the auth session, causing the polling to get out of sync.

We could resolve this by moving the polling into a shared worker, but I prefer the API change because avoiding session-extension when polling seems like a good thing to do anyway. Plus, it could be useful in other contexts.

Changed in evergreen:
assignee: nobody → Bill Erickson (berick)
Revision history for this message
Bill Erickson (berick) wrote :

Fix pushed:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1724915-auth-check-noreset

1. Adds the new API flag to optionally avoid extending the auth session time during session retrieval.

2. Adds a new bit of logic to notify all tabs when an auth session has expired, using BroadcastChannel's to communicate across tabs. With this, each tab is immediately closed once any tab sees the auth token has expired, instead of waiting for each tab to close over time as each polls the auth server.

To test

[1] Set a very low value for the library setting auth.staff_timeout, e.g. 30 seconds. (optional).
[2] Log in to 1 tab.
[3] Wait about 10 seconds and log into another tab
[4] Optionally open 10 more tabs.
[5] Wait.
[6] ~35 seconds (or other timeout value) after the last tab is opened, all tabs should redirect to the login page.

Changed in evergreen:
milestone: none → 3.0.1
assignee: Bill Erickson (berick) → nobody
tags: added: pullrequest
Changed in evergreen:
milestone: 3.0.1 → 3.0.2
Galen Charlton (gmc)
Changed in evergreen:
assignee: nobody → Galen Charlton (gmc)
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Galen Charlton (gmc) wrote :

Tested and signed off with a minor tweak. Branch is user/gmcharlt/lp1724915_signoff

tags: added: signedoff
Changed in evergreen:
assignee: Galen Charlton (gmc) → nobody
Revision history for this message
Mike Rylander (mrylander) wrote :

Picked to master and 3.0, but I'm hesitant to push this all the way back to 2.12. I'll leave that to the RM to decide. Thanks, Bill and Galen!

Changed in evergreen:
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.