Skip to content

Commit

Permalink
[Security Solution] UEBA Spacetime Project (#104973)
Browse files Browse the repository at this point in the history
Merging with known issues documented here: #106648
  • Loading branch information
stephmilovic authored Jul 23, 2021
1 parent 3e4b64b commit c0ceb06
Show file tree
Hide file tree
Showing 121 changed files with 5,143 additions and 117 deletions.
24 changes: 16 additions & 8 deletions x-pack/plugins/security_solution/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,21 @@ export const DEFAULT_INDICATOR_SOURCE_PATH = 'threatintel.indicator';
export const INDICATOR_DESTINATION_PATH = 'threat.indicator';

export enum SecurityPageName {
overview = 'overview',
detections = 'detections',
administration = 'administration',
alerts = 'alerts',
rules = 'rules',
case = 'case',
detections = 'detections',
endpoints = 'endpoints',
eventFilters = 'event_filters',
exceptions = 'exceptions',
hosts = 'hosts',
network = 'network',
timelines = 'timelines',
case = 'case',
administration = 'administration',
endpoints = 'endpoints',
overview = 'overview',
policies = 'policies',
rules = 'rules',
timelines = 'timelines',
trustedApps = 'trusted_apps',
eventFilters = 'event_filters',
ueba = 'ueba',
}

export const TIMELINES_PATH = '/timelines';
Expand All @@ -86,6 +87,7 @@ export const ALERTS_PATH = '/alerts';
export const RULES_PATH = '/rules';
export const EXCEPTIONS_PATH = '/exceptions';
export const HOSTS_PATH = '/hosts';
export const UEBA_PATH = '/ueba';
export const NETWORK_PATH = '/network';
export const MANAGEMENT_PATH = '/administration';
export const ENDPOINTS_PATH = `${MANAGEMENT_PATH}/endpoints`;
Expand All @@ -100,6 +102,7 @@ export const APP_RULES_PATH = `${APP_PATH}${RULES_PATH}`;
export const APP_EXCEPTIONS_PATH = `${APP_PATH}${EXCEPTIONS_PATH}`;

export const APP_HOSTS_PATH = `${APP_PATH}${HOSTS_PATH}`;
export const APP_UEBA_PATH = `${APP_PATH}${UEBA_PATH}`;
export const APP_NETWORK_PATH = `${APP_PATH}${NETWORK_PATH}`;
export const APP_TIMELINES_PATH = `${APP_PATH}${TIMELINES_PATH}`;
export const APP_CASES_PATH = `${APP_PATH}${CASES_PATH}`;
Expand All @@ -119,6 +122,11 @@ export const DEFAULT_INDEX_PATTERN = [
'winlogbeat-*',
];

export const DEFAULT_INDEX_PATTERN_EXPERIMENTAL = [
// TODO: Steph/ueba TEMP for testing UEBA data
'ml_host_risk_score_*',
];

/** This Kibana Advanced Setting enables the `Security news` feed widget */
export const ENABLE_NEWS_FEED_SETTING = 'securitySolution:enableNewsFeed';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ export type ExperimentalFeatures = typeof allowedExperimentalValues;
* A list of allowed values that can be used in `xpack.securitySolution.enableExperimental`.
* This object is then used to validate and parse the value entered.
*/
const allowedExperimentalValues = Object.freeze({
trustedAppsByPolicyEnabled: false,
export const allowedExperimentalValues = Object.freeze({
metricsEntitiesEnabled: false,
ruleRegistryEnabled: false,
tGridEnabled: false,
trustedAppsByPolicyEnabled: false,
uebaEnabled: false,
});

type ExperimentalConfigKeys = Array<keyof ExperimentalFeatures>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,27 @@ import {
CtiEventEnrichmentStrategyResponse,
CtiQueries,
} from './cti';
import {
HostRulesRequestOptions,
HostRulesStrategyResponse,
HostTacticsRequestOptions,
HostTacticsStrategyResponse,
RiskScoreRequestOptions,
RiskScoreStrategyResponse,
UebaQueries,
UserRulesRequestOptions,
UserRulesStrategyResponse,
} from './ueba';

export * from './hosts';
export * from './matrix_histogram';
export * from './network';
export * from './ueba';

export type FactoryQueryTypes =
| HostsQueries
| HostsKpiQueries
| UebaQueries
| NetworkQueries
| NetworkKpiQueries
| CtiQueries
Expand Down Expand Up @@ -109,6 +122,14 @@ export type StrategyResponseType<T extends FactoryQueryTypes> = T extends HostsQ
? HostsStrategyResponse
: T extends HostsQueries.details
? HostDetailsStrategyResponse
: T extends UebaQueries.riskScore
? RiskScoreStrategyResponse
: T extends UebaQueries.hostRules
? HostRulesStrategyResponse
: T extends UebaQueries.userRules
? UserRulesStrategyResponse
: T extends UebaQueries.hostTactics
? HostTacticsStrategyResponse
: T extends HostsQueries.overview
? HostsOverviewStrategyResponse
: T extends HostsQueries.authentications
Expand Down Expand Up @@ -199,6 +220,14 @@ export type StrategyRequestType<T extends FactoryQueryTypes> = T extends HostsQu
? NetworkKpiUniqueFlowsRequestOptions
: T extends NetworkKpiQueries.uniquePrivateIps
? NetworkKpiUniquePrivateIpsRequestOptions
: T extends UebaQueries.riskScore
? RiskScoreRequestOptions
: T extends UebaQueries.hostRules
? HostRulesRequestOptions
: T extends UebaQueries.userRules
? UserRulesRequestOptions
: T extends UebaQueries.hostTactics
? HostTacticsRequestOptions
: T extends typeof MatrixHistogramQuery
? MatrixHistogramRequestOptions
: T extends CtiQueries.eventEnrichment
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { Maybe } from '../../../common';

export enum RiskScoreFields {
hostName = 'host_name',
riskKeyword = 'risk_keyword',
riskScore = 'risk_score',
}
export interface RiskScoreItem {
_id?: Maybe<string>;
[RiskScoreFields.hostName]: Maybe<string>;
[RiskScoreFields.riskKeyword]: Maybe<string>;
[RiskScoreFields.riskScore]: Maybe<number>;
}
export enum HostRulesFields {
hits = 'hits',
riskScore = 'risk_score',
ruleName = 'rule_name',
ruleType = 'rule_type',
}
export interface HostRulesItem {
_id?: Maybe<string>;
[HostRulesFields.hits]: Maybe<number>;
[HostRulesFields.riskScore]: Maybe<number>;
[HostRulesFields.ruleName]: Maybe<string>;
[HostRulesFields.ruleType]: Maybe<string>;
}
export enum UserRulesFields {
userName = 'user_name',
riskScore = 'risk_score',
rules = 'rules',
ruleCount = 'rule_count',
}
export enum HostTacticsFields {
hits = 'hits',
riskScore = 'risk_score',
tactic = 'tactic',
technique = 'technique',
}
export interface HostTacticsItem {
_id?: Maybe<string>;
[HostTacticsFields.hits]: Maybe<number>;
[HostTacticsFields.riskScore]: Maybe<number>;
[HostTacticsFields.tactic]: Maybe<string>;
[HostTacticsFields.technique]: Maybe<string>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { IEsSearchResponse } from '../../../../../../../../src/plugins/data/common';

import { HostRulesItem, HostRulesFields } from '../common';
import { CursorType, Hit, Inspect, Maybe, PageInfoPaginated, SortField } from '../../../common';
import { RequestOptionsPaginated } from '../..';

export interface HostRulesHit extends Hit {
key: string;
doc_count: number;
risk_score: {
value?: number;
};
rule_type: {
buckets?: Array<{
key: string;
doc_count: number;
}>;
};
rule_count: {
value: number;
};
}

export interface HostRulesEdges {
node: HostRulesItem;
cursor: CursorType;
}

export interface HostRulesStrategyResponse extends IEsSearchResponse {
edges: HostRulesEdges[];
totalCount: number;
pageInfo: PageInfoPaginated;
inspect?: Maybe<Inspect>;
}

export interface HostRulesRequestOptions extends RequestOptionsPaginated<HostRulesFields> {
defaultIndex: string[];
hostName: string;
}

export type HostRulesSortField = SortField<HostRulesFields>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { IEsSearchResponse } from '../../../../../../../../src/plugins/data/common';

import { HostTacticsItem, HostTacticsFields } from '../common';
import { CursorType, Hit, Inspect, Maybe, PageInfoPaginated, SortField } from '../../../common';
import { RequestOptionsPaginated } from '../..';
export interface HostTechniqueHit {
key: string;
doc_count: number;
risk_score: {
value?: number;
};
}
export interface HostTacticsHit extends Hit {
key: string;
doc_count: number;
risk_score: {
value?: number;
};
technique: {
buckets?: HostTechniqueHit[];
};
tactic_count: {
value: number;
};
}

export interface HostTacticsEdges {
node: HostTacticsItem;
cursor: CursorType;
}

export interface HostTacticsStrategyResponse extends IEsSearchResponse {
edges: HostTacticsEdges[];
techniqueCount: number;
totalCount: number;
pageInfo: PageInfoPaginated;
inspect?: Maybe<Inspect>;
}

export interface HostTacticsRequestOptions extends RequestOptionsPaginated<HostTacticsFields> {
defaultIndex: string[];
hostName: string;
}

export type HostTacticsSortField = SortField<HostTacticsFields>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export * from './common';
export * from './host_rules';
export * from './host_tactics';
export * from './risk_score';
export * from './user_rules';

export enum UebaQueries {
hostRules = 'hostRules',
hostTactics = 'hostTactics',
riskScore = 'riskScore',
userRules = 'userRules',
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { IEsSearchResponse } from '../../../../../../../../src/plugins/data/common';

import { RiskScoreItem, RiskScoreFields } from '../common';
import { CursorType, Hit, Inspect, Maybe, PageInfoPaginated, SortField } from '../../../common';
import { RequestOptionsPaginated } from '../..';

export interface RiskScoreHit extends Hit {
_source: {
'@timestamp': string;
};
key: string;
doc_count: number;
risk_score: {
value?: number;
};
risk_keyword: {
buckets?: Array<{
key: string;
doc_count: number;
}>;
};
}

export interface RiskScoreEdges {
node: RiskScoreItem;
cursor: CursorType;
}

export interface RiskScoreStrategyResponse extends IEsSearchResponse {
edges: RiskScoreEdges[];
totalCount: number;
pageInfo: PageInfoPaginated;
inspect?: Maybe<Inspect>;
}

export interface RiskScoreRequestOptions extends RequestOptionsPaginated<RiskScoreFields> {
defaultIndex: string[];
}

export type RiskScoreSortField = SortField<RiskScoreFields>;
Loading

0 comments on commit c0ceb06

Please sign in to comment.