-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
Background:
The background context and motivation is outlined in #81536
Implementation
To allow plugins to continue to access Kibana's system indices all requests to Elasticsearch will have to use a path prefixed by _kibana/. To reduce the amount of effort to adopt this and maintain the ElasticsearchJS client's typescript types, Core should expose a special system indices Elasticsearch client that will automatically prefix all paths.
Investigate deprecating / removing callAsInternalUser
In most cases the new system index client should replace using the callAsInternalUser API. However there are some places where plugins rely on the permission of the kibana system user while access non-system index API's.
Interacting with kibana indices that aren't system indices
The following is a list of kibana indices that aren't system indices which probably use the kibana system user callAsInternalUser in some way:
- Alerting's event log - .kibana-event-log-*
- Monitoring - .monitoring-*
- Detection engine signals - .siem-signals-*
- Security solution lists - .lists and .values
Accessing ES API's that aren't related to an index / system index
The following places use the internal user to call non-document / non-index API's. We could continue to use the system ElasticsearchJS client for this, but add a remove list to not prefix these API paths.
- Alerting checks if Elasticsearch security is enabled
kibana/x-pack/plugins/alerts/server/routes/health.ts
Lines 55 to 58 in ce45dad
.callAsInternalUser('transport.request', { method: 'GET', path: '/_xpack/usage', }); - Fetching licensing information from ES
kibana/x-pack/plugins/licensing/server/plugin.ts
Lines 183 to 186 in 5f781dc
const response = await clusterClient.callAsInternalUser('transport.request', { method: 'GET', path: '/_xpack', }); - Security plugin calls several "shield" / security API's on Elasticsearch such as
await this.clusterClient.callAsInternalUser('shield.invalidateAPIKey', {
Other places to audit callAsInternalUser usage
- Usage collectors might use the internal user to analyze data in some indices that aren't system indices:
kibana/src/plugins/usage_collection/server/usage_collection.mock.ts
Lines 56 to 57 in 9afd63f
callCluster: elasticsearchServiceMock.createLegacyClusterClient().callAsInternalUser, esClient: elasticsearchServiceMock.createClusterClient().asInternalUser,