[Discover] Unable to update UI setting error when user doesn't have priv to set default index pattern #89654
Labels
bug
Fixes for quality problems that affect the customer experience
Feature:Security/Authorization
Platform Security - Authorization
impact:medium
Addressing this issue will have a medium level of impact on the quality/strength of our product.
:Security/Feature Controls
Team:Visualizations
Visualization editors, elastic-charts and infrastructure
Kibana version: master 8.0
Elasticsearch version: master 8.0
Server OS version: Windows 10
Browser version: Chrome
Browser OS version: Windows 10
Original install method (e.g. download page, yum, from source, etc.): source
Describe the bug: In this test x-pack/test/send_search_to_background_integration/tests/apps/discover/sessions_in_space.ts (but possibly more places) the test user is given
discover: ['all']
priv but gets an error in the UI when navigating to Discover.We used to re-direct the user back to index patterns page if they tried to navigate to Discover but there wasn't a default index pattern. I think it's fine that instead of doing that we just try to set the current one as the default. But if they don't have the privs to do that I don't think we should show the error. They don't even know what UI setting was unable to be updated or what they should do about it.
I think this happens in our test case because we aren't setting the default index in the correct place. I see it being set in the index.ts file right after loading logstash_functional data. But after that, the test loads the
esArchiver.load('dashboard/session_in_space');
data which wipes the default index back out. I tried to move the setting of the default index pattern after that but I still see the error. I don't see the default index saved in either the config object or the space object so I'm not sure where it is in master.I don't think this should happen to a real user because creating an index pattern manually always sets it to be the default index if one isn't already set. Maybe if an index pattern is shared or copied from one space to another?
Steps to reproduce:
ERROR browser[SEVERE] http://localhost:5620/s/another-space/api/kibana/settings - Failed to load resource: the server responded with a status of 403 (Forbidden)
discover: ['all']
priv, and a user that has that roleThe call is to
http://localhost:5620/s/another-space/api/kibana/settings
The request body is
{"changes":{"defaultIndex":"logstash-*"}}
The response is
{"statusCode":403,"error":"Forbidden","message":"Unable to update config"}
Expected behavior: We shouldn't show this error to the user. They won't know what it means or what to do about it.
Screenshots (if relevant):
Errors in browser console (if relevant):
Provide logs and/or server output (if relevant):
Any additional context:
The text was updated successfully, but these errors were encountered: