Skip to content

[SecuritySolution] Update API key permissions on refreshing data view API#215738

Merged
machadoum merged 4 commits intoelastic:mainfrom
machadoum:siem-ea-213598
Mar 26, 2025
Merged

[SecuritySolution] Update API key permissions on refreshing data view API#215738
machadoum merged 4 commits intoelastic:mainfrom
machadoum:siem-ea-213598

Conversation

@machadoum
Copy link
Member

@machadoum machadoum commented Mar 24, 2025

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_indicesis 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 were updated or added to match the most common scenarios
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

@machadoum machadoum self-assigned this Mar 25, 2025
@machadoum machadoum added release_note:enhancement Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Entity Analytics Security Entity Analytics Team backport:version Backport to applied version labels v9.1.0 v8.19.0 v8.18.1 v9.0.1 labels Mar 25, 2025
@machadoum machadoum marked this pull request as ready for review March 25, 2025 10:33
@machadoum machadoum requested review from a team as code owners March 25, 2025 10:33
@machadoum machadoum requested a review from tiansivive March 25, 2025 10:33
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-entity-analytics (Team:Entity Analytics)

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
securitySolution 127 128 +1

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
securitySolution 34 35 +1
Unknown metric groups

API count

id before after diff
securitySolution 195 196 +1

History

cc @machadoum

Copy link
Contributor

@tiansivive tiansivive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

desk tested. Seems good 🚀

@machadoum machadoum merged commit e201b94 into elastic:main Mar 26, 2025
10 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.18, 8.x, 9.0

https://github.com/elastic/kibana/actions/runs/14080534750

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Mar 26, 2025
… 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)
@kibanamachine
Copy link
Contributor

💔 Some backports could not be created

Status Branch Result
8.18 Backport failed because of merge conflicts
8.x Backport failed because of merge conflicts
9.0

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 215738

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Mar 26, 2025
…a view API (#215738) (#216004)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[SecuritySolution] Update API key permissions on refreshing data view
API (#215738)](#215738)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Pablo
Machado","email":"pablo.nevesmachado@elastic.co"},"sourceCommit":{"committedDate":"2025-03-26T10:03:45Z","message":"[SecuritySolution]
Update API key permissions on refreshing data view API
(#215738)\n\nUpdate the API key when entity store
`apply_dataview_indices` is called.\n\n## Summary\nThis change allows
the user to update the privileges the entity store\ndata view refresh
task uses. This will enable them to fix problems when\nthe user that
enabled the entity store doesn't have all data view\nindices
privileges.\n\nThis PR also improves some error messages that were hard
to read.\n\n### Context\n* `apply_dataview_indices`is an API that
updates the entity store\ntransform with the indices defined in the
security solution data view.\n* There is a background task that calls
`apply_dataview_indices` from\ntime to time\n* The background task uses
the API key to access the security solution\ndata view indices.\n\n\n###
How to test it\n* Create a kibana instance with security data\n* Create
a user that only has access the necessary access to the entity\nstore
indices\n* Enable the entity store with a the created user\n* Login with
a superuser \n* Add a new index to the security solution data view,
which the created\nuser cannot access.\n* The task will fail because it
uses the API key from the unprivileged\nuser.\n* Call
`apply_dataview_indices` with the superuser
(`POST\nkbn:api/entity_store/engines/apply_dataview_indices`)\n* The
request should succeed because it is using the superuser\ncredentials\n*
Add a new index to the security solution data view, which the
created\nuser cannot access.\n* The task should succeed because it is
using the superuser API key\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"e201b947be53e4e903ab1126592c3853f66108df","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Team:
SecuritySolution","Team:Entity
Analytics","backport:version","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[SecuritySolution]
Update API key permissions on refreshing data view
API","number":215738,"url":"https://github.com/elastic/kibana/pull/215738","mergeCommit":{"message":"[SecuritySolution]
Update API key permissions on refreshing data view API
(#215738)\n\nUpdate the API key when entity store
`apply_dataview_indices` is called.\n\n## Summary\nThis change allows
the user to update the privileges the entity store\ndata view refresh
task uses. This will enable them to fix problems when\nthe user that
enabled the entity store doesn't have all data view\nindices
privileges.\n\nThis PR also improves some error messages that were hard
to read.\n\n### Context\n* `apply_dataview_indices`is an API that
updates the entity store\ntransform with the indices defined in the
security solution data view.\n* There is a background task that calls
`apply_dataview_indices` from\ntime to time\n* The background task uses
the API key to access the security solution\ndata view indices.\n\n\n###
How to test it\n* Create a kibana instance with security data\n* Create
a user that only has access the necessary access to the entity\nstore
indices\n* Enable the entity store with a the created user\n* Login with
a superuser \n* Add a new index to the security solution data view,
which the created\nuser cannot access.\n* The task will fail because it
uses the API key from the unprivileged\nuser.\n* Call
`apply_dataview_indices` with the superuser
(`POST\nkbn:api/entity_store/engines/apply_dataview_indices`)\n* The
request should succeed because it is using the superuser\ncredentials\n*
Add a new index to the security solution data view, which the
created\nuser cannot access.\n* The task should succeed because it is
using the superuser API key\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"e201b947be53e4e903ab1126592c3853f66108df"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/215738","number":215738,"mergeCommit":{"message":"[SecuritySolution]
Update API key permissions on refreshing data view API
(#215738)\n\nUpdate the API key when entity store
`apply_dataview_indices` is called.\n\n## Summary\nThis change allows
the user to update the privileges the entity store\ndata view refresh
task uses. This will enable them to fix problems when\nthe user that
enabled the entity store doesn't have all data view\nindices
privileges.\n\nThis PR also improves some error messages that were hard
to read.\n\n### Context\n* `apply_dataview_indices`is an API that
updates the entity store\ntransform with the indices defined in the
security solution data view.\n* There is a background task that calls
`apply_dataview_indices` from\ntime to time\n* The background task uses
the API key to access the security solution\ndata view indices.\n\n\n###
How to test it\n* Create a kibana instance with security data\n* Create
a user that only has access the necessary access to the entity\nstore
indices\n* Enable the entity store with a the created user\n* Login with
a superuser \n* Add a new index to the security solution data view,
which the created\nuser cannot access.\n* The task will fail because it
uses the API key from the unprivileged\nuser.\n* Call
`apply_dataview_indices` with the superuser
(`POST\nkbn:api/entity_store/engines/apply_dataview_indices`)\n* The
request should succeed because it is using the superuser\ncredentials\n*
Add a new index to the security solution data view, which the
created\nuser cannot access.\n* The task should succeed because it is
using the superuser API key\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"e201b947be53e4e903ab1126592c3853f66108df"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Pablo Machado <pablo.nevesmachado@elastic.co>
machadoum added a commit to machadoum/kibana that referenced this pull request Mar 26, 2025
… 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 added a commit to machadoum/kibana that referenced this pull request Mar 26, 2025
… 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
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
8.x
8.18

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

machadoum added a commit that referenced this pull request Mar 26, 2025
…ta view API (#215738) (#216058)

# Backport

This will backport the following commits from `main` to `8.18`:
- [[SecuritySolution] Update API key permissions on refreshing data view
API (#215738)](#215738)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Pablo
Machado","email":"pablo.nevesmachado@elastic.co"},"sourceCommit":{"committedDate":"2025-03-26T10:03:45Z","message":"[SecuritySolution]
Update API key permissions on refreshing data view API
(#215738)\n\nUpdate the API key when entity store
`apply_dataview_indices` is called.\n\n## Summary\nThis change allows
the user to update the privileges the entity store\ndata view refresh
task uses. This will enable them to fix problems when\nthe user that
enabled the entity store doesn't have all data view\nindices
privileges.\n\nThis PR also improves some error messages that were hard
to read.\n\n### Context\n* `apply_dataview_indices`is an API that
updates the entity store\ntransform with the indices defined in the
security solution data view.\n* There is a background task that calls
`apply_dataview_indices` from\ntime to time\n* The background task uses
the API key to access the security solution\ndata view indices.\n\n\n###
How to test it\n* Create a kibana instance with security data\n* Create
a user that only has access the necessary access to the entity\nstore
indices\n* Enable the entity store with a the created user\n* Login with
a superuser \n* Add a new index to the security solution data view,
which the created\nuser cannot access.\n* The task will fail because it
uses the API key from the unprivileged\nuser.\n* Call
`apply_dataview_indices` with the superuser
(`POST\nkbn:api/entity_store/engines/apply_dataview_indices`)\n* The
request should succeed because it is using the superuser\ncredentials\n*
Add a new index to the security solution data view, which the
created\nuser cannot access.\n* The task should succeed because it is
using the superuser API key\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"e201b947be53e4e903ab1126592c3853f66108df","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","v9.0.0","Team:
SecuritySolution","Team:Entity
Analytics","backport:version","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[SecuritySolution]
Update API key permissions on refreshing data view
API","number":215738,"url":"https://github.com/elastic/kibana/pull/215738","mergeCommit":{"message":"[SecuritySolution]
Update API key permissions on refreshing data view API
(#215738)\n\nUpdate the API key when entity store
`apply_dataview_indices` is called.\n\n## Summary\nThis change allows
the user to update the privileges the entity store\ndata view refresh
task uses. This will enable them to fix problems when\nthe user that
enabled the entity store doesn't have all data view\nindices
privileges.\n\nThis PR also improves some error messages that were hard
to read.\n\n### Context\n* `apply_dataview_indices`is an API that
updates the entity store\ntransform with the indices defined in the
security solution data view.\n* There is a background task that calls
`apply_dataview_indices` from\ntime to time\n* The background task uses
the API key to access the security solution\ndata view indices.\n\n\n###
How to test it\n* Create a kibana instance with security data\n* Create
a user that only has access the necessary access to the entity\nstore
indices\n* Enable the entity store with a the created user\n* Login with
a superuser \n* Add a new index to the security solution data view,
which the created\nuser cannot access.\n* The task will fail because it
uses the API key from the unprivileged\nuser.\n* Call
`apply_dataview_indices` with the superuser
(`POST\nkbn:api/entity_store/engines/apply_dataview_indices`)\n* The
request should succeed because it is using the superuser\ncredentials\n*
Add a new index to the security solution data view, which the
created\nuser cannot access.\n* The task should succeed because it is
using the superuser API key\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"e201b947be53e4e903ab1126592c3853f66108df"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.18"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/216004","number":216004,"state":"MERGED","mergeCommit":{"sha":"6c4126fd55ee8e00ecbb19054b1baddd2ff07903","message":"[9.0]
[SecuritySolution] Update API key permissions on refreshing data view
API (#215738) (#216004)\n\n# Backport\n\nThis will backport the
following commits from `main` to `9.0`:\n- [[SecuritySolution] Update
API key permissions on refreshing data view\nAPI
(#215738)](https://github.com/elastic/kibana/pull/215738)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Pablo Machado
<pablo.nevesmachado@elastic.co>"}},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/215738","number":215738,"mergeCommit":{"message":"[SecuritySolution]
Update API key permissions on refreshing data view API
(#215738)\n\nUpdate the API key when entity store
`apply_dataview_indices` is called.\n\n## Summary\nThis change allows
the user to update the privileges the entity store\ndata view refresh
task uses. This will enable them to fix problems when\nthe user that
enabled the entity store doesn't have all data view\nindices
privileges.\n\nThis PR also improves some error messages that were hard
to read.\n\n### Context\n* `apply_dataview_indices`is an API that
updates the entity store\ntransform with the indices defined in the
security solution data view.\n* There is a background task that calls
`apply_dataview_indices` from\ntime to time\n* The background task uses
the API key to access the security solution\ndata view indices.\n\n\n###
How to test it\n* Create a kibana instance with security data\n* Create
a user that only has access the necessary access to the entity\nstore
indices\n* Enable the entity store with a the created user\n* Login with
a superuser \n* Add a new index to the security solution data view,
which the created\nuser cannot access.\n* The task will fail because it
uses the API key from the unprivileged\nuser.\n* Call
`apply_dataview_indices` with the superuser
(`POST\nkbn:api/entity_store/engines/apply_dataview_indices`)\n* The
request should succeed because it is using the superuser\ncredentials\n*
Add a new index to the security solution data view, which the
created\nuser cannot access.\n* The task should succeed because it is
using the superuser API key\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"e201b947be53e4e903ab1126592c3853f66108df"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
machadoum added a commit that referenced this pull request Mar 27, 2025
…a view API (#215738) (#216057)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[SecuritySolution] Update API key permissions on refreshing data view
API (#215738)](#215738)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Pablo
Machado","email":"pablo.nevesmachado@elastic.co"},"sourceCommit":{"committedDate":"2025-03-26T10:03:45Z","message":"[SecuritySolution]
Update API key permissions on refreshing data view API
(#215738)\n\nUpdate the API key when entity store
`apply_dataview_indices` is called.\n\n## Summary\nThis change allows
the user to update the privileges the entity store\ndata view refresh
task uses. This will enable them to fix problems when\nthe user that
enabled the entity store doesn't have all data view\nindices
privileges.\n\nThis PR also improves some error messages that were hard
to read.\n\n### Context\n* `apply_dataview_indices`is an API that
updates the entity store\ntransform with the indices defined in the
security solution data view.\n* There is a background task that calls
`apply_dataview_indices` from\ntime to time\n* The background task uses
the API key to access the security solution\ndata view indices.\n\n\n###
How to test it\n* Create a kibana instance with security data\n* Create
a user that only has access the necessary access to the entity\nstore
indices\n* Enable the entity store with a the created user\n* Login with
a superuser \n* Add a new index to the security solution data view,
which the created\nuser cannot access.\n* The task will fail because it
uses the API key from the unprivileged\nuser.\n* Call
`apply_dataview_indices` with the superuser
(`POST\nkbn:api/entity_store/engines/apply_dataview_indices`)\n* The
request should succeed because it is using the superuser\ncredentials\n*
Add a new index to the security solution data view, which the
created\nuser cannot access.\n* The task should succeed because it is
using the superuser API key\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"e201b947be53e4e903ab1126592c3853f66108df","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","v9.0.0","Team:
SecuritySolution","Team:Entity
Analytics","backport:version","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[SecuritySolution]
Update API key permissions on refreshing data view
API","number":215738,"url":"https://github.com/elastic/kibana/pull/215738","mergeCommit":{"message":"[SecuritySolution]
Update API key permissions on refreshing data view API
(#215738)\n\nUpdate the API key when entity store
`apply_dataview_indices` is called.\n\n## Summary\nThis change allows
the user to update the privileges the entity store\ndata view refresh
task uses. This will enable them to fix problems when\nthe user that
enabled the entity store doesn't have all data view\nindices
privileges.\n\nThis PR also improves some error messages that were hard
to read.\n\n### Context\n* `apply_dataview_indices`is an API that
updates the entity store\ntransform with the indices defined in the
security solution data view.\n* There is a background task that calls
`apply_dataview_indices` from\ntime to time\n* The background task uses
the API key to access the security solution\ndata view indices.\n\n\n###
How to test it\n* Create a kibana instance with security data\n* Create
a user that only has access the necessary access to the entity\nstore
indices\n* Enable the entity store with a the created user\n* Login with
a superuser \n* Add a new index to the security solution data view,
which the created\nuser cannot access.\n* The task will fail because it
uses the API key from the unprivileged\nuser.\n* Call
`apply_dataview_indices` with the superuser
(`POST\nkbn:api/entity_store/engines/apply_dataview_indices`)\n* The
request should succeed because it is using the superuser\ncredentials\n*
Add a new index to the security solution data view, which the
created\nuser cannot access.\n* The task should succeed because it is
using the superuser API key\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"e201b947be53e4e903ab1126592c3853f66108df"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.18"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/216004","number":216004,"state":"MERGED","mergeCommit":{"sha":"6c4126fd55ee8e00ecbb19054b1baddd2ff07903","message":"[9.0]
[SecuritySolution] Update API key permissions on refreshing data view
API (#215738) (#216004)\n\n# Backport\n\nThis will backport the
following commits from `main` to `9.0`:\n- [[SecuritySolution] Update
API key permissions on refreshing data view\nAPI
(#215738)](https://github.com/elastic/kibana/pull/215738)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Pablo Machado
<pablo.nevesmachado@elastic.co>"}},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/215738","number":215738,"mergeCommit":{"message":"[SecuritySolution]
Update API key permissions on refreshing data view API
(#215738)\n\nUpdate the API key when entity store
`apply_dataview_indices` is called.\n\n## Summary\nThis change allows
the user to update the privileges the entity store\ndata view refresh
task uses. This will enable them to fix problems when\nthe user that
enabled the entity store doesn't have all data view\nindices
privileges.\n\nThis PR also improves some error messages that were hard
to read.\n\n### Context\n* `apply_dataview_indices`is an API that
updates the entity store\ntransform with the indices defined in the
security solution data view.\n* There is a background task that calls
`apply_dataview_indices` from\ntime to time\n* The background task uses
the API key to access the security solution\ndata view indices.\n\n\n###
How to test it\n* Create a kibana instance with security data\n* Create
a user that only has access the necessary access to the entity\nstore
indices\n* Enable the entity store with a the created user\n* Login with
a superuser \n* Add a new index to the security solution data view,
which the created\nuser cannot access.\n* The task will fail because it
uses the API key from the unprivileged\nuser.\n* Call
`apply_dataview_indices` with the superuser
(`POST\nkbn:api/entity_store/engines/apply_dataview_indices`)\n* The
request should succeed because it is using the superuser\ncredentials\n*
Add a new index to the security solution data view, which the
created\nuser cannot access.\n* The task should succeed because it is
using the superuser API key\n\n### Checklist\n\nCheck the PR satisfies
following conditions. \n\nReviewers should verify this PR satisfies this
list as well.\n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"e201b947be53e4e903ab1126592c3853f66108df"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
cqliu1 pushed a commit to cqliu1/kibana that referenced this pull request Mar 31, 2025
… 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:enhancement Team:Entity Analytics Security Entity Analytics Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.18.0 v8.18.1 v8.19.0 v9.0.0 v9.0.1 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants