Skip to content

Commit

Permalink
Fix remaining type errors around new rule field
Browse files Browse the repository at this point in the history
  • Loading branch information
rylnd committed Feb 12, 2021
1 parent c33dc3a commit c5004db
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const stepAboutDefaultValue: AboutStepRule = {
license: '',
ruleNameOverride: '',
tags: [],
threatIndicatorPath: '',
timestampOverride: '',
threat: threatDefault,
note: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ describe('StepAboutRuleComponent', () => {
technique: [],
},
],
threatIndicatorPath: '',
};

await act(async () => {
Expand Down Expand Up @@ -234,6 +235,7 @@ describe('StepAboutRuleComponent', () => {
technique: [],
},
],
threatIndicatorPath: '',
};

await act(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export const mockAboutStepRule = (): AboutStepRule => ({
falsePositives: ['test'],
tags: ['tag1', 'tag2'],
threat: getThreatMock(),
threatIndicatorPath: '',
note: '# this is some markdown documentation',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ describe('rule helpers', () => {
severity: { value: 'low', mapping: fillEmptySeverityMappings([]), isMappingChecked: false },
tags: ['tag1', 'tag2'],
threat: getThreatMock(),
threatIndicatorPath: '',
timestampOverride: 'event.ingested',
};
const scheduleRuleStepData = { from: '0s', interval: '5m' };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ export const getResult = (): RuleAlertType => ({
threatMapping: undefined,
threatLanguage: undefined,
threatIndex: undefined,
threatIndicatorPath: undefined,
threatQuery: undefined,
references: ['http://www.example.com', 'https://ww.example.com'],
note: '# Investigative notes',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const getCreateRulesOptionsMock = (): CreateRulesOptions => ({
itemsPerSearch: undefined,
threatQuery: undefined,
threatIndex: undefined,
threatIndicatorPath: undefined,
threshold: undefined,
timestampOverride: undefined,
to: 'now',
Expand Down Expand Up @@ -94,6 +95,7 @@ export const getCreateMlRulesOptionsMock = (): CreateRulesOptions => ({
threat: [],
threatFilters: undefined,
threatIndex: undefined,
threatIndicatorPath: undefined,
threatMapping: undefined,
threatQuery: undefined,
threatLanguage: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const createRules = async ({
threat,
threatFilters,
threatIndex,
threatIndicatorPath,
threatLanguage,
concurrentSearches,
itemsPerSearch,
Expand Down Expand Up @@ -102,6 +103,7 @@ export const createRules = async ({
*/
threatFilters: threatFilters as PartialFilter[] | undefined,
threatIndex,
threatIndicatorPath,
threatQuery,
concurrentSearches,
itemsPerSearch,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const installPrepackagedRules = (
items_per_search: itemsPerSearch,
threat_query: threatQuery,
threat_index: threatIndex,
threat_indicator_path: threatIndicatorPath,
threshold,
timestamp_override: timestampOverride,
references,
Expand Down Expand Up @@ -110,6 +111,7 @@ export const installPrepackagedRules = (
itemsPerSearch,
threatQuery,
threatIndex,
threatIndicatorPath,
threshold,
timestampOverride,
references,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ const rule: SanitizedAlert<RuleTypeParams> = {
threshold: undefined,
threatFilters: undefined,
threatIndex: undefined,
threatIndicatorPath: undefined,
threatQuery: undefined,
threatMapping: undefined,
threatLanguage: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ import {
ThreatLanguageOrUndefined,
ConcurrentSearchesOrUndefined,
ItemsPerSearchOrUndefined,
ThreatIndicatorPathOrUndefined,
} from '../../../../common/detection_engine/schemas/types/threat_mapping';

import { AlertsClient, PartialAlert } from '../../../../../alerts/server';
Expand Down Expand Up @@ -238,6 +239,7 @@ export interface CreateRulesOptions {
threshold: ThresholdOrUndefined;
threatFilters: ThreatFiltersOrUndefined;
threatIndex: ThreatIndexOrUndefined;
threatIndicatorPath: ThreatIndicatorPathOrUndefined;
threatQuery: ThreatQueryOrUndefined;
threatMapping: ThreatMappingOrUndefined;
concurrentSearches: ConcurrentSearchesOrUndefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const sampleRuleAlertParams = (
threatQuery: undefined,
threatMapping: undefined,
threatIndex: undefined,
threatIndicatorPath: undefined,
threatLanguage: undefined,
timelineId: undefined,
timelineTitle: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import {
ThreatLanguageOrUndefined,
ConcurrentSearchesOrUndefined,
ItemsPerSearchOrUndefined,
ThreatIndicatorPathOrUndefined,
} from '../../../common/detection_engine/schemas/types/threat_mapping';

import { LegacyCallAPIOptions } from '../../../../../../src/core/server';
Expand Down Expand Up @@ -88,6 +89,7 @@ export interface RuleTypeParams extends AlertTypeParams {
threshold: ThresholdOrUndefined;
threatFilters: PartialFilter[] | undefined;
threatIndex: ThreatIndexOrUndefined;
threatIndicatorPath: ThreatIndicatorPathOrUndefined;
threatQuery: ThreatQueryOrUndefined;
threatMapping: ThreatMappingOrUndefined;
threatLanguage: ThreatLanguageOrUndefined;
Expand Down

0 comments on commit c5004db

Please sign in to comment.