Skip to content

Commit 8a9d5f2

Browse files
authored
[Threat Intel] Enrichment eval suite for the LLM-backed routes (#289345)
1 parent 590fcc3 commit 8a9d5f2

32 files changed

Lines changed: 1710 additions & 0 deletions

.buildkite/pipelines/evals/evals.suites.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,19 @@
304304
],
305305
"serverConfigSet": "evals_lead_generation"
306306
},
307+
{
308+
"id": "threat-intel-enrichment",
309+
"name": "Threat Intel Enrichment",
310+
"configPath": "x-pack/solutions/security/packages/kbn-evals-suite-threat-intel-enrichment/playwright.config.ts",
311+
"tags": [
312+
"security",
313+
"threat-intel-enrichment"
314+
],
315+
"ciLabels": [
316+
"evals:threat-intel-enrichment"
317+
],
318+
"serverConfigSet": "evals_threat_intel"
319+
},
307320
{
308321
"id": "workflows",
309322
"name": "Workflows Authoring",

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,7 @@ x-pack/solutions/security/packages/kbn-evals-suite-security-automatic-migrations
14211421
x-pack/solutions/security/packages/kbn-evals-suite-security-esql-generation-regression @elastic/security-detection-platform
14221422
x-pack/solutions/security/packages/kbn-evals-suite-security-persona-matrix @elastic/security-generative-ai
14231423
x-pack/solutions/security/packages/kbn-evals-suite-siem-readiness @elastic/contextual-security-apps
1424+
x-pack/solutions/security/packages/kbn-evals-suite-threat-intel-enrichment @elastic/security-threat-hunting
14241425
x-pack/solutions/security/packages/kbn-scout-security @elastic/appex-qa @elastic/security-engineering-productivity
14251426
x-pack/solutions/security/packages/kbn-security-evals-alerts-snapshot @elastic/security-generative-ai
14261427
x-pack/solutions/security/packages/kbn-security-evals-workflow-traces @elastic/security-generative-ai

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,6 +1855,7 @@
18551855
"@kbn/evals-suite-significant-events": "workspace:*",
18561856
"@kbn/evals-suite-smoke-tests": "workspace:*",
18571857
"@kbn/evals-suite-streams": "workspace:*",
1858+
"@kbn/evals-suite-threat-intel-enrichment": "workspace:*",
18581859
"@kbn/evals-suite-workflows": "workspace:*",
18591860
"@kbn/expect": "workspace:*",
18601861
"@kbn/extract-plugin-translations": "workspace:*",

pnpm-lock.yaml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,7 @@ packages:
16101610
- 'x-pack/solutions/security/packages/kbn-evals-suite-security-esql-generation-regression'
16111611
- 'x-pack/solutions/security/packages/kbn-evals-suite-security-persona-matrix'
16121612
- 'x-pack/solutions/security/packages/kbn-evals-suite-siem-readiness'
1613+
- 'x-pack/solutions/security/packages/kbn-evals-suite-threat-intel-enrichment'
16131614
- 'x-pack/solutions/security/packages/kbn-scout-security'
16141615
- 'x-pack/solutions/security/packages/kbn-security-evals-alerts-snapshot'
16151616
- 'x-pack/solutions/security/packages/kbn-security-evals-workflow-traces'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
import { servers as evalsTracingConfig } from '../../evals_tracing/stateful/classic.stateful.config';
11+
import type { ScoutServerConfig } from '../../../../../types';
12+
13+
/**
14+
* Custom Scout stateful server configuration for Threat Intel enrichment evals.
15+
*
16+
* Extends the tracing config (EIS connectors + eval tracing) and:
17+
* - Enables the `threatIntelSupplyEnabled` experimental feature flag so the
18+
* `/internal/threat_intel/*` enrichment routes are registered.
19+
* - Disables `searchInferenceEndpoints` so `resolveScopedModel` takes its
20+
* `genAiSettings:defaultAIConnector` fallback path. The suite points that
21+
* setting at the per-project connector, which is how each model in the
22+
* EIS/LiteLLM matrix actually gets exercised. With the registry present the
23+
* route would deliberately refuse the global-default fallback and return a
24+
* no_connector error.
25+
*
26+
* Usage:
27+
* node scripts/scout start-server --arch stateful --domain classic --serverConfigSet evals_threat_intel
28+
*/
29+
export const servers: ScoutServerConfig = {
30+
...evalsTracingConfig,
31+
kbnTestServer: {
32+
...evalsTracingConfig.kbnTestServer,
33+
serverArgs: [
34+
...evalsTracingConfig.kbnTestServer.serverArgs,
35+
`--xpack.securitySolution.enableExperimental=${JSON.stringify(['threatIntelSupplyEnabled'])}`,
36+
'--xpack.searchInferenceEndpoints.enabled=false',
37+
],
38+
},
39+
};

tsconfig.base.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,8 @@
13751375
"@kbn/evals-suite-smoke-tests/*": ["./x-pack/platform/packages/shared/kbn-evals-suite-smoke-tests/*"],
13761376
"@kbn/evals-suite-streams": ["./x-pack/platform/packages/shared/kbn-evals-suite-streams"],
13771377
"@kbn/evals-suite-streams/*": ["./x-pack/platform/packages/shared/kbn-evals-suite-streams/*"],
1378+
"@kbn/evals-suite-threat-intel-enrichment": ["./x-pack/solutions/security/packages/kbn-evals-suite-threat-intel-enrichment"],
1379+
"@kbn/evals-suite-threat-intel-enrichment/*": ["./x-pack/solutions/security/packages/kbn-evals-suite-threat-intel-enrichment/*"],
13781380
"@kbn/evals-suite-workflows": ["./src/platform/packages/shared/kbn-evals-suite-workflows"],
13791381
"@kbn/evals-suite-workflows/*": ["./src/platform/packages/shared/kbn-evals-suite-workflows/*"],
13801382
"@kbn/event-annotation-common": ["./src/platform/packages/shared/kbn-event-annotation-common"],
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { tags } from '@kbn/evals';
9+
import { evaluate } from '../../src/evaluate';
10+
import { assessRelevanceDataset } from '../../src/datasets/assess_relevance_dataset';
11+
import {
12+
createIsIntelligenceEvaluator,
13+
createRelevanceShapeEvaluator,
14+
} from '../../src/evaluators/assess_relevance_evaluators';
15+
16+
evaluate.describe(
17+
'Threat Intel Enrichment: assess_relevance',
18+
{ tag: tags.stateful.classic },
19+
() => {
20+
evaluate('classifies intelligence vs noise', async ({ executorClient, threatIntelClient }) => {
21+
await executorClient.runExperiment(
22+
{
23+
datasets: [
24+
{
25+
name: 'threat_intel: assess_relevance',
26+
description:
27+
'BlackHat demo packs (intelligence) plus authored marketing/opinion distractors (not intelligence).',
28+
examples: assessRelevanceDataset,
29+
},
30+
],
31+
task: async ({ input }) => {
32+
if (!input) throw new Error('Missing assess_relevance input');
33+
return threatIntelClient.assessRelevance(input);
34+
},
35+
},
36+
[createIsIntelligenceEvaluator(), createRelevanceShapeEvaluator()]
37+
);
38+
});
39+
}
40+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { tags } from '@kbn/evals';
9+
import { evaluate } from '../../src/evaluate';
10+
import { classifySeverityDataset } from '../../src/datasets/classify_severity_dataset';
11+
import {
12+
createSeverityAdjacentEvaluator,
13+
createSeverityExactEvaluator,
14+
} from '../../src/evaluators/classify_severity_evaluators';
15+
16+
evaluate.describe(
17+
'Threat Intel Enrichment: classify_severity',
18+
{ tag: tags.stateful.classic },
19+
() => {
20+
evaluate(
21+
'assigns severity across the ladder',
22+
async ({ executorClient, threatIntelClient }) => {
23+
await executorClient.runExperiment(
24+
{
25+
datasets: [
26+
{
27+
name: 'threat_intel: classify_severity',
28+
description:
29+
'Authored low/medium/high/critical ladder plus two fixture-derived anchors. Scored exact and within-one-level.',
30+
examples: classifySeverityDataset,
31+
},
32+
],
33+
task: async ({ input }) => {
34+
if (!input) throw new Error('Missing classify_severity input');
35+
return threatIntelClient.classifySeverity(input);
36+
},
37+
},
38+
[createSeverityExactEvaluator(), createSeverityAdjacentEvaluator()]
39+
);
40+
}
41+
);
42+
}
43+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { tags } from '@kbn/evals';
9+
import { evaluate } from '../../src/evaluate';
10+
import { enrichTaxonomyDataset } from '../../src/datasets/enrich_taxonomy_dataset';
11+
import {
12+
createCategoryRecallEvaluator,
13+
createRegionRecallEvaluator,
14+
} from '../../src/evaluators/enrich_taxonomy_evaluators';
15+
16+
evaluate.describe(
17+
'Threat Intel Enrichment: enrich_taxonomy',
18+
{ tag: tags.stateful.classic },
19+
() => {
20+
evaluate('extracts categories and regions', async ({ executorClient, threatIntelClient }) => {
21+
await executorClient.runExperiment(
22+
{
23+
datasets: [
24+
{
25+
name: 'threat_intel: enrich_taxonomy',
26+
description:
27+
'BlackHat demo packs with labelled closed-set categories/regions plus one authored multi-category example. Scored by recall.',
28+
examples: enrichTaxonomyDataset,
29+
},
30+
],
31+
task: async ({ input }) => {
32+
if (!input) throw new Error('Missing enrich_taxonomy input');
33+
return threatIntelClient.enrichTaxonomy(input);
34+
},
35+
},
36+
[createCategoryRecallEvaluator(), createRegionRecallEvaluator()]
37+
);
38+
});
39+
}
40+
);

0 commit comments

Comments
 (0)