Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions x-pack/plugins/actions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,8 @@ The following table describes the properties of the `incident` object.
| severity | The name of the severity in ServiceNow. | string _(optional)_ |
| urgency | The name of the urgency in ServiceNow. | string _(optional)_ |
| impact | The name of the impact in ServiceNow. | string _(optional)_ |
| category | The name of the category in ServiceNow. | string _(optional)_ |
| subcategory | The name of the subcategory in ServiceNow. | string _(optional)_ |

#### `subActionParams (getFields)`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ describe('api', () => {
severity: '1',
urgency: '2',
impact: '3',
category: 'software',
subcategory: 'os',
caller_id: 'elastic',
description: 'Incident description',
short_description: 'Incident title',
Expand All @@ -111,6 +113,8 @@ describe('api', () => {
severity: '1',
urgency: '2',
impact: '3',
category: 'software',
subcategory: 'os',
comments: 'A comment',
description: 'Incident description',
short_description: 'Incident title',
Expand All @@ -123,6 +127,8 @@ describe('api', () => {
severity: '1',
urgency: '2',
impact: '3',
category: 'software',
subcategory: 'os',
comments: 'Another comment',
description: 'Incident description',
short_description: 'Incident title',
Expand All @@ -146,6 +152,8 @@ describe('api', () => {
severity: '1',
urgency: '2',
impact: '3',
category: 'software',
subcategory: 'os',
work_notes: 'A comment',
description: 'Incident description',
short_description: 'Incident title',
Expand All @@ -158,6 +166,8 @@ describe('api', () => {
severity: '1',
urgency: '2',
impact: '3',
category: 'software',
subcategory: 'os',
work_notes: 'Another comment',
description: 'Incident description',
short_description: 'Incident title',
Expand Down Expand Up @@ -229,6 +239,8 @@ describe('api', () => {
severity: '1',
urgency: '2',
impact: '3',
category: 'software',
subcategory: 'os',
description: 'Incident description',
short_description: 'Incident title',
},
Expand All @@ -251,6 +263,8 @@ describe('api', () => {
severity: '1',
urgency: '2',
impact: '3',
category: 'software',
subcategory: 'os',
description: 'Incident description',
short_description: 'Incident title',
},
Expand All @@ -262,6 +276,8 @@ describe('api', () => {
severity: '1',
urgency: '2',
impact: '3',
category: 'software',
subcategory: 'os',
comments: 'A comment',
description: 'Incident description',
short_description: 'Incident title',
Expand All @@ -285,6 +301,8 @@ describe('api', () => {
severity: '1',
urgency: '2',
impact: '3',
category: 'software',
subcategory: 'os',
description: 'Incident description',
short_description: 'Incident title',
},
Expand All @@ -296,6 +314,8 @@ describe('api', () => {
severity: '1',
urgency: '2',
impact: '3',
category: 'software',
subcategory: 'os',
work_notes: 'A comment',
description: 'Incident description',
short_description: 'Incident title',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ const executorParams: ExecutorSubActionPushParams = {
severity: '1',
urgency: '2',
impact: '3',
category: 'software',
subcategory: 'os',
},
comments: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ const CommonAttributes = {
short_description: schema.string(),
description: schema.nullable(schema.string()),
externalId: schema.nullable(schema.string()),
category: schema.nullable(schema.string()),
subcategory: schema.nullable(schema.string()),
};

// Schema for ServiceNow Incident Management (ITSM)
Expand All @@ -62,13 +64,11 @@ export const ExecutorSubActionPushParamsSchemaITSM = schema.object({
export const ExecutorSubActionPushParamsSchemaSIR = schema.object({
incident: schema.object({
...CommonAttributes,
category: schema.nullable(schema.string()),
dest_ip: schema.nullable(schema.string()),
malware_hash: schema.nullable(schema.string()),
malware_url: schema.nullable(schema.string()),
priority: schema.nullable(schema.string()),
source_ip: schema.nullable(schema.string()),
subcategory: schema.nullable(schema.string()),
priority: schema.nullable(schema.string()),
}),
comments: CommentsSchema,
});
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/case/common/api/connectors/jira.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import * as rt from 'io-ts';

// New fields should also be added at: x-pack/plugins/case/server/connectors/case/schema.ts
export const JiraFieldsRT = rt.type({
issueType: rt.union([rt.string, rt.null]),
priority: rt.union([rt.string, rt.null]),
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/case/common/api/connectors/resilient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import * as rt from 'io-ts';

// New fields should also be added at: x-pack/plugins/case/server/connectors/case/schema.ts
export const ResilientFieldsRT = rt.type({
incidentTypes: rt.union([rt.array(rt.string), rt.null]),
severityCode: rt.union([rt.string, rt.null]),
Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/case/common/api/connectors/servicenow_itsm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@

import * as rt from 'io-ts';

// New fields should also be added at: x-pack/plugins/case/server/connectors/case/schema.ts
export const ServiceNowITSMFieldsRT = rt.type({
impact: rt.union([rt.string, rt.null]),
severity: rt.union([rt.string, rt.null]),
urgency: rt.union([rt.string, rt.null]),
category: rt.union([rt.string, rt.null]),
subcategory: rt.union([rt.string, rt.null]),
});

export type ServiceNowITSMFieldsType = rt.TypeOf<typeof ServiceNowITSMFieldsRT>;
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import * as rt from 'io-ts';

// New fields should also be added at: x-pack/plugins/case/server/connectors/case/schema.ts
export const ServiceNowSIRFieldsRT = rt.type({
category: rt.union([rt.string, rt.null]),
destIp: rt.union([rt.boolean, rt.null]),
Expand Down
24 changes: 22 additions & 2 deletions x-pack/plugins/case/server/connectors/case/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ describe('case connector', () => {
impact: 'Medium',
severity: 'Medium',
urgency: 'Medium',
category: 'software',
subcategory: 'os',
},
},
settings: {
Expand Down Expand Up @@ -218,7 +220,13 @@ describe('case connector', () => {
id: 'servicenow',
name: 'Servicenow',
type: '.servicenow',
fields: { impact: null, severity: null, urgency: null },
fields: {
impact: null,
severity: null,
urgency: null,
category: null,
subcategory: null,
},
},
settings: {
syncAlerts: true,
Expand Down Expand Up @@ -293,6 +301,8 @@ describe('case connector', () => {
impact: 'Medium',
severity: 'Medium',
urgency: 'Medium',
category: 'software',
subcategory: 'os',
excess: null,
},
},
Expand Down Expand Up @@ -470,6 +480,8 @@ describe('case connector', () => {
impact: 'Medium',
severity: 'Medium',
urgency: 'Medium',
category: 'software',
subcategory: 'os',
},
},
},
Expand Down Expand Up @@ -517,7 +529,13 @@ describe('case connector', () => {
id: 'servicenow',
name: 'Servicenow',
type: '.servicenow',
fields: { impact: null, severity: null, urgency: null },
fields: {
impact: null,
severity: null,
urgency: null,
category: null,
subcategory: null,
},
},
},
});
Expand Down Expand Up @@ -590,6 +608,8 @@ describe('case connector', () => {
impact: 'Medium',
severity: 'Medium',
urgency: 'Medium',
category: 'software',
subcategory: 'os',
excess: null,
},
},
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/case/server/connectors/case/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ const ServiceNowFieldsSchema = schema.object({
impact: schema.nullable(schema.string()),
severity: schema.nullable(schema.string()),
urgency: schema.nullable(schema.string()),
category: schema.nullable(schema.string()),
subcategory: schema.nullable(schema.string()),
});

const NoneFieldsSchema = schema.nullable(schema.object({}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { ServiceNowITSMFieldsType, ConnectorServiceNowITSMTypeFields } from '../
import { ExternalServiceFormatter } from '../types';

const format: ExternalServiceFormatter<ServiceNowITSMFieldsType>['format'] = (theCase) => {
const { severity = null, urgency = null, impact = null } =
const { severity = null, urgency = null, impact = null, category = null, subcategory = null } =
(theCase.connector.fields as ConnectorServiceNowITSMTypeFields['fields']) ?? {};
return { severity, urgency, impact };
return { severity, urgency, impact, category, subcategory };
};

export const serviceNowITSMExternalServiceFormatter: ExternalServiceFormatter<ServiceNowITSMFieldsType> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import { serviceNowITSMExternalServiceFormatter } from './itsm_formatter';

describe('ITSM formatter', () => {
const theCase = {
connector: { fields: { severity: '2', urgency: '2', impact: '2' } },
connector: {
fields: { severity: '2', urgency: '2', impact: '2', category: 'software', subcategory: 'os' },
},
} as CaseResponse;

it('it formats correctly', async () => {
Expand All @@ -21,6 +23,12 @@ describe('ITSM formatter', () => {
it('it formats correctly when fields do not exist ', async () => {
const invalidFields = { connector: { fields: null } } as CaseResponse;
const res = await serviceNowITSMExternalServiceFormatter.format(invalidFields, []);
expect(res).toEqual({ severity: null, urgency: null, impact: null });
expect(res).toEqual({
severity: null,
urgency: null,
impact: null,
category: null,
subcategory: null,
});
});
});
12 changes: 12 additions & 0 deletions x-pack/plugins/security_solution/cypress/objects/case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@ export const executeResponses = {
value: 'inbound_ddos',
element: 'subcategory',
},
{
dependent_value: '',
label: 'Software',
value: 'software',
element: 'category',
},
{
dependent_value: 'software',
label: 'Operation System',
value: 'os',
element: 'subcategory',
},
...['severity', 'urgency', 'impact', 'priority']
.map((element) => [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ export const fillIbmResilientConnectorOptions = (
ibmResilientConnector.incidentTypes.forEach((incidentType) => {
cy.get(SELECT_INCIDENT_TYPE).type(`${incidentType}{enter}`, { force: true });
});
cy.get(CONNECTOR_RESILIENT).click();
cy.get(CONNECTOR_RESILIENT).click({ force: true });
cy.get(SELECT_SEVERITY).select(ibmResilientConnector.severity);
};
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ export const choices = [
value: 'inbound_ddos',
element: 'subcategory',
},
{
dependent_value: '',
label: 'Software',
value: 'software',
element: 'category',
},
{
dependent_value: 'software',
label: 'Operation System',
value: 'os',
element: 'subcategory',
},
...['severity', 'urgency', 'impact', 'priority']
.map((element) => [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* 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 { EuiSelectOption } from '@elastic/eui';
import { Choice } from './types';

export const choicesToEuiOptions = (choices: Choice[]): EuiSelectOption[] =>
choices.map((choice) => ({ value: choice.value, text: choice.label }));
Loading