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][Detections] Disables add exception for ML and threshold rules #75802

Merged
merged 2 commits into from
Aug 25, 2020

Conversation

dplumlee
Copy link
Contributor

@dplumlee dplumlee commented Aug 24, 2020

Summary

Disables the add exception feature for exceptions created by Machine learning and threshold based rules (#75154)

Screen Shot 2020-08-24 at 1 15 26 PM
Screen Shot 2020-08-24 at 1 52 26 PM

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@dplumlee dplumlee added Feature:Detection Rules Anything related to Security Solution's Detection Rules release_note:skip Skip the PR/issue when compiling release notes v7.10.0 v8.0.0 labels Aug 24, 2020
data: nonEcsRowData,
fieldName: 'signal.rule.type',
});
const [ruleType] = ruleTypes as Array<Rule['type']>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird typecheck work around, better suggestions welcome

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RuleType is a more direct type reference, but up to you on Rule['type'] vs RuleType.

If getMappedNonEcsValue can return something other than a string[] maybe it's worth making it generic (to allow getMappedNonEcsValue<RuleType[]>, otherwise I'd say that refining our string to our enum is probably the best we can do here, as far as I'm aware.

Alternately we could loosen the restrictions on those predicate functions and just have them accept strings instead of RuleTypes, but that would have some (IMO) negative downstream consequences.

@dplumlee dplumlee marked this pull request as ready for review August 24, 2020 18:03
@dplumlee dplumlee requested review from a team as code owners August 24, 2020 18:03
@dplumlee dplumlee added the Team:Endpoint Response Endpoint Response Team label Aug 24, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/endpoint-response (Team:Endpoint Response)

@elasticmachine
Copy link
Contributor

Pinging @elastic/siem (Team:SIEM)

Copy link
Contributor

@rylnd rylnd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I had one nit about the predicate name and a few options for addressing the typescript issue, but this is straightforward and good to merge.

It would be nice to have a regression test here; do we maybe have an existing integration test to which we could add an assertion?

data: nonEcsRowData,
fieldName: 'signal.rule.type',
});
const [ruleType] = ruleTypes as Array<Rule['type']>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RuleType is a more direct type reference, but up to you on Rule['type'] vs RuleType.

If getMappedNonEcsValue can return something other than a string[] maybe it's worth making it generic (to allow getMappedNonEcsValue<RuleType[]>, otherwise I'd say that refining our string to our enum is probably the best we can do here, as far as I'm aware.

Alternately we could loosen the restrictions on those predicate functions and just have them accept strings instead of RuleTypes, but that would have some (IMO) negative downstream consequences.

@@ -317,6 +321,15 @@ export const getAlertActions = ({
return module === 'endpoint' && kind === 'alert';
};

const isFromValidRule = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"valid rule" doesn't relay much info here, I'd say we be more explicit:

Suggested change
const isFromValidRule = () => {
const exceptionsAreAllowed = () => {

@MadameSheema
Copy link
Member

MadameSheema commented Aug 25, 2020

@dplumlee @rylnd is it possible to add tests to check that the option is disabled and enabled for the correct rules? Thanks :)

@dplumlee
Copy link
Contributor Author

dplumlee commented Aug 25, 2020

@MadameSheema We were thinking of adding tests after this pr (#73228) was merged given that it refactors a lot of this and we need to unskip many of the tests for this file anyway. We could open a ticket for adding them back once it's merged

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

async chunks size

id value diff baseline
securitySolution 7.2MB +336.0B 7.2MB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@dplumlee dplumlee merged commit 5f89e00 into elastic:master Aug 25, 2020
@dplumlee dplumlee deleted the context-menu-disable-fix branch August 25, 2020 22:13
@dplumlee
Copy link
Contributor Author

@MadameSheema @rylnd #75934 this is the issue for updating and adding test coverage for the event viewer once patryk's pr is merged

dplumlee added a commit that referenced this pull request Aug 26, 2020
dplumlee added a commit that referenced this pull request Aug 26, 2020
parkiino pushed a commit to parkiino/kibana that referenced this pull request Sep 1, 2020
@MindyRS MindyRS added the Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. label Sep 23, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Detection Rules Anything related to Security Solution's Detection Rules release_note:skip Skip the PR/issue when compiling release notes Team:Endpoint Response Endpoint Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:SIEM v7.9.1 v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants