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

[RAC][Security Solution] Adds Threshold rule type and removes reliance on outputIndex #111437

Merged
merged 25 commits into from
Sep 14, 2021

Conversation

madirey
Copy link
Contributor

@madirey madirey commented Sep 7, 2021

Summary

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@madirey madirey added release_note:skip Skip the PR/issue when compiling release notes Feature:Detection Rules Security Solution rules and Detection Engine Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Feature:Threshold Rule Security Solution Threshold rule type Theme: rac label obsolete Feature:RAC label obsolete v7.16.0 labels Sep 7, 2021
@madirey madirey changed the title [Draft][RAC][Security Solution] Adds Threshold rule type and removes usage of outputIndex [Draft][RAC][Security Solution] Adds Threshold rule type and removes reliance on outputIndex Sep 7, 2021
@madirey madirey changed the title [Draft][RAC][Security Solution] Adds Threshold rule type and removes reliance on outputIndex [RAC][Security Solution] Adds Threshold rule type and removes reliance on outputIndex Sep 9, 2021
@madirey madirey marked this pull request as ready for review September 9, 2021 15:48
@madirey madirey requested a review from a team as a code owner September 9, 2021 15:48
@elasticmachine
Copy link
Contributor

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

@madirey madirey enabled auto-merge (squash) September 13, 2021 17:24
Copy link
Contributor

@marshallmain marshallmain left a comment

Choose a reason for hiding this comment

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

Looks like the ruleTypeId for the new threshold rules needs to be updated from siem.signals to siem.thresholdRule in the ruleTypeMappings. But since this is feature flagged and there will be major follow ups to this I don't think we need to hold up merging this PR.

Comment on lines 11 to +29
export const flattenWithPrefix = (
prefix: string,
obj: Record<string, SearchTypes>
maybeObj: unknown
): Record<string, SearchTypes> => {
return Object.keys(obj).reduce((acc: Record<string, SearchTypes>, key) => {
if (maybeObj != null && isPlainObject(maybeObj)) {
return Object.keys(maybeObj as Record<string, SearchTypes>).reduce(
(acc: Record<string, SearchTypes>, key) => {
return {
...acc,
...flattenWithPrefix(`${prefix}.${key}`, (maybeObj as Record<string, SearchTypes>)[key]),
};
},
{}
);
} else {
return {
...acc,
[`${prefix}.${key}`]: obj[key],
[prefix]: maybeObj as SearchTypes,
};
}, {});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this function is used in both the real alert generation and the alert generation tests, it would be nice to test this function explicitly - especially now that it's not as trivial to see that it works.

@marshallmain
Copy link
Contributor

When we're updating the API integration tests to work with the new rule implementations, we should also add additional API integration tests for all rule types around duplicate mitigation.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

@madirey madirey merged commit cdb9fba into elastic:master Sep 14, 2021
@madirey madirey deleted the security-rule-type-threshold branch September 14, 2021 18:50
madirey added a commit to madirey/kibana that referenced this pull request Sep 14, 2021
…e on outputIndex (elastic#111437)

* Initial commit

* Properly handle signal history

* Fix elastic#95258 - cardinality sort bug

* Init threshold rule

* Create working threshold rule

* Fix threshold signal generation

* Fix tests

* Update mappings

* ALERT_TYPE_ID => RULE_TYPE_ID

* Add tests

* Fix types
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Sep 16, 2021
@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

5 similar comments
@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

madirey added a commit that referenced this pull request Sep 23, 2021
…e on outputIndex (#111437) (#112161)

* Initial commit

* Properly handle signal history

* Fix #95258 - cardinality sort bug

* Init threshold rule

* Create working threshold rule

* Fix threshold signal generation

* Fix tests

* Update mappings

* ALERT_TYPE_ID => RULE_TYPE_ID

* Add tests

* Fix types
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Detection Rules Security Solution rules and Detection Engine Feature:RAC label obsolete Feature:Threshold Rule Security Solution Threshold rule type release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Theme: rac label obsolete v7.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants