[8.7] [Security Solution][Rule Preview] Fixes <space-id> index permission bug with Rule Preview (#153590) (#153666)

# Backport

This will backport the following commits from `main` to `8.7`:
- [[Security Solution][Rule Preview] Fixes `<space-id>` index permission
bug with Rule Preview
(#153590)](https://github.com/elastic/kibana/pull/153590)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Davis
Plumlee","email":"56367316+dplumlee@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-03-24T14:49:44Z","message":"[Security
Solution][Rule Preview] Fixes `<space-id>` index permission bug with
Rule Preview
(#153590)","sha":"464169f0b462882e60bd0252822d10a2cb271fce","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Detection
Alerts","v8.8.0","v8.7.1"],"number":153590,"url":"https://github.com/elastic/kibana/pull/153590","mergeCommit":{"message":"[Security
Solution][Rule Preview] Fixes `<space-id>` index permission bug with
Rule Preview
(#153590)","sha":"464169f0b462882e60bd0252822d10a2cb271fce"}},"sourceBranch":"main","suggestedTargetBranches":["8.7"],"targetPullRequestStates":[{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/153590","number":153590,"mergeCommit":{"message":"[Security
Solution][Rule Preview] Fixes `<space-id>` index permission bug with
Rule Preview
(#153590)","sha":"464169f0b462882e60bd0252822d10a2cb271fce"}},{"branch":"8.7","label":"v8.7.1","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Davis Plumlee <56367316+dplumlee@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2023-03-24 12:35:24 -04:00 committed by GitHub
parent 7393366a3d
commit 6ea66dc973
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -136,8 +136,8 @@ export const previewRulesRoute = async (
.atSpace(spaceId, {
elasticsearch: {
index: {
[`${DEFAULT_PREVIEW_INDEX}`]: ['read'],
[`.internal${DEFAULT_PREVIEW_INDEX}-`]: ['read'],
[`${DEFAULT_PREVIEW_INDEX}-${spaceId}`]: ['read'],
[`.internal${DEFAULT_PREVIEW_INDEX}-${spaceId}-*`]: ['read'],
},
cluster: [],
},