Skip to content

Commit be1d844

Browse files
committed
Exclude closed alerts from risk scoring
I don't believe that we have any tests that explicitly include closed alerts; I'll look to add these in the near future.
1 parent 5ddbc02 commit be1d844

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

x-pack/plugins/security_solution/server/lib/risk_engine/calculate_risk_scores.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import type { ElasticsearchClient, Logger } from '@kbn/core/server';
1414
import {
1515
ALERT_RISK_SCORE,
1616
ALERT_RULE_NAME,
17+
ALERT_WORKFLOW_STATUS,
1718
EVENT_KIND,
1819
} from '@kbn/rule-registry-plugin/common/technical_rule_data_field_names';
1920
import type {
@@ -213,7 +214,11 @@ export const calculateRiskScores = async ({
213214
withSecuritySpan('calculateRiskScores', async () => {
214215
const now = new Date().toISOString();
215216

216-
const filter = [{ exists: { field: ALERT_RISK_SCORE } }, filterFromRange(range)];
217+
const filter = [
218+
filterFromRange(range),
219+
{ bool: { must_not: { term: { [ALERT_WORKFLOW_STATUS]: 'closed' } } } },
220+
{ exists: { field: ALERT_RISK_SCORE } },
221+
];
217222
if (!isEmpty(userFilter)) {
218223
filter.push(userFilter as QueryDslQueryContainer);
219224
}

0 commit comments

Comments
 (0)