Skip to content

Conversation

@kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 9.1:

Questions ?

Please refer to the Backport tool documentation

…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 kibanamachine merged commit 67458ff into elastic:9.1 Aug 6, 2025
16 checks passed
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #62 / cloud_security_posture GET internal/cloud_security_posture/rules/_find Should return 200 status code, and only requested fields in the response

Metrics [docs]

✅ unchanged

cc @romulets

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