Skip to content

[8.18] [SecuritySolution] Update API key permissions on refreshing data view API (#215738)#216058

Merged
machadoum merged 1 commit intoelastic:8.18from
machadoum:backport/8.18/pr-215738
Mar 26, 2025
Merged

[8.18] [SecuritySolution] Update API key permissions on refreshing data view API (#215738)#216058
machadoum merged 1 commit intoelastic:8.18from
machadoum:backport/8.18/pr-215738

Conversation

@machadoum
Copy link
Copy Markdown
Member

Backport

This will backport the following commits from main to 8.18:

Questions ?

Please refer to the Backport tool documentation

… API (elastic#215738)

Update the API key when entity store `apply_dataview_indices` is called.

## Summary
This change allows the user to update the privileges the entity store
data view refresh task uses. This will enable them to fix problems when
the user that enabled the entity store doesn't have all data view
indices privileges.

This PR also improves some error messages that were hard to read.

### Context
* `apply_dataview_indices`is an API that updates the entity store
transform with the indices defined in the security solution data view.
* There is a background task that calls `apply_dataview_indices` from
time to time
* The background task uses the API key to access the security solution
data view indices.

### How to test it
* Create a kibana instance with security data
* Create a user that only has access the necessary access to the entity
store indices
* Enable the entity store with a the created user
* Login with a superuser
* Add a new index to the security solution data view, which the created
user cannot access.
* The task will fail because it uses the API key from the unprivileged
user.
* Call `apply_dataview_indices` with the superuser (`POST
kbn:api/entity_store/engines/apply_dataview_indices`)
* The request should succeed because it is using the superuser
credentials
* Add a new index to the security solution data view, which the created
user cannot access.
* The task should succeed because it is using the superuser API key

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

(cherry picked from commit e201b94)

# Conflicts:
#	x-pack/solutions/security/plugins/security_solution/server/request_context_factory.ts
#	x-pack/solutions/security/plugins/security_solution/server/types.ts
@machadoum machadoum added the backport This PR is a backport of another PR label Mar 26, 2025
@machadoum machadoum enabled auto-merge (squash) March 26, 2025 14:34
@machadoum machadoum merged commit e66cd7b into elastic:8.18 Mar 26, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants