No description
Find a file
Ryland Herrick 7a5526768c
[Security Solution][Detections]Indicator Match Enrichment (#89899)
* Adds basic integration test for threat enrichment

* Update signals mappings with indicator fields

* Simplify some ternaries with Math.min

* Remove outdated comments

* Add notes from walkthrough with devin

* Add an enrichment hook to the current signal creation pipeline

When this moves to individual rule-specific data transformations this
will be a little more explicit/configurable; for now to keep changes
minimal, we're using dependency injection to pass a function, which will
default to the identity function (e.g. a no-op).

* Add utility functions for encoding/decoding our threat query

This is what allows us to enrich the threat match signals using only the
signal search response.

* Add a name to each threat match filter clause

This gives us the information we need to enrich our signals after
they've been queried without having to perform a complicated reverse
query.

* Adds functions for signal enrichment of threat indicators

* Wire up threat enrichment to threat match rules

* Fleshes out threat match integration tests

Adds assertions to the existing test, and fleshes out another test for a
multi-match signal.

* Add more test cases to indicator match integration tests

* single indicator matching multiple events
* multiple indicators matching a single event
* multiple indicators, multiple events
* placeholder for deduplication logic

This also adds some descriptions to our threat intel documents, to give
a little context around how they're meant to function within the tests,
particularly as relates to the auditbeat/hosts data on which it is meant
to function.

* Implement signal deduplification

This handles the situation where the indicator match search has returned
the same signal multiple times due to the source event matching
different indicators in different query batches. In this case, we want
to generate a single signal with all matched indicators.

* Move default indicator path to constant

* Testing some edge cases with signal enrichment

* Cover and test edge cases with threat enrichment generation

* Fix logical error in TI enrichment

We were previously adding the indicator's field to matched.field,
instead of the corresponding event field that matched the indicator.

In the normal case, the expectation is that the indicator field is
self-evident, and thus we want to know the other side of the match on
the event itself.

Updates tests accordingly.

* Document behavior when an indicator matched but is absent on enrichment

This could occur if the indicator index is updated while a rule is being
run.

* Add followup note

* Add basic unit test for our enrichment function

This just verifies that the enrichment function gets invoked with search
results.

* Update license headers for new files

* Remove unused threatintel archive

I made both of these before we were clear on the direction we were
taking here.

* Bump signals version to allows some updates in patch releases

* Fix typings of threat list item

We were conflating the type of the underlying document with the type of
the search response for that document. This is now addressed with two
types: ThreatListDoc and ThreatListItem, respectively.

ThreatListDoc isn't the most distinguishing name but it avoids a lot of
unnecessary renaming for the existing concept of ThreatListItem.

* Update test mock to be aware of (but not care about) named queries

* Remove/update outdated comments

This code was modified to perform two searches instead of one; at that
time, a lot of this code was duplicated and modified slightly, and these
misleading comments were a result. I removed the ones that were no
longer relevant, but left a TODO for one that could be a bug.

* Remove outdated comment

Documents will always have _id.

* Update enriched signals' total to account for deduplication

If a given signal matched on multiple indicators in different loops of
our indicator query, it may appear multiple times. Our enrichment
performs the merging of those duplicated results, but did not previously
update the response's total field to account for this.

I don't believe that anything downstream is actually using this field and that we
are instead operating on the length of hits and the response from the
bulk create request, but this keeps things consistent in case that
changes.

* Remove development comments

* Add JSDoc for our special template version constant

* Remove outdated comments

* Add an additional test permutation for error cases

Ensure that we throw an error if the indicator field is either a
primitive or an array of primitives.

* Remove unnecessary coalescing

These values are already defaulted in the parent, and the types are
correct in that these cannot be undefined.

* Move logic to build threat enrichment function into helper

* Refactor code to allow typescript to infer our type narrowing

existingSignalHit could not be undefined on line 30 here, but typescript
could not infer this from the !acc.has() call.

* Use a POJO over a Map

We were using a map previously in order to use .has() for a predicate,
but code has since been refactored to make that unnecessary.

* Explicitly type our enriched signals

These are being typed implicitly and verified against SignalSourceHit[]
on the assignment below, but this makes the types explicit and surfaces
a type error here instead of the subsequent assignment.

* Add an explanatory note about these test results

* Remove unused imports

These references were moved into buildThreatEnrichment

* Remove threat mappings accidentally brought in with indicator work

I copied the entirety of the `threat` mappings in order to get the
`threat.indicator` ones, but it looks like these were added at some
point too.

I'd rather these not be added incidentally. If we need them, we should
do so explicitly.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-02-11 19:43:09 -05:00
.ci ignore CI Stats failures in flaky test jobs (#90999) 2021-02-10 13:45:32 -05:00
.github [CI] Fix auto-backport condditions so that it doesn't trigger for other labels (#91042) 2021-02-10 16:42:00 -05:00
config
dev_docs Add saved object docs (#90860) 2021-02-11 11:27:46 -05:00
docs [Time to Visualize] Copy Panel to Dashboard (#90856) 2021-02-11 17:15:30 -05:00
examples Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
licenses Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
packages TS config cleanup (#90492) 2021-02-11 12:34:25 -05:00
plugins
rfcs RFC Improve saved object migrations algorithm (#84333) 2021-02-10 13:54:52 +01:00
scripts [ts/build_ts_refs] add support for --clean flag (#91060) 2021-02-10 22:38:06 -07:00
src [Time to Visualize] Copy Panel to Dashboard (#90856) 2021-02-11 17:15:30 -05:00
tasks/config [Timelion] Communicate the index pattern to the dashboard (#90623) 2021-02-11 14:24:08 +03:00
test [Time to Visualize] Copy Panel to Dashboard (#90856) 2021-02-11 17:15:30 -05:00
typings Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
utilities Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
vars [CI] Combines Jest unit tests (#89948) 2021-02-09 10:08:46 -08:00
x-pack [Security Solution][Detections]Indicator Match Enrichment (#89899) 2021-02-11 19:43:09 -05:00
.backportrc.json
.bazelignore chore(NA): introduce new yarn kbn reset command to support bazel workflow (#89597) 2021-02-03 22:02:34 +00:00
.bazeliskversion chore(NA): bazel machinery installation on kbn bootstrap (#89469) 2021-01-28 00:51:01 +00:00
.bazelrc chore(NA): move bazel workspace status from bash script into nodejs executable (#90560) 2021-02-08 22:24:14 +00:00
.bazelrc.common chore(NA): introduce new yarn kbn reset command to support bazel workflow (#89597) 2021-02-03 22:02:34 +00:00
.bazelversion chore(NA): bazel machinery installation on kbn bootstrap (#89469) 2021-01-28 00:51:01 +00:00
.browserslistrc
.editorconfig
.eslintignore [Timelion] Communicate the index pattern to the dashboard (#90623) 2021-02-11 14:24:08 +03:00
.eslintrc.js [Enterprise Search] Add eslint import/order rules (#90530) 2021-02-09 09:33:39 -08:00
.fossa.yml
.gitattributes
.gitignore chore(NA): introduce new yarn kbn reset command to support bazel workflow (#89597) 2021-02-03 22:02:34 +00:00
.i18nrc.json
.node-version
.npmrc
.nvmrc
.prettierignore
.prettierrc
.stylelintignore
.stylelintrc Implement custom global header banner (#87438) 2021-02-11 10:12:24 +01:00
.telemetryrc.json
.yarnrc
api-documenter.json
BUILD.bazel chore(NA): support bazel and kbn packages in parallel on kbn pm and on distributable build scripts (#89961) 2021-02-04 04:39:35 +00:00
CONTRIBUTING.md
FAQ.md
github_checks_reporter.json
Gruntfile.js Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
Jenkinsfile
jest.config.integration.js [CI] Combines Jest unit tests (#89948) 2021-02-09 10:08:46 -08:00
jest.config.js [CI] Combines Jest unit tests (#89948) 2021-02-09 10:08:46 -08:00
kibana.d.ts Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
LICENSE.txt Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
NOTICE.txt
package.json Update dependency @elastic/charts to v24.5.1 (#89822) 2021-02-11 09:18:48 +01:00
preinstall_check.js Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
README.md
renovate.json5 Fix vega renovate label (#90591) 2021-02-09 08:51:49 +02:00
SECURITY.md
STYLEGUIDE.md
tsconfig.base.json TS config cleanup (#90492) 2021-02-11 12:34:25 -05:00
tsconfig.browser.json
tsconfig.json TS config cleanup (#90492) 2021-02-11 12:34:25 -05:00
tsconfig.refs.json [Asset Management] Migrate Osquery plugin to TS project references (#90916) 2021-02-10 17:48:42 +01:00
tsconfig.types.json
TYPESCRIPT.md
WORKSPACE.bazel chore(NA): bazel machinery installation on kbn bootstrap (#89469) 2021-01-28 00:51:01 +00:00
yarn.lock Update dependency @elastic/charts to v24.5.1 (#89822) 2021-02-11 09:18:48 +01:00

Kibana

Kibana is your window into the Elastic Stack. Specifically, it's a browser-based analytics and search dashboard for Elasticsearch.

Getting Started

If you just want to try Kibana out, check out the Elastic Stack Getting Started Page to give it a whirl.

If you're interested in diving a bit deeper and getting a taste of Kibana's capabilities, head over to the Kibana Getting Started Page.

Using a Kibana Release

If you want to use a Kibana release in production, give it a test run, or just play around:

Building and Running Kibana, and/or Contributing Code

You might want to build Kibana locally to contribute some code, test out the latest features, or try out an open PR:

Documentation

Visit Elastic.co for the full Kibana documentation.

For information about building the documentation, see the README in elastic/docs.

Version Compatibility with Elasticsearch

Ideally, you should be running Elasticsearch and Kibana with matching version numbers. If your Elasticsearch has an older version number or a newer major number than Kibana, then Kibana will fail to run. If Elasticsearch has a newer minor or patch number than Kibana, then the Kibana Server will log a warning.

Note: The version numbers below are only examples, meant to illustrate the relationships between different types of version numbers.

Situation Example Kibana version Example ES version Outcome
Versions are the same. 5.1.2 5.1.2 💚 OK
ES patch number is newer. 5.1.2 5.1.5 ⚠️ Logged warning
ES minor number is newer. 5.1.2 5.5.0 ⚠️ Logged warning
ES major number is newer. 5.1.2 6.0.0 🚫 Fatal error
ES patch number is older. 5.1.2 5.1.0 ⚠️ Logged warning
ES minor number is older. 5.1.2 5.0.0 🚫 Fatal error
ES major number is older. 5.1.2 4.0.0 🚫 Fatal error

Questions? Problems? Suggestions?

  • If you've found a bug or want to request a feature, please create a GitHub Issue. Please check to make sure someone else hasn't already created an issue for the same topic.
  • Need help using Kibana? Ask away on our Kibana Discuss Forum and a fellow community member or Elastic engineer will be glad to help you out.