Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
103b558
Implement functionality to add observables, procedures and custom fie…
brijesh-elastic Jan 20, 2025
c8c0320
Resolve build issue
brijesh-elastic Jan 21, 2025
ed9ac93
Update a condition in JsonEditorWithMessageVariables component
brijesh-elastic Jan 22, 2025
3623b98
Resolve comments
brijesh-elastic Jan 29, 2025
a9c28c0
Merge branch 'main' into thehive_enhancement
brijesh-elastic Jan 29, 2025
513d311
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Jan 29, 2025
e878171
Fix editor update issue
brijesh-elastic Jan 30, 2025
1e94748
Update the UI
brijesh-elastic Feb 12, 2025
14b0dc1
Resolve linting issue
brijesh-elastic Feb 13, 2025
4832676
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Feb 13, 2025
83993bf
Update snapshot file and documentation
brijesh-elastic Feb 18, 2025
28cc5a9
Merge branch 'main' into thehive_enhancement
brijesh-elastic Feb 18, 2025
4bcdbd9
fix unit test
brijesh-elastic Feb 20, 2025
d1faab1
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Feb 20, 2025
1e7a78e
Merge branch 'main' into thehive_enhancement
brijesh-elastic Apr 23, 2025
a00c44e
Remove body component rendering to follow intermediate release process
brijesh-elastic May 13, 2025
b34547d
Merge branch 'main' into thehive_enhancement
brijesh-elastic May 13, 2025
409a964
address pr comment
brijesh-elastic Jun 2, 2025
be144f2
Merge branch 'main' into thehive_enhancement
brijesh-elastic Jun 2, 2025
4d8dcbe
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Jun 2, 2025
d394209
Merge branch 'main' into thehive_enhancement
elasticmachine Jun 5, 2025
5eac0f5
address pr comment
brijesh-elastic Jun 16, 2025
2c84bbe
Merge branch 'main' into thehive_enhancement
brijesh-elastic Jun 16, 2025
c1b88de
update snapshot
brijesh-elastic Jun 17, 2025
6c7cc74
Merge branch 'main' into thehive_enhancement
brijesh-elastic Jun 17, 2025
eae25b0
address pr comments
brijesh-elastic Jun 18, 2025
4d664bd
Merge branch 'main' into thehive_enhancement
brijesh-elastic Jun 18, 2025
80644a2
remove isRuleSeverity reference
brijesh-elastic Jun 19, 2025
46492e6
hide severity toggle
brijesh-elastic Jun 19, 2025
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
25 changes: 25 additions & 0 deletions docs/reference/connectors-kibana/thehive-action-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ Description
Severity
: The severity of the incident: `LOW`, `MEDIUM`, `HIGH` or `CRITICAL`.

::::{note}
While creating an alert, use the Keep severity from rule toggle to create an alert with the rule's severity. If the rule does not have a defined severity, the alert will have the default MEDIUM severity.
::::

TLP
: The traffic light protocol designation for the incident: `CLEAR`, `GREEN`, `AMBER`, `AMBER+STRICT` or `RED`.

Expand All @@ -88,6 +92,27 @@ Source
Source reference
: A source reference for the alert.

Body
: A Json payload specifying additional parameter, such as observables and procedures. It can be populated using a predefined template or customized using the `Custom Template` option. For example:

```json
{
"observables": [
{
"dataType": "url",
"data": "http://example.org"
}
],
"procedures": [
{
"patternId": "TA0001",
"occurDate": 1640000000000,
"tactic": "tactic-name"
}
]
}
```

## Connector networking configuration [thehive-connector-networking-configuration]

Use the [Action configuration settings](/reference/configuration-reference/alerting-settings.md#action-settings) to customize connector networking configurations, such as proxies, certificates, or TLS settings. You can set configurations that apply to all your connectors or use `xpack.actions.customHostSettings` to set per-host configurations.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ export const ExecutorSubActionCreateAlertParamsSchema = schema.object({
source: schema.string(),
sourceRef: schema.string(),
severity: schema.nullable(schema.number({ defaultValue: TheHiveSeverity.MEDIUM })),
isRuleSeverity: schema.nullable(schema.boolean({ defaultValue: false })),
tlp: schema.nullable(schema.number({ defaultValue: TheHiveTLP.AMBER })),
tags: schema.nullable(schema.arrayOf(schema.string())),
body: schema.nullable(schema.string()),
});

export const ExecutorParamsSchema = schema.oneOf([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React from 'react';
import { fireEvent, render } from '@testing-library/react';
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public/types';
import TheHiveParamsFields from './params';
import { SUB_ACTION } from '../../../common/thehive/constants';
import { SUB_ACTION, TheHiveSeverity } from '../../../common/thehive/constants';
import { ExecutorParams, ExecutorSubActionPushParams } from '../../../common/thehive/types';

describe('TheHiveParamsFields renders', () => {
Expand Down Expand Up @@ -69,7 +69,7 @@ describe('TheHiveParamsFields renders', () => {
'subActionParams',
{
tlp: 2,
severity: 2,
severity: TheHiveSeverity.MEDIUM,
tags: [],
sourceRef: '{{alert.uuid}}',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, { useState, useEffect, useRef, useMemo } from 'react';
import { ActionParamsProps, ActionConnectorMode } from '@kbn/triggers-actions-ui-plugin/public';
import { EuiFormRow, EuiSelect } from '@elastic/eui';
import { eventActionOptions } from './constants';
import { SUB_ACTION } from '../../../common/thehive/constants';
import { SUB_ACTION, TheHiveSeverity } from '../../../common/thehive/constants';
import { ExecutorParams } from '../../../common/thehive/types';
import { TheHiveParamsAlertFields } from './params_alert';
import { TheHiveParamsCaseFields } from './params_case';
Expand Down Expand Up @@ -80,7 +80,7 @@ const TheHiveParamsFields: React.FunctionComponent<ActionParamsProps<ExecutorPar
eventActionType === SUB_ACTION.CREATE_ALERT
? {
tlp: 2,
severity: 2,
severity: TheHiveSeverity.MEDIUM,
tags: [],
sourceRef: isTest ? undefined : '{{alert.uuid}}',
}
Expand Down Expand Up @@ -123,6 +123,7 @@ const TheHiveParamsFields: React.FunctionComponent<ActionParamsProps<ExecutorPar
index={index}
errors={errors}
messageVariables={messageVariables}
executionMode={executionMode}
/>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ describe('TheHiveParamsFields renders', () => {
description: 'description test',
tlp: 2,
severity: 2,
isRuleSeverity: false,
tags: ['test1'],
source: 'source test',
type: 'sourceType test',
sourceRef: 'sourceRef test',
body: null,
};
const actionParams: ExecutorParams = {
subAction: SUB_ACTION.CREATE_ALERT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import {
TextFieldWithMessageVariables,
TextAreaWithMessageVariables,
ActionParamsProps,
JsonEditorWithMessageVariables,
ActionConnectorMode,
} from '@kbn/triggers-actions-ui-plugin/public';
import { EuiFormRow, EuiSelect, EuiComboBox } from '@elastic/eui';
import { EuiFormRow, EuiSelect, EuiComboBox, EuiSwitch } from '@elastic/eui';
import { ExecutorParams, ExecutorSubActionCreateAlertParams } from '../../../common/thehive/types';
import { severityOptions, tlpOptions } from './constants';
import * as translations from './translations';
Expand All @@ -22,6 +24,7 @@ export const TheHiveParamsAlertFields: React.FC<ActionParamsProps<ExecutorParams
index,
errors,
messageVariables,
executionMode,
}) => {
const alert = useMemo(
() =>
Expand All @@ -33,12 +36,14 @@ export const TheHiveParamsAlertFields: React.FC<ActionParamsProps<ExecutorParams
} as unknown as ExecutorSubActionCreateAlertParams),
[actionParams.subActionParams]
);
const isTest = executionMode === ActionConnectorMode.Test;

const [severity, setSeverity] = useState(alert.severity ?? severityOptions[1].value);
const [tlp, setTlp] = useState(alert.tlp ?? tlpOptions[2].value);
const [selectedOptions, setSelected] = useState<Array<{ label: string }>>(
alert.tags?.map((tag) => ({ label: tag })) ?? []
);
const [isRuleSeverity, setIsRuleSeverity] = useState<boolean>(Boolean(alert.isRuleSeverity));

const onCreateOption = (searchValue: string) => {
setSelected([...selectedOptions, { label: searchValue }]);
Expand Down Expand Up @@ -149,22 +154,46 @@ export const TheHiveParamsAlertFields: React.FC<ActionParamsProps<ExecutorParams
}}
errors={errors['createAlertParam.sourceRef'] as string[]}
/>
<EuiFormRow fullWidth label={translations.SEVERITY_LABEL}>
<EuiSelect
fullWidth
data-test-subj="severitySelectInput"
value={severity}
options={severityOptions}
onChange={(e) => {
editAction(
'subActionParams',
{ ...alert, severity: parseInt(e.target.value, 10) },
index
);
setSeverity(parseInt(e.target.value, 10));
}}
/>
</EuiFormRow>
{!isTest && Boolean(isRuleSeverity) && (
<EuiFormRow fullWidth>
<EuiSwitch
label={translations.IS_RULE_SEVERITY_LABEL}
checked={Boolean(isRuleSeverity)}
compressed={true}
data-test-subj="rule-severity-toggle"
onChange={(e) => {
setIsRuleSeverity(e.target.checked);
editAction(
'subActionParams',
{
...alert,
isRuleSeverity: e.target.checked,
},
index
);
}}
/>
</EuiFormRow>
)}
{!Boolean(isRuleSeverity) && (
<EuiFormRow fullWidth label={translations.SEVERITY_LABEL}>
<EuiSelect
fullWidth
data-test-subj="severitySelectInput"
disabled={isRuleSeverity}
value={severity}
options={severityOptions}
onChange={(e) => {
editAction(
'subActionParams',
{ ...alert, severity: parseInt(e.target.value, 10) },
index
);
setSeverity(parseInt(e.target.value, 10));
}}
/>
</EuiFormRow>
)}
<EuiFormRow fullWidth label={translations.TLP_LABEL}>
<EuiSelect
fullWidth
Expand All @@ -187,6 +216,26 @@ export const TheHiveParamsAlertFields: React.FC<ActionParamsProps<ExecutorParams
noSuggestions
/>
</EuiFormRow>
{alert.body != null && (
<JsonEditorWithMessageVariables
messageVariables={messageVariables}
paramsProperty={'body'}
inputTargetValue={alert.body}
label={translations.BODY_LABEL}
ariaLabel={translations.BODY_DESCRIPTION}
errors={errors.body as string[]}
onDocumentsChange={(json: string) =>
editAction('subActionParams', { ...alert, body: json }, index)
}
dataTestSubj="thehive-body"
onBlur={() => {
if (!alert.body) {
editAction('subActionParams', { ...alert, body: null }, index);
}
}}
isOptionalField
/>
)}
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,19 @@ describe('thehive createAlert action params validation', () => {
type: 'type test',
source: 'source test',
sourceRef: 'source reference test',
body: JSON.stringify(
{
observables: [
{
dataType: 'ip',
data: '127.0.0.1',
tags: ['source.ip'],
},
],
},
null,
2
),
},
comments: [],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ export const TLP_LABEL = i18n.translate(
}
);

export const IS_RULE_SEVERITY_LABEL = i18n.translate(
'xpack.stackConnectors.components.thehive.isRuleSeverityToggleLabel',
{
defaultMessage: 'Use severity assigned to the rule',
}
);

export const SEVERITY_LABEL = i18n.translate(
'xpack.stackConnectors.components.thehive.severitySelectFieldLabel',
{
Expand Down Expand Up @@ -102,6 +109,34 @@ export const SOURCE_REF_LABEL = i18n.translate(
}
);

export const TEMPLATE_LABEL = i18n.translate(
'xpack.stackConnectors.components.thehive.templateFieldLabel',
{
defaultMessage: 'Template',
}
);

export const BODY_LABEL = i18n.translate(
'xpack.stackConnectors.components.thehive.bodyFieldLabel',
{
defaultMessage: 'Body',
}
);

export const BODY_DESCRIPTION = i18n.translate(
'xpack.stackConnectors.components.thehive.bodyFieldDescription',
{
defaultMessage: 'Code Editor',
}
);

export const SELECT_BODY_TEMPLATE_POPOVER_BUTTON = i18n.translate(
'xpack.stackConnectors.components.thehive.selectBodyTemplatePopoverButton',
{
defaultMessage: 'Select body template',
}
);

export const TITLE_REQUIRED = i18n.translate(
'xpack.stackConnectors.components.thehive.requiredTitleText',
{
Expand Down
Loading
Loading