Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EDR Workflows] Endpoint Insights API #201521

Merged
merged 36 commits into from
Dec 4, 2024

Conversation

szwarckonrad
Copy link
Contributor

@szwarckonrad szwarckonrad commented Nov 25, 2024

Summary

This PR introduces two internal API routes:

  1. /internal/api/endpoint/workflow_isnights
  2. /internal/api/endpoint/workflow_isnights/{insightId}

Details

  • The first route (/internal/api/endpoint/workflow_isnights) will be used with the securityWorkflowInsightsService.fetch method to retrieve stored insights.
  • The second route (/internal/api/endpoint/workflow_isnights/{insightId}) will work with the securityWorkflowInsightsService.update method to update existing insights.

joeypoon and others added 3 commits November 22, 2024 23:47
Adds an SecurityConfigurationInsightsService that is setup during
security solution plugin initialization. The service setup installs the
component templates, index template, and datastream used by the service.
@szwarckonrad szwarckonrad self-assigned this Nov 25, 2024
@szwarckonrad szwarckonrad added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting v9.0.0 Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.18.0 labels Nov 25, 2024
@szwarckonrad szwarckonrad added backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) and removed backport:skip This commit does not require backporting labels Dec 2, 2024
Copy link
Contributor

@janmonschke janmonschke left a comment

Choose a reason for hiding this comment

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

THI changes lgtm 👍

Copy link
Contributor

@gergoabraham gergoabraham left a comment

Choose a reason for hiding this comment

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

looks great! 🚀 added some questions

Copy link
Contributor

@tomsonpl tomsonpl left a comment

Choose a reason for hiding this comment

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

LGTM 👍

minLength: 1,
validate: (id) => {
if (id.trim() === '') {
return `${field} can not be an empty string`;
Copy link
Contributor

Choose a reason for hiding this comment

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

typo - should be cannot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

minLength: 1,
validate: (id) => {
if (id.trim() === '') {
return 'insightId can not be an empty string';
Copy link
Contributor

Choose a reason for hiding this comment

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

typo - should be cannot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

},
}),
}),
body: schema.object({
Copy link
Contributor

Choose a reason for hiding this comment

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

is this hitting our internal API? Do you think it makes sense to enable accepting unknown values too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don’t see the need for it at the moment


// ensure it waits for initialization first
expect(isInitializedSpy).toHaveBeenCalledTimes(1);
// updates the doc
expect(esClient.update).toHaveBeenCalledTimes(1);
expect(esClient.update).toHaveBeenCalledWith({
index: DATA_STREAM_NAME,
index: indexName,
Copy link
Contributor

Choose a reason for hiding this comment

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

is this one different from DATA_STREAM_NAME that is still being used eg in line 213?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test on line 213 uses the data stream name, but the update method requires the name of the backing index, not the data stream itself.

@szwarckonrad szwarckonrad enabled auto-merge (squash) December 4, 2024 12:49
@szwarckonrad szwarckonrad merged commit 065738b into elastic:main Dec 4, 2024
8 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

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

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @szwarckonrad

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 4, 2024
### Summary

This PR introduces two internal API routes:

1. `/internal/api/endpoint/workflow_isnights`
2. `/internal/api/endpoint/workflow_isnights/{insightId}`

### Details

- The first route (`/internal/api/endpoint/workflow_isnights`) will be
used with the `securityWorkflowInsightsService.fetch` method to retrieve
stored insights.
- The second route
(`/internal/api/endpoint/workflow_isnights/{insightId}`) will work with
the `securityWorkflowInsightsService.update` method to update existing
insights.

---------

Co-authored-by: Joey F. Poon <[email protected]>
(cherry picked from commit 065738b)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

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 Dec 4, 2024
# Backport

This will backport the following commits from `main` to `8.x`:
- [[EDR Workflows] Endpoint Insights API
(#201521)](#201521)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Konrad
Szwarc","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-04T16:31:54Z","message":"[EDR
Workflows] Endpoint Insights API (#201521)\n\n### Summary\n\nThis PR
introduces two internal API routes:\n\n1.
`/internal/api/endpoint/workflow_isnights` \n2.
`/internal/api/endpoint/workflow_isnights/{insightId}` \n\n###
Details\n\n- The first route
(`/internal/api/endpoint/workflow_isnights`) will be\nused with the
`securityWorkflowInsightsService.fetch` method to retrieve\nstored
insights.\n- The second
route\n(`/internal/api/endpoint/workflow_isnights/{insightId}`) will
work with\nthe `securityWorkflowInsightsService.update` method to update
existing\ninsights.\n\n---------\n\nCo-authored-by: Joey F. Poon
<[email protected]>","sha":"065738bd110c4eb85c131f089d3b308d8b1dec6d","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Defend
Workflows","backport:prev-minor","v8.18.0"],"title":"[EDR Workflows]
Endpoint Insights
API","number":201521,"url":"https://github.com/elastic/kibana/pull/201521","mergeCommit":{"message":"[EDR
Workflows] Endpoint Insights API (#201521)\n\n### Summary\n\nThis PR
introduces two internal API routes:\n\n1.
`/internal/api/endpoint/workflow_isnights` \n2.
`/internal/api/endpoint/workflow_isnights/{insightId}` \n\n###
Details\n\n- The first route
(`/internal/api/endpoint/workflow_isnights`) will be\nused with the
`securityWorkflowInsightsService.fetch` method to retrieve\nstored
insights.\n- The second
route\n(`/internal/api/endpoint/workflow_isnights/{insightId}`) will
work with\nthe `securityWorkflowInsightsService.update` method to update
existing\ninsights.\n\n---------\n\nCo-authored-by: Joey F. Poon
<[email protected]>","sha":"065738bd110c4eb85c131f089d3b308d8b1dec6d"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201521","number":201521,"mergeCommit":{"message":"[EDR
Workflows] Endpoint Insights API (#201521)\n\n### Summary\n\nThis PR
introduces two internal API routes:\n\n1.
`/internal/api/endpoint/workflow_isnights` \n2.
`/internal/api/endpoint/workflow_isnights/{insightId}` \n\n###
Details\n\n- The first route
(`/internal/api/endpoint/workflow_isnights`) will be\nused with the
`securityWorkflowInsightsService.fetch` method to retrieve\nstored
insights.\n- The second
route\n(`/internal/api/endpoint/workflow_isnights/{insightId}`) will
work with\nthe `securityWorkflowInsightsService.update` method to update
existing\ninsights.\n\n---------\n\nCo-authored-by: Joey F. Poon
<[email protected]>","sha":"065738bd110c4eb85c131f089d3b308d8b1dec6d"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Konrad Szwarc <[email protected]>
SoniaSanzV pushed a commit to SoniaSanzV/kibana that referenced this pull request Dec 9, 2024
### Summary

This PR introduces two internal API routes:

1. `/internal/api/endpoint/workflow_isnights`  
2. `/internal/api/endpoint/workflow_isnights/{insightId}`  

### Details

- The first route (`/internal/api/endpoint/workflow_isnights`) will be
used with the `securityWorkflowInsightsService.fetch` method to retrieve
stored insights.
- The second route
(`/internal/api/endpoint/workflow_isnights/{insightId}`) will work with
the `securityWorkflowInsightsService.update` method to update existing
insights.

---------

Co-authored-by: Joey F. Poon <[email protected]>
SoniaSanzV pushed a commit to SoniaSanzV/kibana that referenced this pull request Dec 9, 2024
### Summary

This PR introduces two internal API routes:

1. `/internal/api/endpoint/workflow_isnights`  
2. `/internal/api/endpoint/workflow_isnights/{insightId}`  

### Details

- The first route (`/internal/api/endpoint/workflow_isnights`) will be
used with the `securityWorkflowInsightsService.fetch` method to retrieve
stored insights.
- The second route
(`/internal/api/endpoint/workflow_isnights/{insightId}`) will work with
the `securityWorkflowInsightsService.update` method to update existing
insights.

---------

Co-authored-by: Joey F. Poon <[email protected]>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 9, 2024
### Summary

This PR introduces two internal API routes:

1. `/internal/api/endpoint/workflow_isnights`  
2. `/internal/api/endpoint/workflow_isnights/{insightId}`  

### Details

- The first route (`/internal/api/endpoint/workflow_isnights`) will be
used with the `securityWorkflowInsightsService.fetch` method to retrieve
stored insights.
- The second route
(`/internal/api/endpoint/workflow_isnights/{insightId}`) will work with
the `securityWorkflowInsightsService.update` method to update existing
insights.

---------

Co-authored-by: Joey F. Poon <[email protected]>
Samiul-TheSoccerFan pushed a commit to Samiul-TheSoccerFan/kibana that referenced this pull request Dec 10, 2024
### Summary

This PR introduces two internal API routes:

1. `/internal/api/endpoint/workflow_isnights`  
2. `/internal/api/endpoint/workflow_isnights/{insightId}`  

### Details

- The first route (`/internal/api/endpoint/workflow_isnights`) will be
used with the `securityWorkflowInsightsService.fetch` method to retrieve
stored insights.
- The second route
(`/internal/api/endpoint/workflow_isnights/{insightId}`) will work with
the `securityWorkflowInsightsService.update` method to update existing
insights.

---------

Co-authored-by: Joey F. Poon <[email protected]>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
### Summary

This PR introduces two internal API routes:

1. `/internal/api/endpoint/workflow_isnights`  
2. `/internal/api/endpoint/workflow_isnights/{insightId}`  

### Details

- The first route (`/internal/api/endpoint/workflow_isnights`) will be
used with the `securityWorkflowInsightsService.fetch` method to retrieve
stored insights.
- The second route
(`/internal/api/endpoint/workflow_isnights/{insightId}`) will work with
the `securityWorkflowInsightsService.update` method to update existing
insights.

---------

Co-authored-by: Joey F. Poon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants