You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SecuritySolution] Add index privileges check to applyDataViewIndices (#214803)
## Summary
Add a new privileges check before executing `applyDataViewIndices`.
This change impacts the API call `applyDataViewIndices` and the job.
`applyDataViewIndices` updates the transforms. Executing without
privileges generates a silence error because the transform can't run.
I also added some extra unit tests for `applyDataViewIndices`.
Required privileges
['read', 'view_index_metadata'] for all security solution dataview +
asset_criticality and risk_score indices.
### How to test it
1. **API call with unprivileged user scenario**
* Enable the entity store with a superuser
* Create an unprivileged user
* Call `POST kbn:api/entity_store/engines/apply_dataview_indices`
* It should return an error
* Add the required privileges
* It executes successfully
2. **Task execution with an unprivileged user scenario**
* Create a user and add privileges only for the required Entity Store
indices
* Login with the new user
* Enable the entity store
* Add a new index to the security data view (the new user shouldn't have
access to the new index)
* Wait for 30min for the job to run, or update the [source
code](https://github.com/elastic/kibana/blob/8d0feb580f13cb1571beaf84a6d5763197211106/x-pack/solutions/security/plugins/security_solution/server/lib/entity_analytics/entity_store/tasks/data_view_refresh/data_view_refresh_task.ts#L150)
to make it run more often
* The job execution should fail with an error message containing the new
index name.
### Checklist
Reviewers should verify this PR satisfies this list as well.
- [x] [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
Copy file name to clipboardExpand all lines: x-pack/solutions/security/plugins/security_solution/server/lib/entity_analytics/entity_store/entity_store_data_client.test.ts
+141-6Lines changed: 141 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,10 @@ import { EntityType } from '../../../../common/search_strategy';
Copy file name to clipboardExpand all lines: x-pack/solutions/security/plugins/security_solution/server/lib/entity_analytics/entity_store/entity_store_data_client.ts
Copy file name to clipboardExpand all lines: x-pack/solutions/security/plugins/security_solution/server/lib/entity_analytics/entity_store/tasks/data_view_refresh/data_view_refresh_task.ts
Copy file name to clipboardExpand all lines: x-pack/solutions/security/plugins/security_solution/server/lib/entity_analytics/entity_store/utils/get_entity_store_privileges.ts
+29-7Lines changed: 29 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,7 @@ import { RISK_SCORE_INDEX_PATTERN } from '../../../../../common/constants';
0 commit comments