[Entity Analytics][Watchlists] Add entity source management API#253987
[Entity Analytics][Watchlists] Add entity source management API#253987tiansivive wants to merge 7 commits intoelastic:mainfrom
Conversation
77a5e6e to
5d6f6f3
Compare
5d6f6f3 to
3e0cbd1
Compare
|
Pinging @elastic/security-entity-analytics (Team:Entity Analytics) |
CAWilson94
left a comment
There was a problem hiding this comment.
Desk tested, working as described! 🚀
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
History
|
hop-dev
left a comment
There was a problem hiding this comment.
We need to gate these behind a feature flag or the entity store v2 UI setting, and we will need to mention that in the API docs too
| const allSources = await client.list(request.query); | ||
| const body = { | ||
| ...allSources, | ||
| sources: allSources.sources.filter((source) => linkedSourceIds.includes(source.id)), |
There was a problem hiding this comment.
why do we do this filtering in typescript? I think we need to add this to the SO filter otherwise it breaks pagination
| const client = secSol.getMonitoringEntitySourceDataClient(); | ||
|
|
||
| // Get the source first to check if it's managed | ||
| const source = await client.get(request.params.id); |
There was a problem hiding this comment.
we take the watchlist_id in the URL but then proceed to only use the source ID, should we be validating that the source belongs to the specified watchlsit? or changing the URL scheme?
| const extractEntitySourceIds = (references: SavedObjectReference[]): string[] => | ||
| references.filter(isEntitySourceRef).map((ref) => ref.id); | ||
|
|
||
| // TODO: Update WatchlistObject OpenAPI schema to include entitySourceIds |
There was a problem hiding this comment.
I actually think this is outdated, i already updated it
Summary
CRUD API for entity source management per watchlist, ported over from privmon.
Note that the saved object client and related details have not been ported. We're still directly importing code from privmon
This API makes use of the Kibana Saved Object references feature to link entity sources to watchlists.
How to test
The response should list watchlists and their related entity sources