-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution][RAC][Cypress] Unskip some tests #117596
Changes from 19 commits
9c5c4cf
4502afa
ea9ffc9
847ee6a
7f4f2cd
4208753
39b682d
e7598b0
9102699
caa573e
accc297
80f1353
7f17b0c
a9aaaad
025e2c6
eb65f8a
6239eea
896621d
a42166a
740111c
38b1b52
afb25e9
2c1a31c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
*/ | ||
|
||
import { EuiSpacer, EuiHorizontalRule, EuiTitle, EuiText } from '@elastic/eui'; | ||
import { ALERT_RULE_UUID } from '@kbn/rule-data-utils'; | ||
|
||
import React, { useMemo } from 'react'; | ||
import styled from 'styled-components'; | ||
|
@@ -25,7 +26,7 @@ const InvestigationGuideViewComponent: React.FC<{ | |
data: TimelineEventsDetailsItem[]; | ||
}> = ({ data }) => { | ||
const ruleId = useMemo(() => { | ||
const item = data.find((d) => d.field === 'signal.rule.id'); | ||
const item = data.find((d) => d.field === 'signal.rule.id' || d.field === ALERT_RULE_UUID); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we have an |
||
return Array.isArray(item?.originalValue) | ||
? item?.originalValue[0] | ||
: item?.originalValue ?? null; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ | |
*/ | ||
|
||
import { EuiTextColor, EuiFlexItem, EuiSpacer, EuiHorizontalRule, EuiTitle } from '@elastic/eui'; | ||
import { ALERT_REASON, ALERT_RULE_UUID } from '@kbn/rule-data-utils'; | ||
|
||
import React, { useMemo } from 'react'; | ||
|
||
import styled from 'styled-components'; | ||
|
@@ -33,15 +35,20 @@ export const ReasonComponent: React.FC<Props> = ({ eventId, data }) => { | |
const { navigateToApp } = useKibana().services.application; | ||
const { formatUrl } = useFormatUrl(SecurityPageName.rules); | ||
|
||
const reason = useMemo( | ||
() => getFieldValue({ category: 'signal', field: 'signal.reason' }, data), | ||
[data] | ||
); | ||
const reason = useMemo(() => { | ||
const siemSignalsReason = getFieldValue( | ||
{ category: 'signal', field: 'signal.alert.reason' }, | ||
data | ||
); | ||
const aadReason = getFieldValue({ category: 'kibana', field: ALERT_REASON }, data); | ||
return aadReason.length > 0 ? aadReason : siemSignalsReason; | ||
}, [data]); | ||
|
||
const ruleId = useMemo( | ||
() => getFieldValue({ category: 'signal', field: 'signal.rule.id' }, data), | ||
[data] | ||
); | ||
const ruleId = useMemo(() => { | ||
const siemSignalsRuleId = getFieldValue({ category: 'signal', field: 'signal.rule.id' }, data); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so rules continue to have |
||
const aadRuleId = getFieldValue({ category: 'kibana', field: ALERT_RULE_UUID }, data); | ||
return aadRuleId.length > 0 ? aadRuleId : siemSignalsRuleId; | ||
}, [data]); | ||
|
||
if (!eventId) { | ||
return <EuiTextColor color="subdued">{EVENT_DETAILS_PLACEHOLDER}</EuiTextColor>; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,18 @@ export const getFieldValues = ( | |
}, | ||
data: TimelineEventsDetailsItem[] | null | ||
) => { | ||
return find({ category, field }, data)?.values; | ||
const categoryCompat = | ||
category === 'signal' ? 'kibana' : category === 'kibana' ? 'signal' : category; | ||
const fieldCompat = | ||
category === 'signal' | ||
? field.replace('signal', 'kibana.alert').replace('rule.id', 'rule.uuid') | ||
: category === 'kibana' | ||
? field.replace('kibana.alert', 'signal').replace('rule.uuid', 'rule.id') | ||
: field; | ||
return ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's coming together now. We keep both versions and search for each if we can't find one or the other. very interesting |
||
find({ category, field }, data)?.values ?? | ||
find({ category: categoryCompat, field: fieldCompat }, data)?.values | ||
); | ||
}; | ||
|
||
export const getFieldValue = ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,12 @@ import moment from 'moment'; | |
import React from 'react'; | ||
|
||
import { EuiDataGridCellValueElementProps, EuiLink } from '@elastic/eui'; | ||
import { ALERT_DURATION, ALERT_STATUS } from '@kbn/rule-data-utils/technical_field_names'; | ||
import { | ||
ALERT_DURATION, | ||
ALERT_REASON, | ||
ALERT_RULE_SEVERITY, | ||
ALERT_STATUS, | ||
} from '@kbn/rule-data-utils/technical_field_names'; | ||
|
||
import { TruncatableText } from '../../../../common/components/truncatable_text'; | ||
import { Severity } from '../../../components/severity'; | ||
|
@@ -53,9 +58,12 @@ export const RenderCellValue: React.FC<EuiDataGridCellValueElementProps & CellVa | |
<Status data-test-subj="alert-status" status={random(0, 1) ? 'recovered' : 'active'} /> | ||
); | ||
case ALERT_DURATION: | ||
case 'signal.duration.us': | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it would be nice if the older versions were consts as well |
||
return <span data-test-subj="alert-duration">{moment().fromNow(true)}</span>; | ||
case ALERT_RULE_SEVERITY: | ||
case 'signal.rule.severity': | ||
return <Severity data-test-subj="rule-severity" severity={value} />; | ||
case ALERT_REASON: | ||
case 'signal.reason': | ||
return ( | ||
<EuiLink data-test-subj="reason"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a particular reason we are removing the riskScore checks