Skip to content

Commit fbb0ffd

Browse files
Merge branch 'main' into versioning-transforms-apis
2 parents 514cfe9 + 3b8e067 commit fbb0ffd

File tree

70 files changed

+1496
-323
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1496
-323
lines changed

x-pack/plugins/fleet/common/constants/epm.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const FLEET_APM_PACKAGE = 'apm';
1717
export const FLEET_SYNTHETICS_PACKAGE = 'synthetics';
1818
export const FLEET_KUBERNETES_PACKAGE = 'kubernetes';
1919
export const FLEET_UNIVERSAL_PROFILING_SYMBOLIZER_PACKAGE = 'profiler_symbolizer';
20+
export const FLEET_UNIVERSAL_PROFILING_COLLECTOR_PACKAGE = 'profiler_collector';
2021
export const FLEET_CLOUD_SECURITY_POSTURE_PACKAGE = 'cloud_security_posture';
2122
export const FLEET_CLOUD_SECURITY_POSTURE_KSPM_POLICY_TEMPLATE = 'kspm';
2223
export const FLEET_CLOUD_SECURITY_POSTURE_CSPM_POLICY_TEMPLATE = 'cspm';

x-pack/plugins/fleet/server/services/agent_policies/package_policies_to_agent_permissions.test.ts

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,56 @@ packageInfoCache.set('profiler_symbolizer-8.8.0-preview', {
188188
},
189189
},
190190
});
191+
packageInfoCache.set('profiler_collector-8.9.0-preview', {
192+
format_version: '2.7.0',
193+
name: 'profiler_collector',
194+
title: 'Universal Profiling Collector',
195+
version: '8.9.0-preview',
196+
license: 'basic',
197+
description:
198+
'Fleet-wide, whole-system, continuous profiling with zero instrumentation. Collect profiling data.',
199+
type: 'integration',
200+
release: 'beta',
201+
categories: ['monitoring', 'elastic_stack'],
202+
icons: [
203+
{
204+
src: '/img/logo_profiling_symbolizer.svg',
205+
title: 'logo symbolizer',
206+
size: '32x32',
207+
type: 'image/svg+xml',
208+
},
209+
],
210+
owner: { github: 'elastic/profiling' },
211+
data_streams: [],
212+
latestVersion: '8.9.0-preview',
213+
notice: undefined,
214+
status: 'not_installed',
215+
assets: {
216+
kibana: {
217+
csp_rule_template: [],
218+
dashboard: [],
219+
visualization: [],
220+
search: [],
221+
index_pattern: [],
222+
map: [],
223+
lens: [],
224+
security_rule: [],
225+
ml_module: [],
226+
tag: [],
227+
osquery_pack_asset: [],
228+
osquery_saved_query: [],
229+
},
230+
elasticsearch: {
231+
component_template: [],
232+
ingest_pipeline: [],
233+
ilm_policy: [],
234+
transform: [],
235+
index_template: [],
236+
data_stream_ilm_policy: [],
237+
ml_model: [],
238+
},
239+
},
240+
});
191241

192242
describe('storedPackagePoliciesToAgentPermissions()', () => {
193243
it('Returns `undefined` if there are no package policies', async () => {
@@ -444,6 +494,46 @@ describe('storedPackagePoliciesToAgentPermissions()', () => {
444494
packagePolicies
445495
);
446496

497+
expect(permissions).toMatchObject({
498+
'package-policy-uuid-test-123': {
499+
indices: [
500+
{
501+
names: ['profiling-*'],
502+
privileges: UNIVERSAL_PROFILING_PERMISSIONS,
503+
},
504+
],
505+
},
506+
});
507+
});
508+
it('Returns the Universal Profiling permissions for profiler_collector package', async () => {
509+
const packagePolicies: PackagePolicy[] = [
510+
{
511+
id: 'package-policy-uuid-test-123',
512+
name: 'test-policy',
513+
namespace: '',
514+
enabled: true,
515+
package: { name: 'profiler_collector', version: '8.9.0-preview', title: 'Test Package' },
516+
inputs: [
517+
{
518+
type: 'pf-elastic-collector',
519+
enabled: true,
520+
streams: [],
521+
},
522+
],
523+
created_at: '',
524+
updated_at: '',
525+
created_by: '',
526+
updated_by: '',
527+
revision: 1,
528+
policy_id: '',
529+
},
530+
];
531+
532+
const permissions = await storedPackagePoliciesToAgentPermissions(
533+
packageInfoCache,
534+
packagePolicies
535+
);
536+
447537
expect(permissions).toMatchObject({
448538
'package-policy-uuid-test-123': {
449539
indices: [

x-pack/plugins/fleet/server/services/agent_policies/package_policies_to_agent_permissions.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
* 2.0.
66
*/
77

8-
import { FLEET_UNIVERSAL_PROFILING_SYMBOLIZER_PACKAGE } from '../../../common/constants';
8+
import {
9+
FLEET_UNIVERSAL_PROFILING_COLLECTOR_PACKAGE,
10+
FLEET_UNIVERSAL_PROFILING_SYMBOLIZER_PACKAGE,
11+
} from '../../../common/constants';
912

1013
import { getNormalizedDataStreams } from '../../../common/services';
1114

@@ -56,7 +59,10 @@ export async function storedPackagePoliciesToAgentPermissions(
5659

5760
// Special handling for Universal Profiling packages, as it does not use data streams _only_,
5861
// but also indices that do not adhere to the convention.
59-
if (pkg.name === FLEET_UNIVERSAL_PROFILING_SYMBOLIZER_PACKAGE) {
62+
if (
63+
pkg.name === FLEET_UNIVERSAL_PROFILING_SYMBOLIZER_PACKAGE ||
64+
pkg.name === FLEET_UNIVERSAL_PROFILING_COLLECTOR_PACKAGE
65+
) {
6066
return Promise.resolve(universalProfilingPermissions(packagePolicy.id));
6167
}
6268

x-pack/plugins/osquery/common/constants.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ export const DEFAULT_MAX_TABLE_QUERY_SIZE = 10000;
99
export const DEFAULT_DARK_MODE = 'theme:darkMode';
1010
export const OSQUERY_INTEGRATION_NAME = 'osquery_manager';
1111
export const BASE_PATH = '/app/osquery';
12-
export const ACTIONS_INDEX = `.logs-${OSQUERY_INTEGRATION_NAME}.actions`;
12+
13+
export const OSQUERY_LOGS_BASE = `.logs-${OSQUERY_INTEGRATION_NAME}`;
14+
export const ACTIONS_INDEX = `${OSQUERY_LOGS_BASE}.actions`;
15+
export const RESULTS_INDEX = `${OSQUERY_LOGS_BASE}.results`;
16+
export const OSQUERY_ACTIONS_INDEX = `${ACTIONS_INDEX}-*`;
17+
1318
export const ACTION_RESPONSES_INDEX = `.logs-${OSQUERY_INTEGRATION_NAME}.action.responses`;
1419

1520
export const DEFAULT_PLATFORM = 'linux,windows,darwin';
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
export interface LogsOsqueryAction {
9+
'@timestamp': string;
10+
action_id: string;
11+
alert_ids: string[];
12+
expiration: string;
13+
input_type: 'osquery';
14+
queries: Array<{
15+
action_id: string;
16+
id: string;
17+
query: string;
18+
agents: string[];
19+
ecs_mapping?: unknown;
20+
version?: string;
21+
platform?: string;
22+
saved_query_id?: string;
23+
expiration?: string;
24+
}>;
25+
type: 'INPUT_ACTION';
26+
}

x-pack/plugins/osquery/public/plugin.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { Storage } from '@kbn/kibana-utils-plugin/public';
1717
import { useAllLiveQueries } from './actions/use_all_live_queries';
1818
import { getLazyOsqueryResponseActionTypeForm } from './shared_components/lazy_osquery_action_params_form';
1919
import { useFetchStatus } from './fleet_integration/use_fetch_status';
20+
import { getLazyOsqueryResult } from './shared_components/lazy_osquery_result';
2021
import { getLazyOsqueryResults } from './shared_components/lazy_osquery_results';
2122
import type {
2223
OsqueryPluginSetup,
@@ -122,6 +123,12 @@ export class OsqueryPlugin implements Plugin<OsqueryPluginSetup, OsqueryPluginSt
122123
...core,
123124
...plugins,
124125
}),
126+
OsqueryResult: getLazyOsqueryResult({
127+
...core,
128+
...plugins,
129+
storage: this.storage,
130+
kibanaVersion: this.kibanaVersion,
131+
}),
125132
OsqueryResults: getLazyOsqueryResults({
126133
...core,
127134
...plugins,
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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 React from 'react';
9+
import { EuiCode, EuiEmptyPrompt } from '@elastic/eui';
10+
import { FormattedMessage } from '@kbn/i18n-react';
11+
import { PERMISSION_DENIED } from '../../shared_components/osquery_action/translations';
12+
13+
const EmptyPromptComponent = () => (
14+
<EuiEmptyPrompt
15+
iconType="logoOsquery"
16+
title={<h2>{PERMISSION_DENIED}</h2>}
17+
titleSize="xs"
18+
body={
19+
<FormattedMessage
20+
id="xpack.osquery.results.permissionDenied"
21+
defaultMessage="To access these results, ask your administrator for {osquery} Kibana
22+
privileges."
23+
// eslint-disable-next-line react-perf/jsx-no-new-object-as-prop
24+
values={{
25+
osquery: <EuiCode>osquery</EuiCode>,
26+
}}
27+
/>
28+
}
29+
/>
30+
);
31+
32+
export const EmptyPrompt = React.memo(EmptyPromptComponent);

x-pack/plugins/osquery/public/shared_components/attachments/lazy_external_reference_content.tsx

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@
66
*/
77

88
import React, { lazy, Suspense } from 'react';
9-
import { EuiCode, EuiEmptyPrompt } from '@elastic/eui';
10-
import { FormattedMessage } from '@kbn/i18n-react';
11-
import { OsqueryIcon } from '../../components/osquery_icon';
129
import { useKibana } from '../../common/lib/kibana';
1310
import type { ServicesWrapperProps } from '../services_wrapper';
1411
import ServicesWrapper from '../services_wrapper';
15-
import { PERMISSION_DENIED } from '../osquery_action/translations';
12+
import { EmptyPrompt } from '../../routes/components/empty_prompt';
1613

1714
export interface IExternalReferenceMetaDataProps {
1815
externalReferenceMetadata: {
@@ -35,24 +32,7 @@ export const getLazyExternalContent =
3532
} = useKibana();
3633

3734
if (!osquery.read) {
38-
return (
39-
<EuiEmptyPrompt
40-
icon={<OsqueryIcon />}
41-
title={<h2>{PERMISSION_DENIED}</h2>}
42-
titleSize="xs"
43-
body={
44-
<FormattedMessage
45-
id="xpack.osquery.cases.permissionDenied"
46-
defaultMessage=" To access these results, ask your administrator for {osquery} Kibana
47-
privileges."
48-
// eslint-disable-next-line react-perf/jsx-no-new-object-as-prop
49-
values={{
50-
osquery: <EuiCode>osquery</EuiCode>,
51-
}}
52-
/>
53-
}
54-
/>
55-
);
35+
return <EmptyPrompt />;
5636
}
5737

5838
return (

x-pack/plugins/osquery/public/shared_components/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* 2.0.
66
*/
77

8+
export { getLazyOsqueryResult } from './lazy_osquery_result';
89
export { getLazyOsqueryResults } from './lazy_osquery_results';
910
export { getLazyOsqueryAction } from './lazy_osquery_action';
1011
export { getLazyLiveQueryField } from './lazy_live_query_field';
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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 React, { lazy, Suspense } from 'react';
9+
import type { OsqueryActionResultProps } from './osquery_results/types';
10+
import type { StartServices } from '../types';
11+
12+
interface BigServices extends StartServices {
13+
kibanaVersion: string;
14+
storage: unknown;
15+
}
16+
17+
const OsqueryResult = lazy(() => import('./osquery_results/osquery_result_wrapper'));
18+
19+
export const getLazyOsqueryResult =
20+
// eslint-disable-next-line react/display-name
21+
(services: BigServices) => (props: OsqueryActionResultProps) =>
22+
(
23+
<Suspense fallback={null}>
24+
<OsqueryResult services={services} {...props} />
25+
</Suspense>
26+
);

0 commit comments

Comments
 (0)