-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[Security Solution] Enable Value Reports in ESS #243511
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
Merged
denar50
merged 44 commits into
elastic:main
from
denar50:enable-value-reports-in-ech-with-only-ai-generated-data-forwarded
Dec 2, 2025
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
a5a7173
declare the share plugin as a security_solution dependency
denar50 cf27925
allow exporting ai value reports in ess
denar50 c3639fc
tune cost savings insight prompt
denar50 28fa6ed
Changes from node scripts/lint_ts_projects --fix
kibanamachine daacc5d
update securitySolution bundle limits
denar50 0b39652
fix unit tests
denar50 675448d
Merge branch 'main' into enable-value-reports-in-ech-with-only-ai-gen…
denar50 44268e0
Merge branch 'main' into enable-value-reports-in-ech-with-only-ai-gen…
denar50 2b3fd3d
add new ESS settings to stack management schema
denar50 eeef8ea
Changes from node scripts/telemetry_check
kibanamachine 2313b91
Merge branch 'main' into enable-value-reports-in-ech-with-only-ai-gen…
denar50 8ba9c2d
fix cypress tests
denar50 cdd06e6
Merge branch 'main' into enable-value-reports-in-ech-with-only-ai-gen…
denar50 243caef
Changes from node scripts/regenerate_moon_projects.js --update
kibanamachine 400824f
enable scheduling an export report task
denar50 920f4e3
use AI_VALUE_REPORT_LOCATOR from @kbn/deeplinks-analytics
denar50 3e9f5eb
Update x-pack/solutions/security/plugins/security_solution/public/rep…
denar50 d0204d2
Update x-pack/solutions/security/plugins/security_solution/public/rep…
denar50 9590b4b
Update x-pack/solutions/security/plugins/security_solution/public/rep…
denar50 9a47f65
fix syntax error
denar50 45df8ae
use callback ref in ai value page
denar50 2789336
memoise loading state of CostSavingsKeyInsightView
denar50 5c221c0
add telemetry support
denar50 cf7bee7
added telemetry and error handling to hash generation
denar50 4d15c2a
fix linting error
denar50 eeea191
Changes from node scripts/eslint_all_files --no-cache --fix
kibanamachine 0d2279f
add isExportMode boolean to exportContext, hide title edit pencil in …
denar50 dcc0f99
Merge branch 'main' into enable-value-reports-in-ech-with-only-ai-gen…
denar50 7e9df73
Changes from node scripts/regenerate_moon_projects.js --update
kibanamachine 042035c
make valueReport non optional in UrlInputsModel
denar50 0dc225e
use loading state for export button
denar50 34d2431
fix type issues related to valueReport being now always available in …
denar50 e8c7e19
Changes from node scripts/eslint_all_files --no-cache --fix
kibanamachine 7a02485
adjust the ValueReportSettingsComponent: reword the change rate cta i…
denar50 076712c
adjust copy
denar50 48dd736
miscellaneous UI improvements
denar50 323ba8e
fix unit tests
denar50 ba23bb6
Merge remote-tracking branch 'upstream/main' into enable-value-report…
denar50 966c170
Merge branch 'main' into enable-value-reports-in-ech-with-only-ai-gen…
denar50 3709a8a
fix unit test
denar50 1554f8a
further ui adjustments
denar50 148755e
Merge branch 'main' into enable-value-reports-in-ech-with-only-ai-gen…
denar50 8c5f7c3
Merge branch 'main' into enable-value-reports-in-ech-with-only-ai-gen…
denar50 980e50a
Merge branch 'main' into enable-value-reports-in-ech-with-only-ai-gen…
denar50 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...utions/security/plugins/security_solution/common/locators/ai_value_report/locator.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import { AI_VALUE_REPORT_LOCATOR } from '@kbn/deeplinks-analytics'; | ||
| import { AIValueReportLocatorDefinition, parseLocationState } from './locator'; | ||
| import { AI_VALUE_PATH, APP_UI_ID } from '../../constants'; | ||
|
|
||
| describe('AIValueReportLocatorDefinition', () => { | ||
| const locator = new AIValueReportLocatorDefinition(); | ||
|
|
||
| const validParams = { | ||
| timeRange: { | ||
| from: '2024-01-01T00:00:00Z', | ||
| to: '2024-01-02T00:00:00Z', | ||
| }, | ||
| insight: 'Some valuable insight!', | ||
| reportDataHash: 'abc123', | ||
| }; | ||
|
|
||
| test('id should match constant', () => { | ||
| expect(locator.id).toBe(AI_VALUE_REPORT_LOCATOR); | ||
| }); | ||
|
|
||
| test('getLocation returns correct location object', async () => { | ||
| const result = await locator.getLocation(validParams); | ||
|
|
||
| expect(result).toEqual({ | ||
| app: APP_UI_ID, | ||
| path: AI_VALUE_PATH, | ||
| state: validParams, | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe('parseLocationState', () => { | ||
| const validState = { | ||
| timeRange: { | ||
| from: '2024-01-01T00:00:00Z', | ||
| to: '2024-01-01T00:00:00Z', | ||
| }, | ||
| insight: 'Some valuable insight!', | ||
| reportDataHash: 'hash123', | ||
| }; | ||
|
|
||
| it('returns parsed state when valid', () => { | ||
| const result = parseLocationState(validState); | ||
| expect(result).toEqual(validState); | ||
| }); | ||
|
|
||
| it('strips unknown fields but preserves valid ones', () => { | ||
| const stateWithExtras = { | ||
| ...validState, | ||
| extraField: 'foo', | ||
| anotherOne: 42, | ||
| }; | ||
|
|
||
| const result = parseLocationState(stateWithExtras); | ||
|
|
||
| expect(result).toEqual(stateWithExtras); | ||
| }); | ||
|
|
||
| it('returns undefined for invalid state (missing fields)', () => { | ||
| const invalid = { | ||
| insight: 'missing timeRange and hash', | ||
| }; | ||
|
|
||
| const result = parseLocationState(invalid); | ||
| expect(result).toBeUndefined(); | ||
| }); | ||
| }); |
48 changes: 48 additions & 0 deletions
48
...k/solutions/security/plugins/security_solution/common/locators/ai_value_report/locator.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import { z } from '@kbn/zod'; | ||
| import type { LocatorDefinition, LocatorPublic } from '@kbn/share-plugin/public'; | ||
| import { AI_VALUE_REPORT_LOCATOR } from '@kbn/deeplinks-analytics'; | ||
| import { AI_VALUE_PATH, APP_UI_ID } from '../../constants'; | ||
|
|
||
| const AIValueReportParamsSchema = z.object({ | ||
| timeRange: z.object({ | ||
| to: z.string().nonempty(), | ||
| from: z.string().nonempty(), | ||
| }), | ||
| insight: z.string().nonempty(), | ||
| reportDataHash: z.string().nonempty(), | ||
| }); | ||
|
|
||
| export type AIValueReportParams = z.infer<typeof AIValueReportParamsSchema>; | ||
|
|
||
| export type ForwardedAIValueReportState = AIValueReportParams; | ||
|
|
||
| export type AIValueReportLocator = LocatorPublic<AIValueReportParams>; | ||
|
|
||
| export class AIValueReportLocatorDefinition implements LocatorDefinition<AIValueReportParams> { | ||
| public readonly id = AI_VALUE_REPORT_LOCATOR; | ||
|
|
||
| public readonly getLocation = async (params: AIValueReportParams) => { | ||
| return { | ||
| app: APP_UI_ID, | ||
| path: AI_VALUE_PATH, | ||
| state: params, | ||
| }; | ||
| }; | ||
| } | ||
|
|
||
| export const parseLocationState = (state: unknown): ForwardedAIValueReportState | undefined => { | ||
| const result = AIValueReportParamsSchema.passthrough().safeParse(state); | ||
| if (result.error) { | ||
| // This will cause the page to fallback to rendering normally | ||
| return undefined; | ||
| } | ||
|
|
||
| return result.data; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
One thing to look out for, is if somehow the telemetry index isn't rolled over to take into account this field, and it's passed as a number, the mapping will end up being a numeric type, not keyword. Not sure how the telemetry mapping is handled, but I believe we've had issues like this in the past.
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.
There are ways to define the type in the telemetry index either by mapping it in the telemetry index config file (one of these files). Some of these configs also use component templates.
I checked for
stack_managementin both places and didn't see any place where types have been explicitly defined. In that case it'll depend on the index's dynamic mapping config. I'm not sure in which index these fields will go so I can't say exactly howdynamicis defined, but there are definitely ways to deal with typing the fields and even handling cases where a field's type changes over time. Feel free to reach out in Slack at#platform-analyticsif you have questions.