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

[SIEM] [Detection Engine] Threat tactic can have multiple techniques #52200

Merged
merged 1 commit into from
Dec 4, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,15 @@ import { esFilters } from '../../../../../../../../src/plugins/data/server';

export type PartialFilter = Partial<esFilters.Filter>;

export interface IMitreAttack {
id: string;
name: string;
reference: string;
}
export interface ThreatParams {
framework: string;
tactic: {
id: string;
name: string;
reference: string;
};
technique: {
id: string;
name: string;
reference: string;
};
tactic: IMitreAttack;
techniques: IMitreAttack[];
}
export interface RuleAlertParams {
description: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const typicalPayload = (): Partial<Omit<RuleAlertParamsRest, 'filter'>> =
{
framework: 'fake',
tactic: { id: 'fakeId', name: 'fakeName', reference: 'fakeRef' },
technique: { id: 'techniqueId', name: 'techniqueName', reference: 'techniqueRef' },
techniques: [{ id: 'techniqueId', name: 'techniqueName', reference: 'techniqueRef' }],
},
],
});
Expand Down Expand Up @@ -154,11 +154,13 @@ export const getResult = (): RuleAlertType => ({
name: 'impact',
reference: 'https://attack.mitre.org/tactics/TA0040/',
},
technique: {
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
techniques: [
{
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
],
},
],
references: ['http://www.example.com', 'https://ww.example.com'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,13 @@ describe('schemas', () => {
name: 'fakeName',
reference: 'fakeRef',
},
technique: {
id: 'techniqueId',
name: 'techniqueName',
reference: 'techniqueRef',
},
techniques: [
{
id: 'techniqueId',
name: 'techniqueName',
reference: 'techniqueRef',
},
],
},
],
}).error
Expand Down Expand Up @@ -825,11 +827,13 @@ describe('schemas', () => {
name: 'fakeName',
reference: 'fakeRef',
},
technique: {
id: 'techniqueId',
name: 'techniqueName',
reference: 'techniqueRef',
},
techniques: [
{
id: 'techniqueId',
name: 'techniqueName',
reference: 'techniqueRef',
},
],
},
],
}).error
Expand Down Expand Up @@ -860,11 +864,13 @@ describe('schemas', () => {
threats: [
{
framework: 'fake',
technique: {
id: 'techniqueId',
name: 'techniqueName',
reference: 'techniqueRef',
},
techniques: [
{
id: 'techniqueId',
name: 'techniqueName',
reference: 'techniqueRef',
},
],
},
],
}).error
Expand Down Expand Up @@ -2030,11 +2036,13 @@ describe('schemas', () => {
name: 'fakeName',
reference: 'fakeRef',
},
technique: {
id: 'techniqueId',
name: 'techniqueName',
reference: 'techniqueRef',
},
techniques: [
{
id: 'techniqueId',
name: 'techniqueName',
reference: 'techniqueRef',
},
],
},
];
expect(
Expand All @@ -2060,11 +2068,13 @@ describe('schemas', () => {
name: 'fakeName',
reference: 'fakeRef',
},
technique: {
id: 'techniqueId',
name: 'techniqueName',
reference: 'techniqueRef',
},
techniques: [
{
id: 'techniqueId',
name: 'techniqueName',
reference: 'techniqueRef',
},
],
},
],
}).value.threats
Expand Down Expand Up @@ -2097,11 +2107,13 @@ describe('schemas', () => {
name: 'fakeName',
reference: 'fakeRef',
},
technique: {
id: 'techniqueId',
name: 'techniqueName',
reference: 'techniqueRef',
},
techniques: [
{
id: 'techniqueId',
name: 'techniqueName',
reference: 'techniqueRef',
},
],
},
],
}).error
Expand Down Expand Up @@ -2130,21 +2142,23 @@ describe('schemas', () => {
threats: [
{
framework: 'fake',
technique: {
id: 'techniqueId',
name: 'techniqueName',
reference: 'techniqueRef',
},
techniques: [
{
id: 'techniqueId',
name: 'techniqueName',
reference: 'techniqueRef',
},
],
},
],
}).error
).toBeTruthy();
});
test('threats is invalid when updated with missing technique sub-object', () => {
test('threats is invalid when updated with missing techniques', () => {
expect(
updateRulesSchema.validate<
Partial<Omit<UpdateRuleAlertParamsRest, 'threats'>> & {
threats: Array<Partial<Omit<ThreatParams, 'technique'>>>;
threats: Array<Partial<Omit<ThreatParams, 'techniques'>>>;
}
>({
id: 'rule-1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ const threat_technique = Joi.object({
name: threat_technique_name.required(),
reference: threat_technique_reference.required(),
});
const threat_techniques = Joi.array().items(threat_technique.required());

const threats = Joi.array().items(
Joi.object({
framework: threat_framework.required(),
tactic: threat_tactic.required(),
technique: threat_technique.required(),
techniques: threat_techniques.required(),
})
);
/* eslint-enable @typescript-eslint/camelcase */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ describe('utils', () => {
name: 'impact',
reference: 'https://attack.mitre.org/tactics/TA0040/',
},
technique: {
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
techniques: [
{
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
],
},
],
to: 'now',
Expand Down Expand Up @@ -91,11 +93,13 @@ describe('utils', () => {
name: 'impact',
reference: 'https://attack.mitre.org/tactics/TA0040/',
},
technique: {
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
techniques: [
{
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
],
},
],
to: 'now',
Expand Down Expand Up @@ -135,11 +139,13 @@ describe('utils', () => {
name: 'impact',
reference: 'https://attack.mitre.org/tactics/TA0040/',
},
technique: {
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
techniques: [
{
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
],
},
],
to: 'now',
Expand Down Expand Up @@ -179,11 +185,13 @@ describe('utils', () => {
name: 'impact',
reference: 'https://attack.mitre.org/tactics/TA0040/',
},
technique: {
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
techniques: [
{
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
],
},
],
to: 'now',
Expand Down Expand Up @@ -221,11 +229,13 @@ describe('utils', () => {
name: 'impact',
reference: 'https://attack.mitre.org/tactics/TA0040/',
},
technique: {
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
techniques: [
{
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
],
},
],
to: 'now',
Expand Down Expand Up @@ -266,11 +276,13 @@ describe('utils', () => {
name: 'impact',
reference: 'https://attack.mitre.org/tactics/TA0040/',
},
technique: {
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
techniques: [
{
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
],
},
],
to: 'now',
Expand Down Expand Up @@ -311,11 +323,13 @@ describe('utils', () => {
name: 'impact',
reference: 'https://attack.mitre.org/tactics/TA0040/',
},
technique: {
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
techniques: [
{
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
],
},
],
to: 'now',
Expand Down Expand Up @@ -409,11 +423,13 @@ describe('utils', () => {
name: 'impact',
reference: 'https://attack.mitre.org/tactics/TA0040/',
},
technique: {
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
techniques: [
{
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
],
},
],
},
Expand Down Expand Up @@ -461,11 +477,13 @@ describe('utils', () => {
name: 'impact',
reference: 'https://attack.mitre.org/tactics/TA0040/',
},
technique: {
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
techniques: [
{
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
],
},
],
});
Expand Down
Loading