[9.4] Change WatchlistConfigClient to use internal Elasticsearch client instead of current user (#265966)#266437
Merged
kibanamachine merged 1 commit intoelastic:9.4from Apr 29, 2026
Conversation
…tead of current user (elastic#265966) ### Summary This PR changes the create watchlist to use internalUser instead of currentUser for creating the internal watchlist index. Additionally, this PR removes the placeholder privileged user monitoring permissions checks from the watchlist management page as we only need access to the internal watchlist index and any indicies permissions, should be handled per user e.g. if a user requires access to the ml indicies, this is not the responsibility of watchlists specifically. - Added `internalEsClient` dependency to `WatchlistConfigClientDeps` for system index operations. - Updated `WatchlistConfigClient` to throw an error if `internalEsClient` is not provided. - Modified index creation logic to use `internalEsClient` instead of the regular `esClient`. - Adjusted related tests to mock the new internal client dependency. #### Testing steps Feature Flags: ``` xpack.securitySolution.enableExperimental: - entityAnalyticsWatchlistEnabled - securitySolution:entityStoreEnableV2 - entityAnalyticsEntityStoreV2 uiSettings.overrides: securitySolution:entityStoreEnableV2: true ``` 1. Open a kibana instance 2. Create a user with basic role - security all, no access to specific watchlist indicies. 3. Login with that user and try to load up the entity analytics management page, go to watchlists tab 4. Note that, the watchlists management table shows no permissions error messages 5. Click create watchlist, ensure you can now create a watchlist without error messages No data generation required for this. (cherry picked from commit 48b4667)
Contributor
There was a problem hiding this comment.
🟢 Low
In create, the check for internalEsClient occurs after the saved object is already persisted (lines 97-101), so when internalEsClient is missing, the method throws but leaves an orphaned watchlist config in an inconsistent state. Move the validation before the soClient.create call.
🤖 Copy this AI Prompt to have your agent fix this:
In file x-pack/solutions/security/plugins/security_solution/server/lib/entity_analytics/watchlists/management/watchlist_config.ts around line 93:
In `create`, the check for `internalEsClient` occurs after the saved object is already persisted (lines 97-101), so when `internalEsClient` is missing, the method throws but leaves an orphaned watchlist config in an inconsistent state. Move the validation before the `soClient.create` call.
Evidence trail:
x-pack/solutions/security/plugins/security_solution/server/lib/entity_analytics/watchlists/management/watchlist_config.ts lines 97-113 at REVIEWED_COMMIT: soClient.create at lines 97-101, internalEsClient check at lines 103-105, createOrUpdateIndex at lines 107-114.
Contributor
Author
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
cc @CAWilson94 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto9.4:Questions ?
Please refer to the Backport tool documentation