Skip to content

[Security Solution][Endpoint] adds new alert loading utility and un-skip FTR test for endpoint#144133

Merged
paul-tavares merged 9 commits intoelastic:mainfrom
paul-tavares:task/olm-140701-unskip-endpoint-timeline-ftr
Oct 31, 2022
Merged

[Security Solution][Endpoint] adds new alert loading utility and un-skip FTR test for endpoint#144133
paul-tavares merged 9 commits intoelastic:mainfrom
paul-tavares:task/olm-140701-unskip-endpoint-timeline-ftr

Conversation

@paul-tavares
Copy link
Contributor

@paul-tavares paul-tavares commented Oct 27, 2022

Summary

  • adds a new service method that enables loading Endpoint Detection Engine alerts directly to the index (bypasses the Endpoint rule)
  • Un-skips test suite

fixes #140701

@paul-tavares paul-tavares added release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.6.0 labels Oct 27, 2022
@paul-tavares paul-tavares self-assigned this Oct 27, 2022
@paul-tavares
Copy link
Contributor Author

@paul-tavares paul-tavares marked this pull request as ready for review October 27, 2022 20:52
@paul-tavares paul-tavares requested a review from a team as a code owner October 27, 2022 20:52
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-onboarding-and-lifecycle-mgt (Team:Onboarding and Lifecycle Mgt)

@paul-tavares
Copy link
Contributor Author

Copy link
Contributor

@kevinlog kevinlog left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@ashokaditya ashokaditya left a comment

Choose a reason for hiding this comment

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

I have a few questions but it's good to 🚢


/**
* Waits for alerts to have been loaded into `.alerts-security.alerts-default` index
* Waits for alerts to have been loaded by calling continuously calling the alerts api until data shows up
Copy link
Member

Choose a reason for hiding this comment

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

this sentence has one too many calling 😅

},
],
malware_classification: {
identifier: 'endpointpe',
Copy link
Member

Choose a reason for hiding this comment

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

is this supposed to be endpointype?

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'm not sure. I essentially "dumped" what a record looked like once the Endpoint rule ran and created alerts and just copied that. This is what I ended up with

alerts: indexedAlerts,
cleanup: async (): Promise<void> => {
if (indexedAlerts.length) {
this.log.info(`cleaning up loaded endpoint rule alerts`);
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't need template literals unless maybe you forgot to log some variables here.

};
}

private async ensureEndpointRuleAlertsIndexExists() {
Copy link
Member

@ashokaditya ashokaditya Oct 31, 2022

Choose a reason for hiding this comment

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

please add a return type to this function.

Comment on lines +73 to +89
await this.esClient.indices.create({
index: indexMappings.index,
body: {
settings: indexMappings.settings,
mappings: indexMappings.mappings,
aliases: indexMappings.aliases,
},
});
} catch (error) {
// ignore error that indicate index is already created
if (
['resource_already_exists_exception', 'invalid_alias_name_exception'].includes(
error?.body?.error?.type
)
) {
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

You can also use indices.exists before calling indices.create. Then you won't have to ignore the resource_already_exists_exception. 🤔

@paul-tavares paul-tavares enabled auto-merge (squash) October 31, 2022 18:59
@kibana-ci
Copy link

💚 Build Succeeded

Metrics [docs]

Unknown metric groups

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 57 63 +6
osquery 103 108 +5
securitySolution 439 443 +4
total +17

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 65 71 +6
osquery 104 110 +6
securitySolution 516 520 +4
total +18

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @paul-tavares

@paul-tavares paul-tavares merged commit e5179d3 into elastic:main Oct 31, 2022
@kibanamachine kibanamachine added the backport:skip This PR does not require backporting label Oct 31, 2022
@paul-tavares paul-tavares deleted the task/olm-140701-unskip-endpoint-timeline-ftr branch October 31, 2022 20:15
jloleysens added a commit to jloleysens/kibana that referenced this pull request Nov 1, 2022
* main: (43 commits)
  [Synthetics] Step details page screenshot (elastic#143452)
  [Lens] Datatable expression types improvement. (elastic#144173)
  [packages/kbn-journeys] start apm after browser start and stop after browser is closed (elastic#144267)
  [Files] Make files namespace agnostic (elastic#144019)
  Implement base browser-side logging system (elastic#144107)
  Correct wrong multiplier for byte conversion (elastic#143751)
  [Monaco] Add JSON syntax support to the Monaco editor (elastic#143739)
  CCS Smoke Test for Remote Clusters and Index Management  (elastic#142423)
  [api-docs] Daily api_docs build (elastic#144294)
  chore(NA): include progress on Bazel tasks (elastic#144275)
  [RAM] Allow users to see event logs from all spaces they have access to (elastic#140449)
  [APM] Show recommended minimum size when going below 5 minutes (elastic#144170)
  [typecheck] delete temporary target_types dirs in packages (elastic#144271)
  [Security Solution][Endpoint] adds new alert loading utility and un-skip FTR test for endpoint (elastic#144133)
  [performance/journeys] revert data_stress_test_lens.ts journey step (elastic#144261)
  [TIP] Use search strategies in Threat Intelligence (elastic#143267)
  Optimize react-query dependencies (elastic#144206)
  [babel/node] invalidate cache when synth pkg map is updated (elastic#144258)
  [APM] AWS lambda estimated cost (elastic#143986)
  [Maps] layer group wizard (elastic#144129)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.6.0

Projects

None yet

6 participants