-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[RAC][Security Solution] Adds Threshold rule type and removes reliance on outputIndex #111437
Conversation
outputIndex
Pinging @elastic/security-solution (Team: SecuritySolution) |
There was a problem hiding this 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.
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, | ||
}; | ||
}, {}); | ||
} |
There was a problem hiding this comment.
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.
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. |
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
…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
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
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. |
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. |
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. |
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. |
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. |
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:
For maintainers