Skip to content

[9.0] [SecuritySolution] Update API key permissions on refreshing data view API (#215738)#216004

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

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

Conversation

@kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 9.0:

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)
@kibanamachine kibanamachine merged commit 6c4126f into elastic:9.0 Mar 26, 2025
12 checks passed
@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

cc @machadoum

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>
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.

3 participants