[Security Solution][Detection Rules] Adds a catch-all display tag for Mitre descriptions (#87240) (#87426)

This commit is contained in:
Davis Plumlee 2021-01-06 00:35:23 -07:00 committed by GitHub
parent 41aab669bc
commit 00ccdac8f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 6 deletions

View file

@ -212,7 +212,9 @@ describe('helpers', () => {
});
const wrapper = shallow<React.ReactElement>(result[0].description as React.ReactElement);
expect(result[0].title).toEqual('Mitre Attack');
expect(wrapper.find('[data-test-subj="threatTacticLink"]').text()).toEqual('');
expect(wrapper.find('[data-test-subj="threatTacticLink"]').text()).toEqual(
'Collection (TA000999)'
);
expect(wrapper.find('[data-test-subj="threatTechniqueLink"]').text()).toEqual(
'Audio Capture (T1123)'
);
@ -234,7 +236,9 @@ describe('helpers', () => {
expect(wrapper.find('[data-test-subj="threatTacticLink"]').text()).toEqual(
'Collection (TA0009)'
);
expect(wrapper.find('[data-test-subj="threatTechniqueLink"]').text()).toEqual('');
expect(wrapper.find('[data-test-subj="threatTechniqueLink"]').text()).toEqual(
'Audio Capture (T1123456)'
);
});
test('returns empty technique link if no corresponding subtechnique id found', () => {
@ -265,7 +269,9 @@ describe('helpers', () => {
expect(wrapper.find('[data-test-subj="threatTechniqueLink"]').text()).toEqual(
'Audio Capture (T1123)'
);
expect(wrapper.find('[data-test-subj="threatSubtechniqueLink"]').text()).toEqual('');
expect(wrapper.find('[data-test-subj="threatSubtechniqueLink"]').text()).toEqual(
'Audio Capture Data (T1123.000123)'
);
});
test('returns with corresponding tactic, technique, and subtechnique link text', () => {

View file

@ -151,7 +151,9 @@ export const buildThreatDescription = ({ label, threat }: BuildThreatDescription
href={singleThreat.tactic.reference}
target="_blank"
>
{tactic != null ? tactic.text : ''}
{tactic != null
? tactic.text
: `${singleThreat.tactic.name} (${singleThreat.tactic.id})`}
</EuiLink>
<EuiFlexGroup gutterSize="none" alignItems="flexStart" direction="column">
{singleThreat.technique.map((technique, techniqueIndex) => {
@ -165,7 +167,9 @@ export const buildThreatDescription = ({ label, threat }: BuildThreatDescription
iconType={ListTreeIcon}
size="xs"
>
{myTechnique != null ? myTechnique.label : ''}
{myTechnique != null
? myTechnique.label
: `${technique.name} (${technique.id})`}
</TechniqueLinkItem>
<EuiFlexGroup gutterSize="none" alignItems="flexStart" direction="column">
{technique.subtechnique != null &&
@ -184,7 +188,9 @@ export const buildThreatDescription = ({ label, threat }: BuildThreatDescription
iconType={ListTreeIcon}
size="xs"
>
{mySubtechnique != null ? mySubtechnique.label : ''}
{mySubtechnique != null
? mySubtechnique.label
: `${subtechnique.name} (${subtechnique.id})`}
</TechniqueLinkItem>
</SubtechniqueFlexItem>
);