diff --git a/x-pack/plugins/security_solution/common/endpoint/models/event.ts b/x-pack/plugins/security_solution/common/endpoint/models/event.ts index 00eb48bb62a5f..3e39ed6eb7a69 100644 --- a/x-pack/plugins/security_solution/common/endpoint/models/event.ts +++ b/x-pack/plugins/security_solution/common/endpoint/models/event.ts @@ -104,6 +104,9 @@ export function timestampAsDateSafeVersion(event: TimestampFields): Date | undef } } +/** + * The @timestamp ECS field + */ export function eventTimestamp(event: SafeResolverEvent): string | undefined | number { return firstNonNullValue(event['@timestamp']); } @@ -213,12 +216,18 @@ export function eventSequence(event: EventSequenceFields): number | undefined { return firstNonNullValue(event.event?.sequence); } +/** + * The event.id ECS field. + */ export function eventIDSafeVersion(event: SafeResolverEvent): number | undefined | string { return firstNonNullValue( isLegacyEventSafeVersion(event) ? event.endgame?.serial_event_id : event.event?.id ); } +/** + * The event.entity_id field. + */ export function entityId(event: ResolverEvent): string { if (isLegacyEvent(event)) { return event.endgame.unique_pid ? String(event.endgame.unique_pid) : ''; @@ -258,6 +267,9 @@ export function entityIDSafeVersion(event: EntityIDFields): string | undefined { } } +/** + * The process.parent.entity_id ECS field. + */ export function parentEntityId(event: ResolverEvent): string | undefined { if (isLegacyEvent(event)) { return event.endgame.unique_ppid ? String(event.endgame.unique_ppid) : undefined; diff --git a/x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts b/x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts index fe7e8b5f22f1c..c7829fa8a69b3 100644 --- a/x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts +++ b/x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts @@ -274,7 +274,7 @@ export const relatedEventCountByType: ( const stats = statsMap(nodeID); if (stats) { const value = Object.prototype.hasOwnProperty.call(stats.events.byCategory, eventType); - if (typeof value === 'number') { + if (typeof value === 'number' && Number.isFinite(value)) { return value; } } diff --git a/x-pack/plugins/security_solution/public/resolver/view/panels/styles.tsx b/x-pack/plugins/security_solution/public/resolver/view/panels/styles.tsx index 09a25ac125a2a..03826dd38397b 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/panels/styles.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/panels/styles.tsx @@ -11,20 +11,32 @@ import { EuiBreadcrumbs } from '@elastic/eui'; import styled from 'styled-components'; import { EuiDescriptionList } from '@elastic/eui'; +/** + * Used by the nodeDetail view to show attributes of the related events. + */ export const StyledDescriptionList = styled(EuiDescriptionList)` &.euiDescriptionList.euiDescriptionList--column dt.euiDescriptionList__title.desc-title { max-width: 10em; } `; +/** + * Used by the nodeDetail view for the label of the node. + */ export const StyledTitle = styled('h4')` overflow-wrap: break-word; `; +/** + * Used for a 'BETA' badge in the breadcrumbs of each panel. + */ export const BetaHeader = styled(`header`)` margin-bottom: 1em; `; +/** + * Styled version of EuiBreadcrumbs that is used by the breadcrumbs in each panel. + */ export const ThemedBreadcrumbs = styled(EuiBreadcrumbs)<{ background: string; text: string }>` &.euiBreadcrumbs { background-color: ${(props) => props.background}; @@ -38,20 +50,32 @@ export const ThemedBreadcrumbs = styled(EuiBreadcrumbs)<{ background: string; te } `; +/** + * Used in the links to nodes on the node list panel. + */ export const StyledButtonTextContainer = styled.div` align-items: center; display: flex; flex-direction: row; `; +/** + * Used in the node list panel to call out the event that is represented by the databaseDocumentID. + */ export const StyledAnalyzedEvent = styled.div` color: ${(props) => props.color}; font-size: 10.5px; font-weight: 700; `; +/** + * Used to style the node name in the node list panel view. + */ export const StyledLabelTitle = styled.div``; +/** + * Used by the node list view. Wraps the title of the node and the 'Analyzed event' marker. + */ export const StyledLabelContainer = styled.div` display: inline-block; flex: 3;