Skip to content

Commit

Permalink
Fixes editing of non-indicator rules
Browse files Browse the repository at this point in the history
If the user edits a rule without visiting the About tab, they will
receive a value of threatIndicatorPath: '' which we'll then try to send
to the backend, but it gets rejected.

By removing this defaulting logic we get the correct behavior: existing
rules default to threatIndicatorPath: undefined, which gets stripped
before being sent to the backend. If the rule is an indicator rule, the
value will be persisted as expected.
  • Loading branch information
rylnd committed Feb 17, 2021
1 parent 2c3269f commit 07689b4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ 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 @@ -116,7 +116,6 @@ 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 @@ -180,7 +180,7 @@ export const getAboutStepsData = (rule: Rule, detailsView: boolean): AboutStepRu
},
falsePositives,
threat: threat as Threats,
threatIndicatorPath: threatIndicatorPath ?? '',
threatIndicatorPath,
};
};

Expand Down

0 comments on commit 07689b4

Please sign in to comment.