Skip to content
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

[Discover] Unable to update UI setting error when user doesn't have priv to set default index pattern #89654

Closed
LeeDr opened this issue Jan 29, 2021 · 3 comments
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

Comments

@LeeDr
Copy link

LeeDr commented Jan 29, 2021

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:

  1. if you run the test above you'll see this in the logs when the test navigates to Discover;
    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)
  2. Or you can manually create a role that has discover: ['all'] priv, and a user that has that role
  3. Log in as that user
  4. open the browser console
  5. Navigate to Discover - you should see the error on the screen and in the browser console

The 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):
image

Errors in browser console (if relevant):

POST http://localhost:5620/s/another-space/api/kibana/settings 403 (Forbidden)
fetchResponse @ src\core\public\http\fetch.ts:128
(anonymous) @ src\core\public\http\fetch.ts:55
async function (async)
(anonymous) @ src\core\public\http\fetch.ts:54
(anonymous) @ src\core\public\http\fetch.ts:51
sendRequest @ src\core\public\ui_settings\ui_settings_api.ts:121
flushPendingChanges @ src\core\public\ui_settings\ui_settings_api.ts:103
(anonymous) @ src\core\public\ui_settings\ui_settings_api.ts:52
batchSet @ src\core\public\ui_settings\ui_settings_api.ts:34
update @ src\core\public\ui_settings\ui_settings_client.ts:163
set @ src\core\public\ui_settings\ui_settings_client.ts:79
set @ src\plugins\data\public\index_patterns\ui_settings_wrapper.ts:26
ensureDefaultIndexPattern @ src\plugins\data\common\index_patterns\index_patterns\ensure_default_index_pattern.ts:32
async function (async)
ensureDefaultIndexPattern @ src\plugins\data\common\index_patterns\index_patterns\ensure_default_index_pattern.ts:15
savedObjects @ src\plugins\discover\public\application\angular\discover.js:85
invoke @ node_modules\angular\angular.js:5208
(anonymous) @ node_modules\angular-route\angular-route.js:843
forEach @ node_modules\angular\angular.js:402
resolveLocals @ node_modules\angular-route\angular-route.js:840
processQueue @ node_modules\angular\angular.js:18013
(anonymous) @ node_modules\angular\angular.js:18061
$digest @ node_modules\angular\angular.js:19180
$apply @ node_modules\angular\angular.js:19568
bootstrapApply @ node_modules\angular\angular.js:1966
invoke @ node_modules\angular\angular.js:5208
doBootstrap @ node_modules\angular\angular.js:1964
bootstrap @ node_modules\angular\angular.js:1984
mountDiscoverApp @ src\plugins\discover\public\application\application.ts:30
renderApp @ src\plugins\discover\public\application\application.ts:19
async function (async)
renderApp @ src\plugins\discover\public\application\application.ts:18
mount @ src\plugins\discover\public\plugin.ts:193
async function (async)
mount @ src\plugins\discover\public\plugin.ts:185
(anonymous) @ src\core\public\application\application_service.tsx:148
mount @ src\core\public\application\ui\app_container.tsx:50
(anonymous) @ src\core\public\application\ui\app_container.tsx:69
commitHookEffectList @ node_modules\react-dom\cjs\react-dom.development.js:22030
commitLifeCycles @ node_modules\react-dom\cjs\react-dom.development.js:22080
commitLayoutEffects @ node_modules\react-dom\cjs\react-dom.development.js:25344
callCallback @ node_modules\react-dom\cjs\react-dom.development.js:336
invokeGuardedCallbackDev @ node_modules\react-dom\cjs\react-dom.development.js:385
invokeGuardedCallback @ node_modules\react-dom\cjs\react-dom.development.js:440
commitRootImpl @ node_modules\react-dom\cjs\react-dom.development.js:25082
unstable_runWithPriority @ node_modules\scheduler\cjs\scheduler.development.js:697
runWithPriority$2 @ node_modules\react-dom\cjs\react-dom.development.js:12149
commitRoot @ node_modules\react-dom\cjs\react-dom.development.js:24922
finishSyncRender @ node_modules\react-dom\cjs\react-dom.development.js:24329
performSyncWorkOnRoot @ node_modules\react-dom\cjs\react-dom.development.js:24307
(anonymous) @ node_modules\react-dom\cjs\react-dom.development.js:12199
unstable_runWithPriority @ node_modules\scheduler\cjs\scheduler.development.js:697
runWithPriority$2 @ node_modules\react-dom\cjs\react-dom.development.js:12149
flushSyncCallbackQueueImpl @ node_modules\react-dom\cjs\react-dom.development.js:12194
flushSyncCallbackQueue @ node_modules\react-dom\cjs\react-dom.development.js:12182
unbatchedUpdates @ node_modules\react-dom\cjs\react-dom.development.js:24439
legacyRenderSubtreeIntoContainer @ node_modules\react-dom\cjs\react-dom.development.js:27527
render @ node_modules\react-dom\cjs\react-dom.development.js:27608
start @ src\core\public\rendering\rendering_service.tsx:31
start @ src\core\public\core_system.ts:229
async function (async)
start @ src\core\public\core_system.ts:163
__kbnBootstrap__ @ src\core\public\kbn_bootstrap.ts:32
async function (async)
__kbnBootstrap__ @ src\core\public\kbn_bootstrap.ts:17
(anonymous) @ bootstrap.js:214
innerCb @ bootstrap.js:91
load (async)
loadScript @ bootstrap.js:81
(anonymous) @ bootstrap.js:100
load @ bootstrap.js:87
window.onload @ bootstrap.js:105
load (async)
(anonymous) @ bootstrap.js:48

Provide logs and/or server output (if relevant):

Any additional context:

@LeeDr LeeDr added bug Fixes for quality problems that affect the customer experience Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Security/Authorization Platform Security - Authorization :Security/Feature Controls labels Jan 29, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@timroes timroes added the impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. label Jul 22, 2021
@jportner
Copy link
Contributor

jportner commented Aug 4, 2021

This appears to be a duplicate of #46124

@flash1293
Copy link
Contributor

Duplicate of #46124

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

5 participants