Skip to content
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] [Cases] Swimlane Connector for Cases #100086

Merged
merged 119 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from 101 commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
85fe84e
Adding swimlane connector
joshswimlane Jan 4, 2021
cf2eb78
Merge branch 'master' of github.com:elastic/kibana into field_mapping…
XavierM Mar 22, 2021
3bb04dc
clean up + rm rejectUnauthorized
XavierM Mar 22, 2021
badc8f3
Merge 3bb04dc0aac098e591937592287a411de66a19fb into 639f8290ffcb28560…
XavierM Apr 28, 2021
b76f426
Merge branch 'master' of github.com:elastic/kibana into field_mapping…
XavierM Apr 29, 2021
d243b0e
Merge b76f426a86cca6bd74f45363f8858d930715158e into d111c27808e16f961…
XavierM Apr 29, 2021
9a2f02e
Merge branch 'field_mapping_connector_2' into field_mapping_connector
stephmilovic Apr 29, 2021
9c7ce14
wip
stephmilovic May 3, 2021
440fa5e
better types
stephmilovic May 3, 2021
9d9662f
cases maps
stephmilovic May 3, 2021
fa1f749
fix types
stephmilovic May 3, 2021
796712c
working on fields
stephmilovic May 4, 2021
377fd0a
can push case to swimlane
stephmilovic May 5, 2021
9384d9f
Merge branch 'master' into field_mapping_connector
stephmilovic May 12, 2021
6e699b3
working well
stephmilovic May 13, 2021
1acf2fa
fixed jest
stephmilovic May 13, 2021
19a2da7
fixing
stephmilovic May 13, 2021
e92dd16
made connector better
stephmilovic May 13, 2021
9595350
fix and add func tests
stephmilovic May 14, 2021
45be23a
Merge branch 'master' into field_mapping_connector
stephmilovic May 17, 2021
1bab00d
jsx
stephmilovic May 17, 2021
b527f54
schema fix
stephmilovic May 17, 2021
617328f
fix type in test
stephmilovic May 18, 2021
2f23cb4
Minor improvements
cnasikas May 19, 2021
b3e2ff6
Adding swimlane docs
jonathan-buttner May 19, 2021
410036e
Improve type
cnasikas May 24, 2021
060531a
Fix case connector schema
cnasikas May 24, 2021
dcaab5b
Move getApplicatio to the backend
cnasikas May 24, 2021
439ecff
Prevent prototype polution from fields
cnasikas May 24, 2021
a4f27d1
Add tests
cnasikas May 24, 2021
34dee16
Revert commit dcaab5b0f5f
cnasikas May 24, 2021
32d76d7
Fixing logout issue
jonathan-buttner May 24, 2021
a180758
Merge branch 'master' into field_mapping_connector
kibanamachine May 25, 2021
b51be9f
Minor improvements
cnasikas May 25, 2021
a532b41
Merge branch 'field_mapping_connector' of github.com:stephmilovic/kib…
cnasikas May 25, 2021
abba08c
Prevent prototype polution from fields
cnasikas May 26, 2021
e15c83c
Add description field
cnasikas May 26, 2021
97892b2
Make alert name optional
cnasikas May 26, 2021
aff1000
Change case mapping
cnasikas May 26, 2021
15e442f
Remove cases fields UI
cnasikas May 26, 2021
2a3ccf2
Delete comments from incident
cnasikas May 26, 2021
4cd8a46
Clear fields if needed
cnasikas May 27, 2021
9c28c13
Change reset to configure API
cnasikas May 27, 2021
dd1a32d
Improve components
cnasikas May 27, 2021
671b968
Merge branch 'master' into field_mapping_connector
kibanamachine May 27, 2021
d64875e
Lazy load svg icon
cnasikas May 27, 2021
bf6bdb6
Improve step status
cnasikas May 27, 2021
5f03f75
Fix params, api, & schema
cnasikas May 27, 2021
ba8c671
Create connector types
cnasikas May 31, 2021
851c880
Small fixes
cnasikas Jun 1, 2021
bf1f493
Show warning when mapping is empty
cnasikas Jun 1, 2021
ee23c03
Remove case name from fields
cnasikas Jun 1, 2021
9790343
Show connector card
cnasikas Jun 1, 2021
a2efccf
Remove unecessary code
cnasikas Jun 1, 2021
ef4f3b9
Show warning message when connector is not of type cases
cnasikas Jun 1, 2021
f28e4f5
Show warning message when connector is not of type alerts
cnasikas Jun 1, 2021
1a68b0e
Remove optional from target mapping field
cnasikas Jun 1, 2021
79c8bfd
Fix types
cnasikas Jun 1, 2021
e33403f
Improve order
cnasikas Jun 1, 2021
a237cb0
Fix tests
cnasikas Jun 1, 2021
2c39f9b
Merge branch 'master' into field_mapping_connector
kibanamachine Jun 1, 2021
fbbd762
Improve responses
cnasikas Jun 1, 2021
2c72b6d
Small fixes
cnasikas Jun 2, 2021
e9f5a57
Fix integration tests
cnasikas Jun 2, 2021
b8f2c0d
Update readme
cnasikas Jun 2, 2021
f7b8871
Switch to button group
cnasikas Jun 2, 2021
bd062c2
Better translation for required fields
cnasikas Jun 2, 2021
835f62b
Change buttons width
cnasikas Jun 2, 2021
68fc3ef
Compress buttons
cnasikas Jun 2, 2021
cc7d41f
Make case id required
cnasikas Jun 3, 2021
bc9ac93
Rename to rule name
cnasikas Jun 3, 2021
26d3523
Fix translation
cnasikas Jun 3, 2021
ed87bc4
Add alert id field
cnasikas Jun 3, 2021
2ab916b
Reorder fields
cnasikas Jun 3, 2021
d0d4f77
Fixes
cnasikas Jun 3, 2021
b283be8
Fix validation
cnasikas Jun 3, 2021
a83e7d5
Add alert id to params
cnasikas Jun 3, 2021
5edc02d
Show mapping if any of the required fields is missing
cnasikas Jun 3, 2021
e21eb4e
Add tests
cnasikas Jun 7, 2021
9f1ff56
Merge branch 'master' into field_mapping_connector
cnasikas Jun 7, 2021
0b7eeb6
Fix creation of default mapping
cnasikas Jun 7, 2021
1a98afc
Merge branch 'master' into field_mapping_connector
cnasikas Jun 9, 2021
6d29a7b
Hide alert id and alert name
cnasikas Jun 9, 2021
34e08da
Async validation
cnasikas Jun 9, 2021
d51a24f
Improve field step status
cnasikas Jun 9, 2021
63a5bb5
Fix tests
cnasikas Jun 9, 2021
4b8e2bb
Switch to http server
cnasikas Jun 9, 2021
89633e0
Merge branch 'master' into field_mapping_connector
cnasikas Jun 10, 2021
110baf2
Merge branch 'master' into field_mapping_connector
cnasikas Jun 10, 2021
3eb39e9
Switch to new mapping
cnasikas Jun 10, 2021
36aa3b8
Improve callout message
cnasikas Jun 15, 2021
f4771de
Add help text to alert source
cnasikas Jun 15, 2021
762c095
Improve helpers
cnasikas Jun 15, 2021
a8b9462
Improve tests
cnasikas Jun 15, 2021
cc5b10a
Improve messages
cnasikas Jun 15, 2021
aa79a78
Fix bug when using connector of type all
cnasikas Jun 16, 2021
2e3aa1c
Fix bug when creating connector
cnasikas Jun 16, 2021
f33ec56
Merge branch 'master' into field_mapping_connector
cnasikas Jun 16, 2021
18c37d7
Add cases_fields tests
cnasikas Jun 16, 2021
57ac290
Improve docs
cnasikas Jun 16, 2021
0e91329
Fix docs
cnasikas Jun 17, 2021
d3677d1
Remove alert source
cnasikas Jun 17, 2021
17ffdd5
Add more tests
cnasikas Jun 18, 2021
ab0fa38
Fix tests
cnasikas Jun 18, 2021
ae4a85d
Improve error message
cnasikas Jun 18, 2021
f110d0c
Merge branch 'master' into field_mapping_connector
cnasikas Jun 18, 2021
cf9a26e
Merge branch 'master' into field_mapping_connector
kibanamachine Jun 18, 2021
fc46dcf
Merge branch 'master' into field_mapping_connector
kibanamachine Jun 21, 2021
223b334
Close server after the end of tests
cnasikas Jun 22, 2021
2672be7
Add status code to error messages
cnasikas Jun 22, 2021
6f6ba26
PR feedback
cnasikas Jun 22, 2021
ae9b807
Merge branch 'field_mapping_connector' of github.com:stephmilovic/kib…
cnasikas Jun 22, 2021
c048432
Merge branch 'master' of github.com:elastic/kibana into field_mapping…
jonathan-buttner Jun 22, 2021
c129d22
Fix readme
cnasikas Jun 23, 2021
3d7d894
Add more tests for helpers
cnasikas Jun 23, 2021
72f6202
PR feedback
cnasikas Jun 23, 2021
cf6f927
Hide error message with css
cnasikas Jun 23, 2021
e16a51d
Merge branch 'field_mapping_connector' of github.com:stephmilovic/kib…
cnasikas Jun 23, 2021
2bf467a
Merge branch 'master' into field_mapping_connector
kibanamachine Jun 23, 2021
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
4 changes: 4 additions & 0 deletions docs/management/action-types.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ a| <<slack-action-type, Slack>>

| Send a message to a Slack channel or user.

a| <<swimlane-action-type, Swimlane>>

| Create an incident in Swimlane.

a| <<webhook-action-type, Webhook>>

| Send a request to a web service.
Expand Down
111 changes: 111 additions & 0 deletions docs/management/connectors/action-types/swimlane.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
[role="xpack"]
[[swimlane-action-type]]
=== Swimlane connector and action
++++
<titleabbrev>Swimlane</titleabbrev>
++++

The Swimlane connector uses the https://swimlane.com/knowledge-center/docs/developer-guide/rest-api/[Swimlane REST API] to create Swimlane records.

[float]
[[swimlane-connector-configuration]]
==== Connector configuration

Swimlane connectors have the following configuration properties.

Name:: The name of the connector. The name is used to identify a connector in the **Stack Management** UI connector listing, and in the connector list when configuring an action.
URL:: Swimlane instance URL.
Application ID:: Swimlane application ID.
API token:: Swimlane API authentication token for HTTP Basic authentication.

[float]
[[Preconfigured-swimlane-configuration]]
==== Preconfigured connector type

[source,text]
--
my-swimlane:
name: preconfigured-swimlane-connector-type
actionTypeId: .swimlane
config:
apiUrl: https://elastic.swimlaneurl.us
appId: app-id
mappings:
alertIdConfig:
fieldType: text
id: agp4s
key: alert-id
name: Alert ID
alertSourceConfig:
fieldType: text
id: adnls
key: alert-source
name: Alert Source
caseIdConfig:
fieldType: text
id: ae1mi
key: case-id
name: Case ID
caseNameConfig:
fieldType: text
id: anxnr
key: case-name
name: Case Name
commentsConfig:
fieldType: comments
id: au18d
key: comments
name: Comments
descriptionConfig:
fieldType: text
id: ae1gd
key: description
name: Description
ruleNameConfig:
fieldType: text
id: avfsl
key: rule-name
name: Rule Name
severityConfig:
fieldType: text
id: a71ik
key: severity
name: severity
secrets:
apiToken: tokenkeystorevalue
--

Config defines information for the connector type.

`apiUrl`:: An address that corresponds to *URL*.
`appId`:: A key that corresponds to *Application ID*.

Secrets defines sensitive information for the connector type.

`apiToken`:: A string that corresponds to *API Token*. Should be stored in the <<creating-keystore, {kib} keystore>>.

[float]
[[define-swimlane-ui]]
==== Define connector in Stack Management

Define Swimlane connector properties.

[role="screenshot"]
image::management/connectors/images/swimlane-connector.png[Swimlane connector]

Test Swimlane action parameters.

[role="screenshot"]
image::management/connectors/images/swimlane-params-test.png[Swimlane params test]

[float]
[[swimlane-action-configuration]]
==== Action configuration

Swimlane actions have the following configuration properties.

Alert Source:: The alert source of the incident.
Comments:: Additional information for the client, such as how to troubleshoot the issue.
Severity:: The severity of the incident.

NOTE: Alert ID and Rule Name are filled automatically. Specifically, Alert ID is set to `{{alert.id}}` and Rule Name to `{{rule.name}}`.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/management/connectors/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ include::action-types/teams.asciidoc[]
include::action-types/pagerduty.asciidoc[]
include::action-types/server-log.asciidoc[]
include::action-types/servicenow.asciidoc[]
include::action-types/swimlane.asciidoc[]
include::action-types/slack.asciidoc[]
include::action-types/webhook.asciidoc[]
include::pre-configured-connectors.asciidoc[]
145 changes: 89 additions & 56 deletions x-pack/plugins/actions/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const ACTION_TYPE_IDS = [
'.pagerduty',
'.server-log',
'.slack',
'.swimlane',
'.teams',
'.webhook',
];
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/actions/server/builtin_action_types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Logger } from '../../../../../src/core/server';
import { getActionType as getEmailActionType } from './email';
import { getActionType as getIndexActionType } from './es_index';
import { getActionType as getPagerDutyActionType } from './pagerduty';
import { getActionType as getSwimlaneActionType } from './swimlane';
import { getActionType as getServerLogActionType } from './server_log';
import { getActionType as getSlackActionType } from './slack';
import { getActionType as getWebhookActionType } from './webhook';
Expand Down Expand Up @@ -65,6 +66,7 @@ export function registerBuiltInActionTypes({
);
actionTypeRegistry.register(getIndexActionType({ logger }));
actionTypeRegistry.register(getPagerDutyActionType({ logger, configurationUtilities }));
actionTypeRegistry.register(getSwimlaneActionType({ logger, configurationUtilities }));
actionTypeRegistry.register(getServerLogActionType({ logger }));
actionTypeRegistry.register(getSlackActionType({ logger, configurationUtilities }));
actionTypeRegistry.register(getWebhookActionType({ logger, configurationUtilities }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
JiraSecretConfigurationType,
JiraExecutorResultData,
ExecutorSubActionGetFieldsByIssueTypeParams,
ExecutorSubActionGetIssueTypesParams,
ExecutorSubActionCommonFieldsParams,
ExecutorSubActionGetIssuesParams,
ExecutorSubActionGetIssueParams,
ExecutorSubActionGetIncidentParams,
Expand Down Expand Up @@ -137,7 +137,7 @@ async function executor(
}

if (subAction === 'issueTypes') {
const getIssueTypesParams = subActionParams as ExecutorSubActionGetIssueTypesParams;
const getIssueTypesParams = subActionParams as ExecutorSubActionCommonFieldsParams;
data = await api.issueTypes({
externalService,
params: getIssueTypesParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ export const ExternalIncidentServiceSecretConfigurationSchema = schema.object(
ExternalIncidentServiceSecretConfiguration
);

export const ExecutorSubActionSchema = schema.oneOf([
cnasikas marked this conversation as resolved.
Show resolved Hide resolved
schema.literal('getIncident'),
schema.literal('pushToService'),
schema.literal('handshake'),
schema.literal('issueTypes'),
schema.literal('fieldsByIssueType'),
]);

export const ExecutorSubActionPushParamsSchema = schema.object({
incident: schema.object({
summary: schema.string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,25 +155,25 @@ describe('Jira service', () => {
).toThrow();
});

test('throws without username', () => {
test('throws without email/username', () => {
expect(() =>
createExternalService(
{
config: { apiUrl: 'test.com' },
secrets: { apiToken: '', email: 'elastic@elastic.com' },
config: { apiUrl: 'test.com', projectKey: 'CK' },
secrets: { apiToken: 'token' },
},
logger,
configurationUtilities
)
).toThrow();
});

test('throws without password', () => {
test('throws without apiToken/password', () => {
expect(() =>
createExternalService(
{
config: { apiUrl: 'test.com' },
secrets: { apiToken: '', email: undefined },
config: { apiUrl: 'test.com', projectKey: 'CK' },
secrets: { email: 'elastic@elastic.com' },
},
logger,
configurationUtilities
Expand Down
10 changes: 5 additions & 5 deletions x-pack/plugins/actions/server/builtin_action_types/jira/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import {
ExecutorSubActionGetIncidentParamsSchema,
ExecutorSubActionHandshakeParamsSchema,
ExecutorSubActionGetCapabilitiesParamsSchema,
ExecutorSubActionGetIssueTypesParamsSchema,
ExecutorSubActionGetFieldsByIssueTypeParamsSchema,
ExecutorSubActionGetIssuesParamsSchema,
ExecutorSubActionGetIssueParamsSchema,
ExecutorSubActionCommonFieldsParamsSchema,
} from './schema';
import { ActionsConfigurationUtilities } from '../../actions_config';
import { Logger } from '../../../../../../src/core/server';
Expand Down Expand Up @@ -124,8 +124,8 @@ export type ExecutorSubActionGetCapabilitiesParams = TypeOf<
typeof ExecutorSubActionGetCapabilitiesParamsSchema
>;

export type ExecutorSubActionGetIssueTypesParams = TypeOf<
typeof ExecutorSubActionGetIssueTypesParamsSchema
export type ExecutorSubActionCommonFieldsParams = TypeOf<
typeof ExecutorSubActionCommonFieldsParamsSchema
>;

export type ExecutorSubActionGetFieldsByIssueTypeParams = TypeOf<
Expand Down Expand Up @@ -157,12 +157,12 @@ export interface HandshakeApiHandlerArgs extends ExternalServiceApiHandlerArgs {

export interface GetIssueTypesHandlerArgs {
externalService: ExternalService;
params: ExecutorSubActionGetIssueTypesParams;
params: ExecutorSubActionCommonFieldsParams;
}

export interface GetCommonFieldsHandlerArgs {
externalService: ExternalService;
params: ExecutorSubActionGetIssueTypesParams;
params: ExecutorSubActionCommonFieldsParams;
}

export interface GetFieldsByIssueTypeHandlerArgs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ export const ExternalIncidentServiceSecretConfigurationSchema = schema.object(
ExternalIncidentServiceSecretConfiguration
);

export const ExecutorSubActionSchema = schema.oneOf([
cnasikas marked this conversation as resolved.
Show resolved Hide resolved
schema.literal('getIncident'),
schema.literal('pushToService'),
schema.literal('handshake'),
schema.literal('incidentTypes'),
schema.literal('severity'),
]);

export const ExecutorSubActionPushParamsSchema = schema.object({
incident: schema.object({
name: schema.string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ export const ExternalIncidentServiceSecretConfigurationSchema = schema.object(
ExternalIncidentServiceSecretConfiguration
);

export const ExecutorSubActionSchema = schema.oneOf([
cnasikas marked this conversation as resolved.
Show resolved Hide resolved
schema.literal('getFields'),
schema.literal('getIncident'),
schema.literal('pushToService'),
schema.literal('handshake'),
schema.literal('getChoices'),
]);

const CommentsSchema = schema.nullable(
schema.arrayOf(
schema.object({
Expand Down
Loading