Skip to content

Conversation

@romulets
Copy link
Member

@romulets romulets commented Aug 6, 2025

Summary

Solves two bugs:

Relates to #230723

Logs Before PR

image

Logs with PR

image

@romulets romulets requested a review from a team as a code owner August 6, 2025 10:18
@romulets romulets self-assigned this Aug 6, 2025
@romulets romulets requested a review from a team August 6, 2025 10:20
@romulets romulets added backport:version Backport to applied version labels v9.1.1 release_note:skip Skip the PR/issue when compiling release notes labels Aug 6, 2025
@romulets romulets removed the request for review from abhishekbhatia1710 August 6, 2025 10:24
@uri-weisman uri-weisman added the Team:Core Analysis Security Solution label Aug 6, 2025
Copy link
Contributor

@eyalkraft eyalkraft left a comment

Choose a reason for hiding this comment

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

Nice!

@romulets romulets enabled auto-merge (squash) August 6, 2025 12:26
@romulets romulets merged commit d495428 into elastic:main Aug 6, 2025
23 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 9.1

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

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

cc @romulets

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 6, 2025
…astic#230746)

## Summary

Solves two bugs:

- The API key was not being found once multiple spaces were created, and
**no enrich policy** should be working before this PR in a kibana with
multiple spaces. We were missing the `option` `namespace` to get
`getDecryptedAsInternalUser` (doesn't feel that like that much of an
option). The call chain:
- [`getDecryptedAsInternalUser` calls `internalRepository.get` passing
options
down](https://github.com/elastic/kibana/blob/main/x-pack/platform/plugins/shared/encrypted_saved_objects/server/saved_objects/index.ts#L77)
- [A `performGet` is done passing options
down](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/repository.ts#L377)
- [`options.namespace` is normalized (and remais
undefined)](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/get.ts#L34)
- [We check if document exists in the namespace, passing the undefined
namespace](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/get.ts#L56)
- [On verifying that the namespace saved in the SavedObject is the same
as the passed
down](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/internal_utils.ts#L178),
we [normalize the namespace to
`default`](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/utils-server/src/saved_objects_utils.ts#L39),
which is then preset in the list stored in the saved object.
- If no API key found for namespace, return all entity types. Before it
was being returned an object. Decided to just use method
`getEnabledEntityTypes` passing the feature flag as enabled (there is
also a log).

Relates to elastic#230723

#### Logs Before PR
<img width="1671" height="735" alt="image"
src="https://github.com/user-attachments/assets/0fc538b9-ecf3-4f9b-9209-198d514b44c7"
/>

#### Logs with PR

<img width="1574" height="141" alt="image"
src="https://github.com/user-attachments/assets/1574531f-57e7-4848-8e8b-0aeff033f1c9"
/>

(cherry picked from commit d495428)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
9.1

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

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Aug 6, 2025
…es (#230746) (#230779)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[Entity Store] Fix Enrich Policy execution in multiple namespaces
(#230746)](#230746)

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

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

<!--BACKPORT [{"author":{"name":"Rômulo
Farias","email":"romulo.farias@elastic.co"},"sourceCommit":{"committedDate":"2025-08-06T12:43:29Z","message":"[Entity
Store] Fix Enrich Policy execution in multiple namespaces
(#230746)\n\n## Summary\n\nSolves two bugs:\n\n- The API key was not
being found once multiple spaces were created, and\n**no enrich policy**
should be working before this PR in a kibana with\nmultiple spaces. We
were missing the `option` `namespace` to
get\n`getDecryptedAsInternalUser` (doesn't feel that like that much of
an\noption). The call chain:\n- [`getDecryptedAsInternalUser` calls
`internalRepository.get`
passing\noptions\ndown](https://github.com/elastic/kibana/blob/main/x-pack/platform/plugins/shared/encrypted_saved_objects/server/saved_objects/index.ts#L77)\n-
[A `performGet` is done passing
options\ndown](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/repository.ts#L377)\n-
[`options.namespace` is normalized (and
remais\nundefined)](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/get.ts#L34)\n-
[We check if document exists in the namespace, passing the
undefined\nnamespace](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/get.ts#L56)\n-
[On verifying that the namespace saved in the SavedObject is the
same\nas the
passed\ndown](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/internal_utils.ts#L178),\nwe
[normalize the namespace
to\n`default`](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/utils-server/src/saved_objects_utils.ts#L39),\nwhich
is then preset in the list stored in the saved object.\n- If no API key
found for namespace, return all entity types. Before it\nwas being
returned an object. Decided to just use method\n`getEnabledEntityTypes`
passing the feature flag as enabled (there is\nalso a log).\n\nRelates
to https://github.com/elastic/kibana/issues/230723\n\n#### Logs Before
PR\n<img width=\"1671\" height=\"735\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/0fc538b9-ecf3-4f9b-9209-198d514b44c7\"\n/>\n\n####
Logs with PR\n\n<img width=\"1574\" height=\"141\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/1574531f-57e7-4848-8e8b-0aeff033f1c9\"\n/>","sha":"d495428f9771ab0dfed11447f78c4e0e4641635d","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","v9.2.0","Team:Core
Analysis","v9.1.1"],"title":"[Entity Store] Fix Enrich Policy execution
in multiple
namespaces","number":230746,"url":"https://github.com/elastic/kibana/pull/230746","mergeCommit":{"message":"[Entity
Store] Fix Enrich Policy execution in multiple namespaces
(#230746)\n\n## Summary\n\nSolves two bugs:\n\n- The API key was not
being found once multiple spaces were created, and\n**no enrich policy**
should be working before this PR in a kibana with\nmultiple spaces. We
were missing the `option` `namespace` to
get\n`getDecryptedAsInternalUser` (doesn't feel that like that much of
an\noption). The call chain:\n- [`getDecryptedAsInternalUser` calls
`internalRepository.get`
passing\noptions\ndown](https://github.com/elastic/kibana/blob/main/x-pack/platform/plugins/shared/encrypted_saved_objects/server/saved_objects/index.ts#L77)\n-
[A `performGet` is done passing
options\ndown](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/repository.ts#L377)\n-
[`options.namespace` is normalized (and
remais\nundefined)](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/get.ts#L34)\n-
[We check if document exists in the namespace, passing the
undefined\nnamespace](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/get.ts#L56)\n-
[On verifying that the namespace saved in the SavedObject is the
same\nas the
passed\ndown](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/internal_utils.ts#L178),\nwe
[normalize the namespace
to\n`default`](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/utils-server/src/saved_objects_utils.ts#L39),\nwhich
is then preset in the list stored in the saved object.\n- If no API key
found for namespace, return all entity types. Before it\nwas being
returned an object. Decided to just use method\n`getEnabledEntityTypes`
passing the feature flag as enabled (there is\nalso a log).\n\nRelates
to https://github.com/elastic/kibana/issues/230723\n\n#### Logs Before
PR\n<img width=\"1671\" height=\"735\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/0fc538b9-ecf3-4f9b-9209-198d514b44c7\"\n/>\n\n####
Logs with PR\n\n<img width=\"1574\" height=\"141\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/1574531f-57e7-4848-8e8b-0aeff033f1c9\"\n/>","sha":"d495428f9771ab0dfed11447f78c4e0e4641635d"}},"sourceBranch":"main","suggestedTargetBranches":["9.1"],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/230746","number":230746,"mergeCommit":{"message":"[Entity
Store] Fix Enrich Policy execution in multiple namespaces
(#230746)\n\n## Summary\n\nSolves two bugs:\n\n- The API key was not
being found once multiple spaces were created, and\n**no enrich policy**
should be working before this PR in a kibana with\nmultiple spaces. We
were missing the `option` `namespace` to
get\n`getDecryptedAsInternalUser` (doesn't feel that like that much of
an\noption). The call chain:\n- [`getDecryptedAsInternalUser` calls
`internalRepository.get`
passing\noptions\ndown](https://github.com/elastic/kibana/blob/main/x-pack/platform/plugins/shared/encrypted_saved_objects/server/saved_objects/index.ts#L77)\n-
[A `performGet` is done passing
options\ndown](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/repository.ts#L377)\n-
[`options.namespace` is normalized (and
remais\nundefined)](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/get.ts#L34)\n-
[We check if document exists in the namespace, passing the
undefined\nnamespace](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/get.ts#L56)\n-
[On verifying that the namespace saved in the SavedObject is the
same\nas the
passed\ndown](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/internal_utils.ts#L178),\nwe
[normalize the namespace
to\n`default`](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/utils-server/src/saved_objects_utils.ts#L39),\nwhich
is then preset in the list stored in the saved object.\n- If no API key
found for namespace, return all entity types. Before it\nwas being
returned an object. Decided to just use method\n`getEnabledEntityTypes`
passing the feature flag as enabled (there is\nalso a log).\n\nRelates
to https://github.com/elastic/kibana/issues/230723\n\n#### Logs Before
PR\n<img width=\"1671\" height=\"735\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/0fc538b9-ecf3-4f9b-9209-198d514b44c7\"\n/>\n\n####
Logs with PR\n\n<img width=\"1574\" height=\"141\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/1574531f-57e7-4848-8e8b-0aeff033f1c9\"\n/>","sha":"d495428f9771ab0dfed11447f78c4e0e4641635d"}},{"branch":"9.1","label":"v9.1.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Rômulo Farias <romulo.farias@elastic.co>
gergoabraham pushed a commit to gergoabraham/kibana that referenced this pull request Aug 7, 2025
…astic#230746)

## Summary

Solves two bugs:

- The API key was not being found once multiple spaces were created, and
**no enrich policy** should be working before this PR in a kibana with
multiple spaces. We were missing the `option` `namespace` to get
`getDecryptedAsInternalUser` (doesn't feel that like that much of an
option). The call chain:
- [`getDecryptedAsInternalUser` calls `internalRepository.get` passing
options
down](https://github.com/elastic/kibana/blob/main/x-pack/platform/plugins/shared/encrypted_saved_objects/server/saved_objects/index.ts#L77)
- [A `performGet` is done passing options
down](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/repository.ts#L377)
- [`options.namespace` is normalized (and remais
undefined)](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/get.ts#L34)
- [We check if document exists in the namespace, passing the undefined
namespace](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/get.ts#L56)
- [On verifying that the namespace saved in the SavedObject is the same
as the passed
down](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/internal_utils.ts#L178),
we [normalize the namespace to
`default`](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/utils-server/src/saved_objects_utils.ts#L39),
which is then preset in the list stored in the saved object.
- If no API key found for namespace, return all entity types. Before it
was being returned an object. Decided to just use method
`getEnabledEntityTypes` passing the feature flag as enabled (there is
also a log).

Relates to elastic#230723

#### Logs Before PR
<img width="1671" height="735" alt="image"
src="https://github.com/user-attachments/assets/0fc538b9-ecf3-4f9b-9209-198d514b44c7"
/>

#### Logs with PR

<img width="1574" height="141" alt="image"
src="https://github.com/user-attachments/assets/1574531f-57e7-4848-8e8b-0aeff033f1c9"
/>
@wildemat wildemat mentioned this pull request Aug 7, 2025
10 tasks
@mistic mistic added v9.1.2 and removed v9.1.1 labels Aug 7, 2025
NicholasPeretti pushed a commit to NicholasPeretti/kibana that referenced this pull request Aug 18, 2025
…astic#230746)

## Summary

Solves two bugs:

- The API key was not being found once multiple spaces were created, and
**no enrich policy** should be working before this PR in a kibana with
multiple spaces. We were missing the `option` `namespace` to get
`getDecryptedAsInternalUser` (doesn't feel that like that much of an
option). The call chain:
- [`getDecryptedAsInternalUser` calls `internalRepository.get` passing
options
down](https://github.com/elastic/kibana/blob/main/x-pack/platform/plugins/shared/encrypted_saved_objects/server/saved_objects/index.ts#L77)
- [A `performGet` is done passing options
down](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/repository.ts#L377)
- [`options.namespace` is normalized (and remais
undefined)](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/get.ts#L34)
- [We check if document exists in the namespace, passing the undefined
namespace](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/get.ts#L56)
- [On verifying that the namespace saved in the SavedObject is the same
as the passed
down](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/api-server-internal/src/lib/apis/utils/internal_utils.ts#L178),
we [normalize the namespace to
`default`](https://github.com/elastic/kibana/blob/main/src/core/packages/saved-objects/utils-server/src/saved_objects_utils.ts#L39),
which is then preset in the list stored in the saved object.
- If no API key found for namespace, return all entity types. Before it
was being returned an object. Decided to just use method
`getEnabledEntityTypes` passing the feature flag as enabled (there is
also a log).

Relates to elastic#230723

#### Logs Before PR
<img width="1671" height="735" alt="image"
src="https://github.com/user-attachments/assets/0fc538b9-ecf3-4f9b-9209-198d514b44c7"
/>

#### Logs with PR

<img width="1574" height="141" alt="image"
src="https://github.com/user-attachments/assets/1574531f-57e7-4848-8e8b-0aeff033f1c9"
/>
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:skip Skip the PR/issue when compiling release notes Team:Core Analysis Security Solution v9.1.2 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Entity Store] Enrich Policy not being executed for multiple kibana spaces

7 participants