-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Various background API calls extend session idle timeout #79889
Comments
Pinging @elastic/kibana-security (Team:Security) |
@elastic/kibana-platform it'll be extremely time consuming to attempt to audit every single page that's making background API calls and change them to use the system request header. Even then, we'll be sure to have this problem again when new pages are added and new API calls are used. How do you feel about changing the kibana/src/core/public/http/fetch.ts Lines 118 to 151 in 82a6ddb
I think we can more easily undertake a one-time audit of pages and change them to use |
That wouldn't solve the problem completely - we still have to audit all places of use to ensure that the correct header is set. Otherwise, it will worsen UX by unexpected user logout. Note that decision whether a call is system is context-dependent and might be different for the same API, which makes audit by an external team (security or platform) even harder. |
We have a similar issue here, with a similar lack of discussion: #18751. I agree that relying on this "system request" feature is problematic for determining user activity. I think it would be great if we could use other mechanisms for figuring out if a session is "active" or not. For example, we could use the Page Visibility API to determine if the tab is active or not. If the tab is active, then we can use additional signals (TBD?) to determine activity. If the tab is inactive, then that's a good indication that the session is not actively being used (barring things like background searches). |
Yes, I agree it doesn't solve the problem completely. It's certainly a trade-off. If we change the default to Considering that session hijacking is the core concern of anyone who chooses to use the idle timeout setting, I feel pretty strongly that we should err on the side of caution for this behavior.
Agreed, we could use this opportunity to educate code owners.
So, are you thinking we could make the suggested change in addition to adding these new signals? |
I don't have a concrete suggestion just yet 😬. My fear is that continuing to rely on If we were starting fresh, I think having discrete functions to call would make engineers consider this more carefully -- for example, on the server we have Compare that to the client-side, where we have a set of shared functions which you can optionally call as a "normal" or "system" request. The fact that We could update these functions to make
I don't expect that solution teams will keep this in mind, despite education efforts. I think this would lead to a poor user experience, since this is something that is likely to introduce session bugs fairly frequently as new requests are added. I agree this is the more secure approach, but I'm not yet convinced that the tradeoff is worth it. Perhaps this is something we can consider alongside 8.0 since we'll have sensible defaults in place for session timeouts? |
I looked into this briefly, and I'm not sure it will be adequate. |
I wonder if we could take queues from input events:
If we don't detect any of these after a certain amount of time, then we could consider the session inactive. This won't cover all cases though, since I expect that dashboards with auto-refresh set won't want to have their session expired just because that session is being used passively instead of actively. We could detect if Kibana is in full-screen mode, and never expire those sessions. This is consistent with how computers detect activity today: no input == no activity, unless consuming media or similar. |
How do you plan on forwarding that 'activity' information from the client to the backend? Would you be performing a call at a given interval to the backend (in the case there actually WAS user activity), and use this new endpoint as the sole indicator for session refresh? |
Yeah that's exactly what I had in mind. Do you foresee issues with this approach? |
No, it sounds good to me. |
I updated the issue description, it seems that the call to |
@thomheymann and I discussed this issue a bit today -- we have an idea for a middle ground that will help to mitigate this, but not completely solve. All of our supported browsers support the If we detect that the tab is in the background (or the window is minimized), then we can treat all API calls as "system requests" by default (unless the call explicitly opts out of this via If we combine this approach with a solution for client-side activity (see #18751, or my comment above), then I think we will have a much more accurate system for detecting session in/activity |
Kibana version: 7.10 (not yet released)
Original install method (e.g. download page, yum, from source, etc.): from source
Describe the bug: The session idle timeout should log users out after a period of inactivity. This happens both on the client side and the server side. However, depending upon what page you are viewing, API calls periodically occur in the background, which potentially extends the user's session indefinitely. This includes, but is not limited to:
/api/ui_metric/report
(UI metrics collection -- runs on all pages,but only once it seems?update 2021/02/05: this actually seems to run every 15 minutes or so, even if the user is completely idle and hasn't clicked anything)/api/index_management/indices/reload
(Index Management page)/api/index_lifecycle_management/policies?withIndices=true
(Index Management page)/api/remote_clusters
(Remote Clusters page)/api/saved_objects_tagging/tags
(all pages?)Steps to reproduce:
xpack.security.session.idleTimeout: 75000
report
is made, and the warning toast disappearsExpected behavior: Unattended background actions should not extend the user's session.
Any additional context: These API calls should use the
kbn-system-request
header to indicate that it was not a user request and should not extend the session.The text was updated successfully, but these errors were encountered: