Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8efa174
init plugin and navigation creation for siem readiness
JordanSh Aug 19, 2025
4d000ba
lint
JordanSh Aug 20, 2025
e7e5279
types
JordanSh Aug 20, 2025
bb593ae
Merge branch 'main' of https://github.com/elastic/kibana into siem-re…
JordanSh Aug 20, 2025
896484f
Merge branch 'main' of https://github.com/elastic/kibana into siem-re…
JordanSh Aug 21, 2025
1b3a6b3
wont show on serverless
JordanSh Aug 21, 2025
a6943a6
fix register of plugin
JordanSh Aug 21, 2025
ccb37bd
add exp key to link
JordanSh Aug 24, 2025
2e5a04f
codeowners
JordanSh Aug 24, 2025
07aa77d
adding package
JordanSh Sep 1, 2025
d1669cc
adding package
JordanSh Sep 1, 2025
8ecfd87
adding package
JordanSh Sep 1, 2025
035f439
adding server
JordanSh Sep 1, 2025
716f0b7
indexing works
JordanSh Sep 2, 2025
daa8059
indexing works
JordanSh Sep 2, 2025
36998c8
indexing works
JordanSh Sep 2, 2025
af47d70
indexing works
JordanSh Sep 2, 2025
2f2258c
path
JordanSh Sep 2, 2025
ffdb088
cleaning
JordanSh Sep 2, 2025
d13605c
cleaning
JordanSh Sep 2, 2025
06190a8
cleaning
JordanSh Sep 2, 2025
06957f8
rename file
JordanSh Sep 2, 2025
68f2c6e
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Sep 2, 2025
d414c87
cleaning
JordanSh Sep 2, 2025
01c09d7
Merge branch 'siem-readiness-kbn-package' of https://github.com/Jorda…
JordanSh Sep 2, 2025
81eb55d
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Sep 2, 2025
cd8c983
[CI] Auto-commit changed files from 'node scripts/eslint_all_files --…
kibanamachine Sep 2, 2025
bdec17f
cleaning
JordanSh Sep 3, 2025
063433a
Merge branch 'main' of https://github.com/elastic/kibana into siem-re…
JordanSh Sep 3, 2025
fa6bd6e
Merge branch 'main' of https://github.com/elastic/kibana into siem-re…
JordanSh Sep 3, 2025
8681387
remove unneeded code
JordanSh Sep 4, 2025
016adba
Merge branch 'main' of https://github.com/elastic/kibana into siem-re…
JordanSh Sep 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,7 @@ x-pack/solutions/security/packages/index-adapter @elastic/security-threat-huntin
x-pack/solutions/security/packages/kbn-cloud-security-posture/common @elastic/kibana-cloud-security-posture
x-pack/solutions/security/packages/kbn-cloud-security-posture/graph @elastic/kibana-cloud-security-posture
x-pack/solutions/security/packages/kbn-cloud-security-posture/public @elastic/kibana-cloud-security-posture
x-pack/solutions/security/packages/siem_readiness @elastic/kibana-cloud-security-posture
x-pack/solutions/security/packages/kbn-scout-security @elastic/appex-qa
x-pack/solutions/security/packages/kbn-securitysolution-autocomplete @elastic/security-detection-engine
x-pack/solutions/security/packages/kbn-securitysolution-endpoint-exceptions-common @elastic/security-detection-engine
Expand Down Expand Up @@ -2469,6 +2470,7 @@ x-pack/solutions/security/test/security_solution_api_integration/test_suites/sou
## Security Solution sub teams - Cloud Security Posture

x-pack/solutions/security/plugins/security_solution/public/asset_inventory @elastic/kibana-cloud-security-posture
x-pack/solutions/security/plugins/security_solution/public/siem_readiness @elastic/kibana-cloud-security-posture

## Security Solution sub teams - Security Entity Store
x-pack/platform/packages/shared/kbn-entities-schema/src/schema/v1 @elastic/entity-store
Expand Down Expand Up @@ -2823,6 +2825,7 @@ x-pack/solutions/security/plugins/security_solution/public/common/components/ses
x-pack/solutions/security/plugins/security_solution/public/cloud_security_posture @elastic/kibana-cloud-security-posture
x-pack/solutions/security/plugins/security_solution/public/kubernetes @elastic/kibana-cloud-security-posture
x-pack/solutions/security/plugins/security_solution/server/lib/asset_inventory @elastic/kibana-cloud-security-posture
x-pack/solutions/security/plugins/security_solution/server/lib/siem_readiness @elastic/kibana-cloud-security-posture
x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/generic_right @elastic/kibana-cloud-security-posture
/x-pack/solutions/security/plugins/security_solution/public/flyout/csp_details @elastic/kibana-cloud-security-posture

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,7 @@
"@kbn/shared-ux-table-persist": "link:src/platform/packages/shared/shared-ux/table_persist",
"@kbn/shared-ux-toolbar-selector": "link:src/platform/packages/shared/shared-ux/toolbar_selector",
"@kbn/shared-ux-utility": "link:src/platform/packages/shared/kbn-shared-ux-utility",
"@kbn/siem-readiness": "link:x-pack/solutions/security/packages/siem-readiness",
"@kbn/slo-plugin": "link:x-pack/solutions/observability/plugins/slo",
"@kbn/slo-schema": "link:x-pack/platform/packages/shared/kbn-slo-schema",
"@kbn/snapshot-restore-plugin": "link:x-pack/platform/plugins/private/snapshot_restore",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export enum SecurityPageName {
rulesCreate = 'rules-create',
rulesLanding = 'rules-landing',
rulesManagement = 'rules-management',
siemReadiness = 'siem_readiness',
siemMigrationsRules = 'siem_migrations-rules',
/*
* Warning: Computed values are not permitted in an enum with string valued members
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2038,6 +2038,8 @@
"@kbn/shared-ux-toolbar-selector/*": ["src/platform/packages/shared/shared-ux/toolbar_selector/*"],
"@kbn/shared-ux-utility": ["src/platform/packages/shared/kbn-shared-ux-utility"],
"@kbn/shared-ux-utility/*": ["src/platform/packages/shared/kbn-shared-ux-utility/*"],
"@kbn/siem-readiness": ["x-pack/solutions/security/packages/siem-readiness"],
"@kbn/siem-readiness/*": ["x-pack/solutions/security/packages/siem-readiness/*"],
"@kbn/slo-plugin": ["x-pack/solutions/observability/plugins/slo"],
"@kbn/slo-plugin/*": ["x-pack/solutions/observability/plugins/slo/*"],
"@kbn/slo-schema": ["x-pack/platform/packages/shared/kbn-slo-schema"],
Expand Down
24 changes: 24 additions & 0 deletions x-pack/solutions/security/packages/siem-readiness/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# @kbn/siem-readiness

## Overview

The SIEM readiness package helps log readiness events within Kibana.

## Usage

```typescript
import { useLogReadinessTask } from '@kbn/siem-readiness';

// Example usage
const { logReadinessTask } = useLogReadinessTask();

const handleLogTask = useCallback(async () => {
logReadinessTask({ task_id: '1', status: 'complete', meta: { demo: 'demo_data' } });
}, [logReadinessTask]);
```

## API

The package is using the post_readiness_task API which can be found at:

`kibana/x-pack/solutions/security/plugins/security_solution/server/lib/siem_readiness/routes/post_readiness_task.ts`
10 changes: 10 additions & 0 deletions x-pack/solutions/security/packages/siem-readiness/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* 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.
*/

export type * from './src/types';
export * from './src/constants';
export * from './src/use_log_readiness_task';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* 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.
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../../../../..',
roots: ['<rootDir>/x-pack/solutions/security/packages/siem-readiness'],
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "shared-browser",
"id": "@kbn/siem-readiness",
"owner": [
"@elastic/kibana-cloud-security-posture"
],
"group": "security",
"visibility": "private"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@kbn/siem-readiness",
"private": true,
"version": "1.0.0",
"license": "Elastic License 2.0",
"description": "handles SIEM Readiness tasks management for Kibana Security Solution",
"sideEffects": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* 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.
*/

export const SIEM_READINESS_PACKAGE_NAME = '@kbn/siem-readiness';
export const POST_SIEM_READINESS_TASK_API_PATH = '/api/siem_readiness/post_task';
12 changes: 12 additions & 0 deletions x-pack/solutions/security/packages/siem-readiness/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* 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.
*/

export interface SiemReadinessTask {
task_id: string;
status: 'complete' | 'incomplete';
meta: Record<string, unknown>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* 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 React from 'react';
import { renderHook, act } from '@testing-library/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { useLogReadinessTask } from './use_log_readiness_task';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { POST_SIEM_READINESS_TASK_API_PATH } from './constants';
import type { SiemReadinessTask } from './types';

jest.mock('@kbn/kibana-react-plugin/public', () => ({
useKibana: jest.fn(),
}));

describe('useLogReadinessTask', () => {
const mockPost = jest.fn();
const queryClient = new QueryClient();

const wrapper = ({ children }: { children: React.ReactNode }) => (
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
);

beforeEach(() => {
jest.clearAllMocks();
(useKibana as jest.Mock).mockReturnValue({
services: {
http: {
post: mockPost,
},
},
});
});

it('should call http.post with the correct arguments when logging a task', async () => {
const { result } = renderHook(() => useLogReadinessTask(), { wrapper });

const task: SiemReadinessTask = {
task_id: 'test-task-1',
status: 'complete',
meta: { description: 'Test task', duration: 1000 },
};

await act(async () => {
result.current.logReadinessTask(task);
});

expect(mockPost).toHaveBeenCalledWith(POST_SIEM_READINESS_TASK_API_PATH, {
body: JSON.stringify(task),
});
});

it('should handle an error response from http.post', async () => {
mockPost.mockRejectedValue(new Error('HTTP error'));
const { result } = renderHook(() => useLogReadinessTask({ onError: jest.fn() }), { wrapper });

const task: SiemReadinessTask = {
task_id: 'test-task-2',
status: 'incomplete',
meta: { error: 'Something went wrong' },
};

await act(async () => {
try {
result.current.logReadinessTask(task);
} catch {
// expected to throw
}
});

expect(mockPost).toHaveBeenCalledWith(POST_SIEM_READINESS_TASK_API_PATH, {
body: JSON.stringify(task),
});
});

it('should call onSuccess callback when mutation succeeds', async () => {
const onSuccess = jest.fn();
mockPost.mockResolvedValue({});
const { result } = renderHook(() => useLogReadinessTask({ onSuccess }), { wrapper });

const task: SiemReadinessTask = {
task_id: 'test-task-3',
status: 'complete',
meta: {},
};

await act(async () => {
result.current.logReadinessTask(task);
});

expect(onSuccess).toHaveBeenCalled();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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 { useMutation, type UseMutationOptions } from '@tanstack/react-query';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import type { CoreStart } from '@kbn/core/public';
import { POST_SIEM_READINESS_TASK_API_PATH } from './constants';
import type { SiemReadinessTask } from './types';

/**
* Hook for logging SIEM readiness tasks via API endpoint
* @param options - TanStack mutation options
* @returns Mutation hook for logging readiness tasks
*/
export const useLogReadinessTask = (
options?: UseMutationOptions<void, unknown, SiemReadinessTask>
) => {
const { http } = useKibana<CoreStart>().services;

const { mutate: logReadinessTask } = useMutation<void, unknown, SiemReadinessTask>(
(task: SiemReadinessTask) =>
http.post<void>(POST_SIEM_READINESS_TASK_API_PATH, {
body: JSON.stringify(task),
}),
options
);

return {
logReadinessTask,
};
};
21 changes: 21 additions & 0 deletions x-pack/solutions/security/packages/siem-readiness/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"jest",
"node",
]
},
"include": [
"**/*.ts",
"**/*.tsx",
],
"exclude": [
"target/**/*"
],
"kbn_references": [
"@kbn/kibana-react-plugin",
"@kbn/core",
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* 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.
*/

export const POST_SIEM_READINESS_TASK_API_PATH = '/api/siem_readiness/post_task';
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export const EXCEPTION_LIST_DETAIL_PATH = `${EXCEPTIONS_PATH}/details/:detailNam
export const HOSTS_PATH = '/hosts' as const;
export const ATTACK_DISCOVERY_PATH = '/attack_discovery' as const;
export const ASSET_INVENTORY_PATH = '/asset_inventory' as const;
export const SIEM_READINESS_PATH = '/siem_readiness' as const;
export const USERS_PATH = '/users' as const;
export const KUBERNETES_PATH = '/kubernetes' as const;
export const NETWORK_PATH = '/network' as const;
Expand Down Expand Up @@ -247,6 +248,9 @@ export const ENABLE_ASSET_INVENTORY_SETTING = 'securitySolution:enableAssetInven
/** This Kibana Advanced Setting allows users to enable/disable the Cloud Connector Feature */
export const ENABLE_CLOUD_CONNECTOR_SETTING = 'securitySolution:enableCloudConnector' as const;

/** This Kibana Advanced Setting allows users to enable/disable the SIEM Readiness Feature */
export const ENABLE_SIEM_READINESS_SETTING = 'securitySolution:enableSiemReadiness' as const;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this be imported from the management package?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

let me know if i should move this, i've followed the pattern of other advanced settings from security solution as can be seen in this file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm just curious why its defined in two different places. Its not a huge deal but I am trying to understand before delivering my approval.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thank you for noticing its being defined twice. indeed the other const in the management package ended up not being used at the end. i will remove it and only leave this one. thank you for catching this


/** This Kibana Advanced Setting allows users to enable/disable the privilged user monitoring feature */
export const ENABLE_PRIVILEGED_USER_MONITORING_SETTING =
'securitySolution:enablePrivilegedUserMonitoring' as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ export const allowedExperimentalValues = Object.freeze({
* Enables the ability to import and migration dashboards through automatic migration service
*/
automaticDashboardsMigration: false,

/**
* Enables the SIEM Readiness Dashboard feature
*/
siemReadinessDashboard: false,
});

type ExperimentalConfigKeys = Array<keyof ExperimentalFeatures>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { aiValueLinks } from '../../reports/links';
import { configurationsLinks } from '../../configurations/links';
import { links as attackDiscoveryLinks } from '../../attack_discovery/links';
import { links as assetInventoryLinks } from '../../asset_inventory/links';
import { siemReadinessLinks } from '../../siem_readiness/links';
import type { AppLinkItems } from '../../common/links/types';
import { indicatorsLinks } from '../../threat_intelligence/links';
import { alertsLink, alertSummaryLink } from '../../detections/links';
Expand Down Expand Up @@ -41,6 +42,7 @@ export const appLinks: AppLinkItems = Object.freeze([
rulesLinks,
onboardingLinks,
managementLinks,
siemReadinessLinks,
]);

export const getFilteredLinks = async (
Expand All @@ -66,5 +68,6 @@ export const getFilteredLinks = async (
rulesLinks,
onboardingLinks,
managementFilteredLinks,
siemReadinessLinks,
]);
};
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ export const INVENTORY = i18n.translate('xpack.securitySolution.navigation.inven
defaultMessage: 'Inventory',
});

export const SIEM_READINESS = i18n.translate('xpack.securitySolution.navigation.siemReadiness', {
defaultMessage: 'SIEM Readiness',
});

export const TIMELINES = i18n.translate('xpack.securitySolution.navigation.timelines', {
defaultMessage: 'Timelines',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ export const CATEGORIES: SeparatorLinkCategory[] = [
type: LinkCategoryType.separator,
linkIds: [SecurityPageName.assetInventory],
},
{
type: LinkCategoryType.separator,
linkIds: [SecurityPageName.siemReadiness],
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { ThreatIntelligence } from './threat_intelligence';
import { Dashboards } from './dashboards';
import { EntityAnalytics } from './entity_analytics';
import { SiemMigrations } from './siem_migrations';
import { SiemReadiness } from './siem_readiness';
import { Configurations } from './configurations';

/**
Expand All @@ -50,6 +51,7 @@ const subPluginClasses = {
EntityAnalytics,
Configurations,
SiemMigrations,
SiemReadiness,
Reports,
};
export { subPluginClasses };
Loading