From cdfa465faa812894579cbeb957cebca2fcc54ce5 Mon Sep 17 00:00:00 2001
From: Jen Huang
Date: Fri, 10 May 2024 10:12:16 -0700
Subject: [PATCH 01/25] [UII] Add unprivileged vs privileged agent count to
Fleet UI (#183077)
## Summary
Resolves https://github.com/elastic/ingest-dev/issues/3249
This PR:
- Adds `unprivileged_agents: number` to agent policy object(s) returned
by agent policy list, get, and bulk get APIs
- Adds breakdown of Unprivileged vs Privileged vs total agent count to
agent policy table and agent policy details header
- Removes Description column from agent policy table and adds the
description below agent policy name
- Adds `Privilege mode` to agent details page


#### Testing
To load unprivileged agents, run them in docker. Local agents or agents
running in VM will be privileged.
### Checklist
Delete any items that are not applicable to this PR.
- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
---
.../plugins/fleet/common/constants/agent.ts | 5 +
.../plugins/fleet/common/openapi/bundled.json | 3 +
.../plugins/fleet/common/openapi/bundled.yaml | 2 +
.../components/schemas/agent_policy.yaml | 2 +
.../fleet/common/types/models/agent_policy.ts | 1 +
.../common/types/rest_spec/agent_policy.ts | 2 +-
.../header/right_content.stories.tsx | 12 -
.../components/header/right_content.tsx | 247 +++++++++---------
.../agent_policy/details_page/index.tsx | 22 +-
.../sections/agent_policy/list_page/index.tsx | 78 ++++--
.../agent_details/agent_details_overview.tsx | 17 ++
.../public/components/link_and_revision.tsx | 95 ++++---
.../public/components/linked_agent_count.tsx | 17 +-
.../plugins/fleet/public/constants/index.ts | 2 +
.../plugins/fleet/server/constants/index.ts | 2 +
.../server/routes/agent_policy/handlers.ts | 16 +-
.../translations/translations/fr-FR.json | 1 -
.../translations/translations/ja-JP.json | 1 -
.../translations/translations/zh-CN.json | 1 -
.../__snapshots__/agent_policy.snap | 48 ++++
.../apis/agent_policy/agent_policy.ts | 21 +-
21 files changed, 376 insertions(+), 219 deletions(-)
create mode 100644 x-pack/test/fleet_api_integration/apis/agent_policy/__snapshots__/agent_policy.snap
diff --git a/x-pack/plugins/fleet/common/constants/agent.ts b/x-pack/plugins/fleet/common/constants/agent.ts
index 251db5db24806..cf1e97090804e 100644
--- a/x-pack/plugins/fleet/common/constants/agent.ts
+++ b/x-pack/plugins/fleet/common/constants/agent.ts
@@ -47,3 +47,8 @@ export const AgentStatuses = [
'updating',
'degraded',
] as const;
+
+// Kueries for finding unprivileged and privileged agents
+// Privileged is `not` because the metadata field can be undefined
+export const UNPRIVILEGED_AGENT_KUERY = `${AGENTS_PREFIX}.local_metadata.elastic.agent.unprivileged: true`;
+export const PRIVILEGED_AGENT_KUERY = `not ${AGENTS_PREFIX}.local_metadata.elastic.agent.unprivileged: true`;
diff --git a/x-pack/plugins/fleet/common/openapi/bundled.json b/x-pack/plugins/fleet/common/openapi/bundled.json
index 38647d8218941..f9ebd7d84653a 100644
--- a/x-pack/plugins/fleet/common/openapi/bundled.json
+++ b/x-pack/plugins/fleet/common/openapi/bundled.json
@@ -7571,6 +7571,9 @@
"agents": {
"type": "number"
},
+ "unprivileged_agents": {
+ "type": "number"
+ },
"agent_features": {
"type": "array",
"items": {
diff --git a/x-pack/plugins/fleet/common/openapi/bundled.yaml b/x-pack/plugins/fleet/common/openapi/bundled.yaml
index 5b1cb40243649..3bf9514e08147 100644
--- a/x-pack/plugins/fleet/common/openapi/bundled.yaml
+++ b/x-pack/plugins/fleet/common/openapi/bundled.yaml
@@ -4864,6 +4864,8 @@ components:
type: number
agents:
type: number
+ unprivileged_agents:
+ type: number
agent_features:
type: array
items:
diff --git a/x-pack/plugins/fleet/common/openapi/components/schemas/agent_policy.yaml b/x-pack/plugins/fleet/common/openapi/components/schemas/agent_policy.yaml
index 633e4e4ba89b8..02f302e025d67 100644
--- a/x-pack/plugins/fleet/common/openapi/components/schemas/agent_policy.yaml
+++ b/x-pack/plugins/fleet/common/openapi/components/schemas/agent_policy.yaml
@@ -50,6 +50,8 @@ properties:
type: number
agents:
type: number
+ unprivileged_agents:
+ type: number
agent_features:
type: array
items:
diff --git a/x-pack/plugins/fleet/common/types/models/agent_policy.ts b/x-pack/plugins/fleet/common/types/models/agent_policy.ts
index a67293ebdecaa..9bae6421050de 100644
--- a/x-pack/plugins/fleet/common/types/models/agent_policy.ts
+++ b/x-pack/plugins/fleet/common/types/models/agent_policy.ts
@@ -54,6 +54,7 @@ export interface AgentPolicy extends Omit {
updated_by: string;
revision: number;
agents?: number;
+ unprivileged_agents?: number;
is_protected: boolean;
}
diff --git a/x-pack/plugins/fleet/common/types/rest_spec/agent_policy.ts b/x-pack/plugins/fleet/common/types/rest_spec/agent_policy.ts
index 9b89e194a1047..3b35e986a5d55 100644
--- a/x-pack/plugins/fleet/common/types/rest_spec/agent_policy.ts
+++ b/x-pack/plugins/fleet/common/types/rest_spec/agent_policy.ts
@@ -16,7 +16,7 @@ export interface GetAgentPoliciesRequest {
};
}
-export type GetAgentPoliciesResponseItem = AgentPolicy & { agents?: number };
+export type GetAgentPoliciesResponseItem = AgentPolicy;
export type BulkGetAgentPoliciesResponse = BulkGetResult;
export type GetAgentPoliciesResponse = ListResult;
diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/header/right_content.stories.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/header/right_content.stories.tsx
index d59b00abc311f..c39b3dfdd0470 100644
--- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/header/right_content.stories.tsx
+++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/header/right_content.stories.tsx
@@ -18,7 +18,6 @@ export const HeaderRightContent = () => {
return (
{}}
isAddAgentHelpPopoverOpen={false}
@@ -31,11 +30,6 @@ export const HeaderRightContent = () => {
package_policies: ['test1', 'test2'],
} as any
}
- agentStatus={
- {
- total: 0,
- } as any
- }
/>
);
@@ -45,7 +39,6 @@ export const HeaderRightContentWithManagedPolicy = () => {
return (
{}}
isAddAgentHelpPopoverOpen={false}
@@ -59,11 +52,6 @@ export const HeaderRightContentWithManagedPolicy = () => {
is_managed: true,
} as any
}
- agentStatus={
- {
- total: 0,
- } as any
- }
/>
);
diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/header/right_content.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/header/right_content.tsx
index cfbf4d79eea9a..743dd5186d3b5 100644
--- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/header/right_content.tsx
+++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/header/right_content.tsx
@@ -18,19 +18,18 @@ import {
EuiDescriptionListTitle,
EuiDescriptionListDescription,
EuiLink,
+ EuiToolTip,
} from '@elastic/eui';
import { useAuthz, useLink } from '../../../../../hooks';
-import type { AgentPolicy, GetAgentStatusResponse } from '../../../../../types';
+import type { AgentPolicy } from '../../../../../types';
import { AgentPolicyActionMenu, LinkedAgentCount } from '../../../components';
import { AddAgentHelpPopover } from '../../../../../components';
import { FLEET_SERVER_PACKAGE } from '../../../../../../../../common/constants';
export interface HeaderRightContentProps {
isLoading: boolean;
- policyId: string;
agentPolicy?: AgentPolicy | null;
- agentStatus?: GetAgentStatusResponse['results'];
addAgent: () => void;
onCancelEnrollment?: () => void;
isAddAgentHelpPopoverOpen: boolean;
@@ -45,9 +44,7 @@ const Divider = styled.div`
export const HeaderRightContent: React.FunctionComponent = ({
isLoading,
- policyId,
agentPolicy,
- agentStatus,
addAgent,
onCancelEnrollment,
isAddAgentHelpPopoverOpen,
@@ -86,118 +83,134 @@ export const HeaderRightContent: React.FunctionComponent
- {[
- {
- label: i18n.translate('xpack.fleet.policyDetails.summary.revision', {
- defaultMessage: 'Revision',
- }),
- content: agentPolicy?.revision ?? 0,
- },
- { isDivider: true },
- {
- label: i18n.translate('xpack.fleet.policyDetails.summary.integrations', {
- defaultMessage: 'Integrations',
- }),
- content: (
-
- ),
- },
- { isDivider: true },
- ...(authz.fleet.readAgents
- ? [
- {
- label: i18n.translate('xpack.fleet.policyDetails.summary.usedBy', {
- defaultMessage: 'Agents',
- }),
- content:
- agentStatus && agentStatus!.total ? (
-
- ) : isFleetServerPolicy && authz.fleet.addFleetServers ? (
- {
- setIsAddAgentHelpPopoverOpen(false);
- }}
- />
- ) : !isFleetServerPolicy && authz.fleet.addAgents ? (
- {
- setIsAddAgentHelpPopoverOpen(false);
- }}
- />
- ) : (
-
- ),
- },
- { isDivider: true },
- ]
- : []),
- {
- label: i18n.translate('xpack.fleet.policyDetails.summary.lastUpdated', {
- defaultMessage: 'Last updated on',
- }),
- content:
- (agentPolicy && (
-
- )) ||
- '',
- },
- { isDivider: true },
- {
- content: agentPolicy && (
- {
- history.push(getPath('policy_details', { policyId: newAgentPolicy.id }));
- }}
- onCancelEnrollment={onCancelEnrollment}
- />
- ),
- },
- ].map((item, index) => (
-
- {item.isDivider ?? false ? (
-
- ) : item.label ? (
-
-
- {item.label}
-
-
- {item.content}
-
-
- ) : (
- item.content
- )}
-
- ))}
+ {isLoading || !agentPolicy
+ ? null
+ : [
+ {
+ label: i18n.translate('xpack.fleet.policyDetails.summary.revision', {
+ defaultMessage: 'Revision',
+ }),
+ content: agentPolicy.revision ?? 0,
+ },
+ { isDivider: true },
+ {
+ label: i18n.translate('xpack.fleet.policyDetails.summary.integrations', {
+ defaultMessage: 'Integrations',
+ }),
+ content: (
+
+ ),
+ },
+ { isDivider: true },
+ ...(authz.fleet.readAgents
+ ? [
+ {
+ label: i18n.translate('xpack.fleet.policyDetails.summary.usedBy', {
+ defaultMessage: 'Agents',
+ }),
+ content:
+ !agentPolicy.agents && isFleetServerPolicy && authz.fleet.addFleetServers ? (
+ {
+ setIsAddAgentHelpPopoverOpen(false);
+ }}
+ />
+ ) : !agentPolicy.agents && !isFleetServerPolicy && authz.fleet.addAgents ? (
+ {
+ setIsAddAgentHelpPopoverOpen(false);
+ }}
+ />
+ ) : (
+
+
+
+
+
+
+
+
+ }
+ >
+
+
+ ),
+ },
+ { isDivider: true },
+ ]
+ : []),
+ {
+ label: i18n.translate('xpack.fleet.policyDetails.summary.lastUpdated', {
+ defaultMessage: 'Last updated on',
+ }),
+ content:
+ (agentPolicy && (
+
+ )) ||
+ '',
+ },
+ { isDivider: true },
+ {
+ content: agentPolicy && (
+ {
+ history.push(getPath('policy_details', { policyId: newAgentPolicy.id }));
+ }}
+ onCancelEnrollment={onCancelEnrollment}
+ />
+ ),
+ },
+ ].map((item, index) => (
+
+ {item.isDivider ?? false ? (
+
+ ) : item.label ? (
+
+
+ {item.label}
+
+
+ {item.content}
+
+
+ ) : (
+ item.content
+ )}
+
+ ))}
);
};
diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/index.tsx
index 855d6017a79c3..0c92d8064ae8b 100644
--- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/index.tsx
+++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/index.tsx
@@ -28,7 +28,6 @@ import {
import { Loading, Error, AgentEnrollmentFlyout } from '../../../components';
import { WithHeaderLayout } from '../../../layouts';
-import { useGetAgentStatus, AgentStatusRefreshContext } from './hooks';
import {
PackagePoliciesView,
SettingsView,
@@ -55,13 +54,10 @@ export const AgentPolicyDetailsPage: React.FunctionComponent = () => {
openAddAgentHelpPopoverOpenByDefault
);
- const agentStatusRequest = useGetAgentStatus(policyId);
- const { refreshAgentStatus } = agentStatusRequest;
const {
application: { navigateToApp },
} = useStartServices();
const routeState = useIntraAppState();
- const agentStatus = agentStatusRequest.data?.results;
const { isReady: isFleetReady } = useFleetStatus();
@@ -170,8 +166,6 @@ export const AgentPolicyDetailsPage: React.FunctionComponent = () => {
const headerRightContent = (
{
return (
-
-
- {content}
-
-
+
+ {content}
+
);
};
diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.tsx
index cdd804f60d484..b96a2e75ec537 100644
--- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.tsx
+++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.tsx
@@ -15,7 +15,7 @@ import {
EuiEmptyPrompt,
EuiBasicTable,
EuiLink,
- EuiTextColor,
+ EuiToolTip,
} from '@elastic/eui';
import type { CriteriaWithPagination } from '@elastic/eui/src/components/basic_table/basic_table';
import { i18n } from '@kbn/i18n';
@@ -104,21 +104,9 @@ export const AgentPolicyListPage: React.FunctionComponent<{}> = () => {
name: i18n.translate('xpack.fleet.agentPolicyList.nameColumnTitle', {
defaultMessage: 'Name',
}),
- width: '25%',
- render: (name: string, agentPolicy: AgentPolicy) => (
-
- ),
- },
- {
- field: 'description',
- name: i18n.translate('xpack.fleet.agentPolicyList.descriptionColumnTitle', {
- defaultMessage: 'Description',
- }),
width: '35%',
- render: (value: string) => (
-
- {value}
-
+ render: (name: string, agentPolicy: AgentPolicy) => (
+
),
},
{
@@ -134,11 +122,67 @@ export const AgentPolicyListPage: React.FunctionComponent<{}> = () => {
{
field: 'agents',
name: i18n.translate('xpack.fleet.agentPolicyList.agentsColumnTitle', {
- defaultMessage: 'Agents',
+ defaultMessage: 'Unprivileged / Privileged',
}),
dataType: 'number',
render: (agents: number, agentPolicy: AgentPolicy) => (
-
+
+
+
+ }
+ >
+
+
+
+ /
+
+
+ }
+ >
+
+
+
+
+
+ {'('}
+
+ }
+ >
+
+
+ {')'}
+
+
+
),
},
{
diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx
index 44c4138b16650..197d64810c199 100644
--- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx
+++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx
@@ -206,6 +206,23 @@ export const AgentDetailsOverviewSection: React.FunctionComponent<{
? agent.local_metadata.elastic.agent.log_level
: '-',
},
+ {
+ title: i18n.translate('xpack.fleet.agentDetails.privilegeModeLabel', {
+ defaultMessage: 'Privilege mode',
+ }),
+ description:
+ agent.local_metadata.elastic.agent.unprivileged === true ? (
+
+ ) : (
+
+ ),
+ },
{
title: i18n.translate('xpack.fleet.agentDetails.releaseLabel', {
defaultMessage: 'Agent release',
diff --git a/x-pack/plugins/fleet/public/components/link_and_revision.tsx b/x-pack/plugins/fleet/public/components/link_and_revision.tsx
index 00c7e8f76371c..5d0f0070f6668 100644
--- a/x-pack/plugins/fleet/public/components/link_and_revision.tsx
+++ b/x-pack/plugins/fleet/public/components/link_and_revision.tsx
@@ -20,59 +20,74 @@ export const AgentPolicySummaryLine = memo<{
policy: AgentPolicy;
agent?: Agent;
direction?: 'column' | 'row';
-}>(({ policy, agent, direction = 'row' }) => {
+ withDescription?: boolean;
+}>(({ policy, agent, direction = 'row', withDescription = false }) => {
const { getHref } = useLink();
- const { name, id, is_managed: isManaged } = policy;
+ const { name, id, is_managed: isManaged, description } = policy;
const revision = agent ? agent.policy_revision : policy.revision;
return (
-
-
-
+
+
+
-
- {name || id}
-
+
+
+
+ {name || id}
+
+
+
+ {isManaged && (
+
+
+
+ )}
+
- {isManaged && (
+ {revision && (
-
+
+
+
)}
-
- {revision && (
-
-
-
+ {withDescription && description && (
+
+
+ {description}
)}
diff --git a/x-pack/plugins/fleet/public/components/linked_agent_count.tsx b/x-pack/plugins/fleet/public/components/linked_agent_count.tsx
index ce0a21e7759eb..9626e055609e8 100644
--- a/x-pack/plugins/fleet/public/components/linked_agent_count.tsx
+++ b/x-pack/plugins/fleet/public/components/linked_agent_count.tsx
@@ -11,7 +11,7 @@ import type { EuiLinkAnchorProps } from '@elastic/eui';
import { EuiLink } from '@elastic/eui';
import { useLink } from '../hooks';
-import { AGENTS_PREFIX } from '../constants';
+import { AGENTS_PREFIX, UNPRIVILEGED_AGENT_KUERY, PRIVILEGED_AGENT_KUERY } from '../constants';
/**
* Displays the provided `count` number as a link to the Agents list if it is greater than zero
@@ -21,8 +21,9 @@ export const LinkedAgentCount = memo<
count: number;
agentPolicyId: string;
showAgentText?: boolean;
+ privilegeMode?: 'privileged' | 'unprivileged';
}
->(({ count, agentPolicyId, showAgentText, ...otherEuiLinkProps }) => {
+>(({ count, agentPolicyId, showAgentText, privilegeMode, ...otherEuiLinkProps }) => {
const { getHref } = useLink();
const displayValue = showAgentText ? (
0 ? (
-
+
{displayValue}
) : (
diff --git a/x-pack/plugins/fleet/public/constants/index.ts b/x-pack/plugins/fleet/public/constants/index.ts
index c76f74586ba34..ae14fae94627c 100644
--- a/x-pack/plugins/fleet/public/constants/index.ts
+++ b/x-pack/plugins/fleet/public/constants/index.ts
@@ -15,6 +15,8 @@ export {
SO_SEARCH_LIMIT,
AGENT_POLICY_SAVED_OBJECT_TYPE,
AGENTS_PREFIX,
+ UNPRIVILEGED_AGENT_KUERY,
+ PRIVILEGED_AGENT_KUERY,
PACKAGE_POLICY_SAVED_OBJECT_TYPE,
FLEET_SERVER_PACKAGE,
// Fleet Server index
diff --git a/x-pack/plugins/fleet/server/constants/index.ts b/x-pack/plugins/fleet/server/constants/index.ts
index aeb946c22e62f..55ad1f9881a8a 100644
--- a/x-pack/plugins/fleet/server/constants/index.ts
+++ b/x-pack/plugins/fleet/server/constants/index.ts
@@ -16,6 +16,8 @@ export {
AGENT_POLICY_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL,
AGENT_POLICY_ROLLOUT_RATE_LIMIT_INTERVAL_MS,
AGENT_UPDATE_ACTIONS_INTERVAL_MS,
+ UNPRIVILEGED_AGENT_KUERY,
+ PRIVILEGED_AGENT_KUERY,
MAX_TIME_COMPLETE_INSTALL,
// Routes
LIMITED_CONCURRENCY_ROUTE_TAG,
diff --git a/x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts b/x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts
index c4c31214da332..0893d93db9b33 100644
--- a/x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts
+++ b/x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts
@@ -20,7 +20,7 @@ import { HTTPAuthorizationHeader } from '../../../common/http_authorization_head
import { fullAgentPolicyToYaml } from '../../../common/services';
import { appContextService, agentPolicyService } from '../../services';
import { getAgentsByKuery, getLatestAvailableAgentVersion } from '../../services/agents';
-import { AGENTS_PREFIX } from '../../constants';
+import { AGENTS_PREFIX, UNPRIVILEGED_AGENT_KUERY } from '../../constants';
import type {
GetAgentPoliciesRequestSchema,
GetOneAgentPolicyRequestSchema,
@@ -62,13 +62,21 @@ export async function populateAssignedAgentsCount(
) {
await pMap(
agentPolicies,
- (agentPolicy: GetAgentPoliciesResponseItem) =>
- getAgentsByKuery(esClient, soClient, {
+ (agentPolicy: GetAgentPoliciesResponseItem) => {
+ const totalAgents = getAgentsByKuery(esClient, soClient, {
showInactive: false,
perPage: 0,
page: 1,
kuery: `${AGENTS_PREFIX}.policy_id:${agentPolicy.id}`,
- }).then(({ total: agentTotal }) => (agentPolicy.agents = agentTotal)),
+ }).then(({ total }) => (agentPolicy.agents = total));
+ const unprivilegedAgents = getAgentsByKuery(esClient, soClient, {
+ showInactive: false,
+ perPage: 0,
+ page: 1,
+ kuery: `${AGENTS_PREFIX}.policy_id:${agentPolicy.id} and ${UNPRIVILEGED_AGENT_KUERY}`,
+ }).then(({ total }) => (agentPolicy.unprivileged_agents = total));
+ return Promise.all([totalAgents, unprivilegedAgents]);
+ },
{ concurrency: 10 }
);
}
diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json
index 13de72efe1050..3ba5355441908 100644
--- a/x-pack/plugins/translations/translations/fr-FR.json
+++ b/x-pack/plugins/translations/translations/fr-FR.json
@@ -18071,7 +18071,6 @@
"xpack.fleet.agentPolicyList.addButton": "Créer une stratégie d'agent",
"xpack.fleet.agentPolicyList.agentsColumnTitle": "Agents",
"xpack.fleet.agentPolicyList.clearFiltersLinkText": "Effacer les filtres",
- "xpack.fleet.agentPolicyList.descriptionColumnTitle": "Description",
"xpack.fleet.agentPolicyList.loadingAgentPoliciesMessage": "Chargement des stratégies d'agent en cours…",
"xpack.fleet.agentPolicyList.nameColumnTitle": "Nom",
"xpack.fleet.agentPolicyList.noAgentPoliciesPrompt": "Aucune stratégie d'agent",
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index 5d7fd8c925d8c..a67835de14b3f 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -18048,7 +18048,6 @@
"xpack.fleet.agentPolicyList.addButton": "エージェントポリシーを作成",
"xpack.fleet.agentPolicyList.agentsColumnTitle": "エージェント",
"xpack.fleet.agentPolicyList.clearFiltersLinkText": "フィルターを消去",
- "xpack.fleet.agentPolicyList.descriptionColumnTitle": "説明",
"xpack.fleet.agentPolicyList.loadingAgentPoliciesMessage": "エージェントポリシーの読み込み中…",
"xpack.fleet.agentPolicyList.nameColumnTitle": "名前",
"xpack.fleet.agentPolicyList.noAgentPoliciesPrompt": "エージェントポリシーがありません",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index adda160b16fa7..dbc7e3ca3ae84 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -18077,7 +18077,6 @@
"xpack.fleet.agentPolicyList.addButton": "创建代理策略",
"xpack.fleet.agentPolicyList.agentsColumnTitle": "代理",
"xpack.fleet.agentPolicyList.clearFiltersLinkText": "清除筛选",
- "xpack.fleet.agentPolicyList.descriptionColumnTitle": "描述",
"xpack.fleet.agentPolicyList.loadingAgentPoliciesMessage": "正在加载代理策略…...",
"xpack.fleet.agentPolicyList.nameColumnTitle": "名称",
"xpack.fleet.agentPolicyList.noAgentPoliciesPrompt": "无代理策略",
diff --git a/x-pack/test/fleet_api_integration/apis/agent_policy/__snapshots__/agent_policy.snap b/x-pack/test/fleet_api_integration/apis/agent_policy/__snapshots__/agent_policy.snap
new file mode 100644
index 0000000000000..a31d1d0f176e6
--- /dev/null
+++ b/x-pack/test/fleet_api_integration/apis/agent_policy/__snapshots__/agent_policy.snap
@@ -0,0 +1,48 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Agent policies fleet_agent_policies GET /api/fleet/agent_policies should get a list of agent policies by kuery 1`] = `
+Object {
+ "agents": 0,
+ "inactivity_timeout": 1209600,
+ "is_managed": false,
+ "is_protected": false,
+ "name": "TEST",
+ "namespace": "default",
+ "revision": 1,
+ "schema_version": "1.1.1",
+ "status": "active",
+ "unprivileged_agents": 0,
+ "updated_by": "elastic",
+}
+`;
+
+exports[`Agent policies fleet_agent_policies POST /api/fleet/agent_policies/_bulk_get should populate package_policies if called with ?full=true 1`] = `
+Object {
+ "agents": 0,
+ "inactivity_timeout": 1209600,
+ "is_managed": false,
+ "is_protected": false,
+ "name": "Bulk GET test policy",
+ "namespace": "default",
+ "package_policies": Array [
+ Object {
+ "created_by": "elastic",
+ "enabled": true,
+ "name": "system-1",
+ "namespace": "default",
+ "package": Object {
+ "name": "system",
+ "title": "System",
+ "version": "1.56.0",
+ },
+ "revision": 1,
+ "updated_by": "elastic",
+ },
+ ],
+ "revision": 1,
+ "schema_version": "1.1.1",
+ "status": "active",
+ "unprivileged_agents": 0,
+ "updated_by": "elastic",
+}
+`;
diff --git a/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy.ts b/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy.ts
index 69ff7a03822b2..5c64bec5623c7 100644
--- a/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy.ts
+++ b/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy.ts
@@ -58,11 +58,13 @@ export default function (providerContext: FtrProviderContext) {
namespace: 'default',
})
.expect(200);
- const { body: responseBody } = await supertest
+ const { body } = await supertest
.get(`/api/fleet/agent_policies?kuery=ingest-agent-policies.name:TEST`)
.set('kbn-xsrf', 'xxxx')
.expect(200);
- expect(responseBody.items.length).to.eql(1);
+ expect(body.items.length).to.eql(1);
+ const { id, updated_at: updatedAt, ...rest } = body.items[0];
+ expectSnapshot(rest).toMatch();
});
it('should return 200 even if the passed kuery does not have prefix ingest-agent-policies', async () => {
@@ -1343,6 +1345,21 @@ export default function (providerContext: FtrProviderContext) {
expect(items[0].package_policies.length).equal(1);
expect(items[0].package_policies[0]).to.have.property('package');
expect(items[0].package_policies[0].package.name).equal('system');
+ const { package_policies: packagePolicies, id, updated_at: updatedAt, ...rest } = items[0];
+ expectSnapshot({
+ ...rest,
+ package_policies: packagePolicies.map(
+ ({
+ inputs,
+ id: ppId,
+ policy_id: ppPolicyId,
+ created_at: ppcreatedAt,
+ updated_at: ppupdatedAt,
+ version,
+ ...ppRest
+ }: any) => ppRest
+ ),
+ }).toMatch();
});
it('should return a 404 with invalid ids', async () => {
From fef94d7d341d9974dd4ca02c34ac15ff6056a18e Mon Sep 17 00:00:00 2001
From: Nick Peihl
Date: Fri, 10 May 2024 13:28:06 -0400
Subject: [PATCH 02/25] Revert "skip flaky suite (#183061)" (#183147)
This reverts commit f487d3e346f7c7f116093faeae7f665628122848.
Fixes #183061
## Summary
Tests were failing due to a transient service interruption in Elastic
Maps Service. The service was restored after a couple of minutes, so we
should be able to re-enable these tests.
---
.../import_saved_objects_between_versions.ts | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/x-pack/test/functional/apps/saved_objects_management/import_saved_objects_between_versions.ts b/x-pack/test/functional/apps/saved_objects_management/import_saved_objects_between_versions.ts
index 4c119574f2629..b6f1e94e83af3 100644
--- a/x-pack/test/functional/apps/saved_objects_management/import_saved_objects_between_versions.ts
+++ b/x-pack/test/functional/apps/saved_objects_management/import_saved_objects_between_versions.ts
@@ -25,8 +25,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
]);
const renderService = getService('renderable');
- // FLAKY: https://github.com/elastic/kibana/issues/183061
- describe.skip('Export import saved objects between versions', function () {
+ describe('Export import saved objects between versions', function () {
before(async function () {
await kibanaServer.savedObjects.cleanStandardList();
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
From e5ff8743d1c0072bea90390ed7b2cedf8ddc4773 Mon Sep 17 00:00:00 2001
From: Nick Peihl
Date: Fri, 10 May 2024 13:29:59 -0400
Subject: [PATCH 03/25] Canvas add from library react embeddables (#183089)
Fixes #182619
Add support for React embeddables in the Canvas Add from Library flyout.
I tested this against the [React Map embeddable
PR](https://github.com/elastic/kibana/pull/178158).
---
src/plugins/embeddable/public/index.ts | 2 +
.../renderers/embeddable/embeddable.tsx | 42 +++++----
.../embeddable_flyout/flyout.component.tsx | 94 +++++++++++++++----
3 files changed, 104 insertions(+), 34 deletions(-)
diff --git a/src/plugins/embeddable/public/index.ts b/src/plugins/embeddable/public/index.ts
index 0b2b3d81b2829..93f98dbf29eae 100644
--- a/src/plugins/embeddable/public/index.ts
+++ b/src/plugins/embeddable/public/index.ts
@@ -25,6 +25,7 @@ export {
EmbeddableStateTransfer,
ErrorEmbeddable,
genericEmbeddableInputIsEqual,
+ getReactEmbeddableSavedObjects,
isContextMenuTriggerContext,
isEmbeddable,
isErrorEmbeddable,
@@ -79,6 +80,7 @@ export type {
PanelState,
PropertySpec,
RangeSelectContext,
+ ReactEmbeddableSavedObject,
ReferenceOrValueEmbeddable,
SavedObjectEmbeddableInput,
SelfStyledEmbeddable,
diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx b/x-pack/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx
index 3acdbf039a9f7..696243680782b 100644
--- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx
+++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx
@@ -46,30 +46,39 @@ const renderReactEmbeddable = ({
input,
container,
handlers,
+ core,
}: {
type: string;
uuid: string;
input: EmbeddableInput;
container: CanvasContainerApi;
handlers: RendererHandlers;
+ core: CoreStart;
}) => {
return (
- {
- const newExpression = embeddableInputToExpression(
- newState.rawState as unknown as EmbeddableInput,
- type,
- undefined,
- true
- );
- if (newExpression) handlers.onEmbeddableInputChange(newExpression);
- }}
- />
+
+
+ {
+ const newExpression = embeddableInputToExpression(
+ newState.rawState as unknown as EmbeddableInput,
+ type,
+ undefined,
+ true
+ );
+ if (newExpression) handlers.onEmbeddableInputChange(newExpression);
+ }}
+ />
+
+
);
};
@@ -138,6 +147,7 @@ export const embeddableRendererFactory = (
uuid: uniqueId,
type: embeddableType,
container: canvasApi,
+ core,
}),
domNode,
() => handlers.done()
diff --git a/x-pack/plugins/canvas/public/components/embeddable_flyout/flyout.component.tsx b/x-pack/plugins/canvas/public/components/embeddable_flyout/flyout.component.tsx
index 87a575ee44b12..0ce1bd6702b66 100644
--- a/x-pack/plugins/canvas/public/components/embeddable_flyout/flyout.component.tsx
+++ b/x-pack/plugins/canvas/public/components/embeddable_flyout/flyout.component.tsx
@@ -5,11 +5,17 @@
* 2.0.
*/
-import React, { FC, useCallback } from 'react';
+import React, { FC, useCallback, useMemo } from 'react';
import { EuiFlyout, EuiFlyoutHeader, EuiFlyoutBody, EuiTitle } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { SavedObjectFinder, SavedObjectMetaData } from '@kbn/saved-objects-finder-plugin/public';
+import { FinderAttributes } from '@kbn/saved-objects-finder-plugin/common';
+import {
+ EmbeddableFactory,
+ ReactEmbeddableSavedObject,
+ getReactEmbeddableSavedObjects,
+} from '@kbn/embeddable-plugin/public';
import { useEmbeddablesService, usePlatformService } from '../../services';
const strings = {
@@ -22,6 +28,14 @@ const strings = {
defaultMessage: 'Add from library',
}),
};
+
+interface LegacyFactoryMap {
+ [key: string]: EmbeddableFactory;
+}
+interface FactoryMap {
+ [key: string]: ReactEmbeddableSavedObject & { type: string };
+}
+
export interface Props {
onClose: () => void;
onSelect: (id: string, embeddableType: string, isByValueEnabled?: boolean) => void;
@@ -40,8 +54,67 @@ export const AddEmbeddableFlyout: FC = ({
const { getEmbeddableFactories } = embeddablesService;
const { getContentManagement, getUISettings } = platformService;
+ const legacyFactoriesBySavedObjectType: LegacyFactoryMap = useMemo(() => {
+ return [...getEmbeddableFactories()]
+ .filter(
+ (embeddableFactory) =>
+ Boolean(embeddableFactory.savedObjectMetaData?.type) && !embeddableFactory.isContainerType
+ )
+ .reduce((acc, factory) => {
+ acc[factory.savedObjectMetaData!.type] = factory;
+ return acc;
+ }, {} as LegacyFactoryMap);
+ }, [getEmbeddableFactories]);
+
+ const factoriesBySavedObjectType: FactoryMap = useMemo(() => {
+ return [...getReactEmbeddableSavedObjects()]
+ .filter(([type, embeddableFactory]) => {
+ return Boolean(embeddableFactory.savedObjectMetaData?.type);
+ })
+ .reduce((acc, [type, factory]) => {
+ acc[factory.savedObjectMetaData!.type] = {
+ ...factory,
+ type,
+ };
+ return acc;
+ }, {} as FactoryMap);
+ }, []);
+
+ const metaData = useMemo(
+ () =>
+ [
+ ...Object.values(factoriesBySavedObjectType),
+ ...Object.values(legacyFactoriesBySavedObjectType),
+ ]
+ .filter((factory) =>
+ Boolean(
+ factory.type !== 'links' && // Links panels only exist on Dashboards
+ (isByValueEnabled || availableEmbeddables.includes(factory.type))
+ )
+ )
+ .map((factory) => factory.savedObjectMetaData)
+ .filter>(function (
+ maybeSavedObjectMetaData
+ ): maybeSavedObjectMetaData is SavedObjectMetaData<{}> {
+ return maybeSavedObjectMetaData !== undefined;
+ })
+ .sort((a, b) => a.type.localeCompare(b.type)),
+ [
+ availableEmbeddables,
+ factoriesBySavedObjectType,
+ isByValueEnabled,
+ legacyFactoriesBySavedObjectType,
+ ]
+ );
+
const onAddPanel = useCallback(
(id: string, savedObjectType: string) => {
+ if (factoriesBySavedObjectType[savedObjectType]) {
+ const factory = factoriesBySavedObjectType[savedObjectType];
+ const { type } = factory;
+ onSelect(id, type, isByValueEnabled);
+ return;
+ }
const embeddableFactories = getEmbeddableFactories();
// Find the embeddable type from the saved object type
const found = Array.from(embeddableFactories).find((embeddableFactory) => {
@@ -55,24 +128,9 @@ export const AddEmbeddableFlyout: FC = ({
onSelect(id, foundEmbeddableType, isByValueEnabled);
},
- [isByValueEnabled, getEmbeddableFactories, onSelect]
+ [isByValueEnabled, getEmbeddableFactories, onSelect, factoriesBySavedObjectType]
);
- const embeddableFactories = getEmbeddableFactories();
-
- const availableSavedObjects = Array.from(embeddableFactories)
- .filter(
- (factory) =>
- factory.type !== 'links' && // Links panels only exist on Dashboards
- (isByValueEnabled || availableEmbeddables.includes(factory.type))
- )
- .map((factory) => factory.savedObjectMetaData)
- .filter>(function (
- maybeSavedObjectMetaData
- ): maybeSavedObjectMetaData is SavedObjectMetaData<{}> {
- return maybeSavedObjectMetaData !== undefined;
- });
-
return (
@@ -83,7 +141,7 @@ export const AddEmbeddableFlyout: FC = ({
Date: Fri, 10 May 2024 13:37:19 -0400
Subject: [PATCH 04/25] Support filtering audit log events by user (#183137)
## Summary
Adds a new `xpack.security.audit.ignore_filters.users` configuration
setting. This behaves similar to the existing
`xpack.security.audit.ignore_filters.spaces` configuration setting, in
that it will filter out audit events for any of the specified users.
Resolves #183136
This PR also adds documentation for the existing
`xpack.security.audit.ignore_filters.spaces` setting, as it was
previously missing.
## Testing
1) Configure audit logging, ignoring one or more users of your choosing:
```yml
# kibana.yml
xpack.security.audit:
enabled: true
appender:
type: rolling-file
fileName: ./audit.log
layout:
type: json
ignore_filters:
- users: ["elastic"]
```
2) Start Kibana and ES with a `trial` license.
3) Login as an ignored user
4) Notice the user activity is not present in the audit logs.
5) Login as a non-ignored user
6) Notice the user activity is present in the audit logs.
## Release note:
Audit logs can be filtered by username via the
`xpack.security.audit.ignore_filters.users` configuration setting.
---
docs/settings/security-settings.asciidoc | 14 ++++-
.../server/audit/audit_service.test.ts | 19 +++++++
.../security/server/audit/audit_service.ts | 3 +-
x-pack/plugins/security/server/config.test.ts | 51 +++++++++++++++++++
x-pack/plugins/security/server/config.ts | 3 +-
5 files changed, 86 insertions(+), 4 deletions(-)
diff --git a/docs/settings/security-settings.asciidoc b/docs/settings/security-settings.asciidoc
index b87973d8227cb..94c21486fe9cb 100644
--- a/docs/settings/security-settings.asciidoc
+++ b/docs/settings/security-settings.asciidoc
@@ -367,9 +367,13 @@ xpack.security.audit.ignore_filters:
- actions: [http_request] <1>
- categories: [database]
types: [creation, change, deletion] <2>
+- spaces: [default] <3>
+- users: [elastic, kibana_system] <4>
----------------------------------------
<1> Filters out HTTP request events
<2> Filters out any data write events
+<3> Filters out events from the `default` space
+<4> Filters out events from the `elastic` and `kibana_system` users
xpack.security.audit.ignore_filters[].actions[] {ess-icon}::
List of values matched against the `event.action` field of an audit event. Refer to <> for a list of available events.
@@ -377,8 +381,14 @@ List of values matched against the `event.action` field of an audit event. Refer
xpack.security.audit.ignore_filters[].categories[] {ess-icon}::
List of values matched against the `event.category` field of an audit event. Refer to https://www.elastic.co/guide/en/ecs/1.5/ecs-allowed-values-event-category.html[ECS categorization field] for allowed values.
+xpack.security.audit.ignore_filters[].outcomes[] {ess-icon}::
+List of values matched against the `event.outcome` field of an audit event. Refer to https://www.elastic.co/guide/en/ecs/1.5/ecs-allowed-values-event-outcome.html[ECS outcome field] for allowed values.
+
+xpack.security.audit.ignore_filters[].spaces[] {ess-icon}::
+List of values matched against the `kibana.space_id` field of an audit event. This represents the space id in which the event took place.
+
xpack.security.audit.ignore_filters[].types[] {ess-icon}::
List of values matched against the `event.type` field of an audit event. Refer to https://www.elastic.co/guide/en/ecs/1.5/ecs-allowed-values-event-type.html[ECS type field] for allowed values.
-xpack.security.audit.ignore_filters[].outcomes[] {ess-icon}::
-List of values matched against the `event.outcome` field of an audit event. Refer to https://www.elastic.co/guide/en/ecs/1.5/ecs-allowed-values-event-outcome.html[ECS outcome field] for allowed values.
+xpack.security.audit.ignore_filters[].users[] {ess-icon}::
+List of values matched against the `user.name` field of an audit event. This represents the `username` associated with the audit event.
diff --git a/x-pack/plugins/security/server/audit/audit_service.test.ts b/x-pack/plugins/security/server/audit/audit_service.test.ts
index 773d5cdf1b8fd..8df7450317df4 100644
--- a/x-pack/plugins/security/server/audit/audit_service.test.ts
+++ b/x-pack/plugins/security/server/audit/audit_service.test.ts
@@ -582,6 +582,7 @@ describe('#filterEvent', () => {
expect(filterEvent(event, [{ types: ['NO_MATCH', 'access'] }])).toBeFalsy();
expect(filterEvent(event, [{ outcomes: ['NO_MATCH', 'success'] }])).toBeFalsy();
expect(filterEvent(event, [{ spaces: ['NO_MATCH', 'default'] }])).toBeFalsy();
+ expect(filterEvent(event, [{ users: ['NO_MATCH', 'jdoe'] }])).toBeFalsy();
});
test('keeps event when one criteria per rule does not match', () => {
@@ -593,6 +594,7 @@ describe('#filterEvent', () => {
types: ['access'],
outcomes: ['success'],
spaces: ['default'],
+ users: ['jdoe'],
},
{
actions: ['http_request'],
@@ -600,6 +602,7 @@ describe('#filterEvent', () => {
types: ['access'],
outcomes: ['success'],
spaces: ['default'],
+ users: ['jdoe'],
},
{
actions: ['http_request'],
@@ -607,6 +610,7 @@ describe('#filterEvent', () => {
types: ['NO_MATCH'],
outcomes: ['success'],
spaces: ['default'],
+ users: ['jdoe'],
},
{
actions: ['http_request'],
@@ -614,6 +618,7 @@ describe('#filterEvent', () => {
types: ['access'],
outcomes: ['NO_MATCH'],
spaces: ['default'],
+ users: ['jdoe'],
},
{
actions: ['http_request'],
@@ -621,6 +626,15 @@ describe('#filterEvent', () => {
types: ['access'],
outcomes: ['success'],
spaces: ['NO_MATCH'],
+ users: ['jdoe'],
+ },
+ {
+ actions: ['http_request'],
+ categories: ['web'],
+ types: ['access'],
+ outcomes: ['success'],
+ spaces: ['default'],
+ users: ['NO_MATCH'],
},
])
).toBeTruthy();
@@ -651,6 +665,7 @@ describe('#filterEvent', () => {
types: ['access'],
outcomes: ['success'],
spaces: ['default'],
+ users: ['jdoe'],
},
])
).toBeTruthy();
@@ -681,6 +696,7 @@ describe('#filterEvent', () => {
types: ['access', 'NO_MATCH'],
outcomes: ['success'],
spaces: ['default'],
+ users: ['jdoe'],
},
])
).toBeTruthy();
@@ -695,6 +711,7 @@ describe('#filterEvent', () => {
types: ['NO_MATCH'],
outcomes: ['NO_MATCH'],
spaces: ['NO_MATCH'],
+ users: ['NO_MATCH'],
},
{
actions: ['http_request'],
@@ -702,6 +719,7 @@ describe('#filterEvent', () => {
types: ['access'],
outcomes: ['success'],
spaces: ['default'],
+ users: ['jdoe'],
},
])
).toBeFalsy();
@@ -732,6 +750,7 @@ describe('#filterEvent', () => {
types: ['access'],
outcomes: ['success'],
spaces: ['default'],
+ users: ['jdoe'],
},
])
).toBeFalsy();
diff --git a/x-pack/plugins/security/server/audit/audit_service.ts b/x-pack/plugins/security/server/audit/audit_service.ts
index 6539b8208c3de..3bebc32d2dc80 100644
--- a/x-pack/plugins/security/server/audit/audit_service.ts
+++ b/x-pack/plugins/security/server/audit/audit_service.ts
@@ -201,7 +201,8 @@ export function filterEvent(
(!rule.types ||
normalize(event.event?.type)?.every((t) => rule.types?.includes(t || ''))) &&
(!rule.outcomes || rule.outcomes.includes(event.event?.outcome!)) &&
- (!rule.spaces || rule.spaces.includes(event.kibana?.space_id!))
+ (!rule.spaces || rule.spaces.includes(event.kibana?.space_id!)) &&
+ (!rule.users || !event.user?.name || rule.users.includes(event.user.name))
);
}
return true;
diff --git a/x-pack/plugins/security/server/config.test.ts b/x-pack/plugins/security/server/config.test.ts
index 7a87b2d655d52..3a6ccc619fdb9 100644
--- a/x-pack/plugins/security/server/config.test.ts
+++ b/x-pack/plugins/security/server/config.test.ts
@@ -2004,6 +2004,57 @@ describe('createConfig()', () => {
).toThrow('[audit.appender.1.layout]: expected at least one defined value but got [undefined]');
});
+ it('allows filtering audit events', () => {
+ expect(
+ ConfigSchema.validate({
+ audit: {
+ enabled: true,
+ appender: {
+ type: 'file',
+ fileName: '/path/to/file.txt',
+ layout: {
+ type: 'json',
+ },
+ },
+ ignore_filters: [
+ {
+ actions: ['authentication_success', 'authorization_failure'],
+ categories: ['database'],
+ outcomes: ['unknown'],
+ spaces: ['default'],
+ types: ['index'],
+ users: ['elastic'],
+ },
+ ],
+ },
+ }).audit.ignore_filters
+ ).toMatchInlineSnapshot(`
+ Array [
+ Object {
+ "actions": Array [
+ "authentication_success",
+ "authorization_failure",
+ ],
+ "categories": Array [
+ "database",
+ ],
+ "outcomes": Array [
+ "unknown",
+ ],
+ "spaces": Array [
+ "default",
+ ],
+ "types": Array [
+ "index",
+ ],
+ "users": Array [
+ "elastic",
+ ],
+ },
+ ]
+ `);
+ });
+
describe('#getExpirationTimeouts', () => {
function createMockConfig(config: Record = {}) {
return createConfig(ConfigSchema.validate(config), loggingSystemMock.createLogger(), {
diff --git a/x-pack/plugins/security/server/config.ts b/x-pack/plugins/security/server/config.ts
index 6e254ad763eee..1ea1c87d31d5d 100644
--- a/x-pack/plugins/security/server/config.ts
+++ b/x-pack/plugins/security/server/config.ts
@@ -294,9 +294,10 @@ export const ConfigSchema = schema.object({
schema.object({
actions: schema.maybe(schema.arrayOf(schema.string(), { minSize: 1 })),
categories: schema.maybe(schema.arrayOf(schema.string(), { minSize: 1 })),
- types: schema.maybe(schema.arrayOf(schema.string(), { minSize: 1 })),
outcomes: schema.maybe(schema.arrayOf(schema.string(), { minSize: 1 })),
spaces: schema.maybe(schema.arrayOf(schema.string(), { minSize: 1 })),
+ types: schema.maybe(schema.arrayOf(schema.string(), { minSize: 1 })),
+ users: schema.maybe(schema.arrayOf(schema.string(), { minSize: 1 })),
})
)
),
From cd5f701b1ec6b8b0637ed7546c079b591addef34 Mon Sep 17 00:00:00 2001
From: Devon Thomson
Date: Fri, 10 May 2024 13:59:35 -0400
Subject: [PATCH 05/25] [Embeddable] Removes unused function (#183178)
---
src/plugins/embeddable/public/plugin.tsx | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/plugins/embeddable/public/plugin.tsx b/src/plugins/embeddable/public/plugin.tsx
index 8cc4c8f1eec1d..c7a146fd569b1 100644
--- a/src/plugins/embeddable/public/plugin.tsx
+++ b/src/plugins/embeddable/public/plugin.tsx
@@ -165,7 +165,6 @@ export class EmbeddablePublicPlugin implements Plugin
Date: Fri, 10 May 2024 20:01:58 +0200
Subject: [PATCH 06/25] Upgrade EUI to v94.3.0 (#182822)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
`v94.2.1-backport.0` ⏩ `v94.3.0`
_[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_
---
## [`v94.3.0`](https://github.com/elastic/eui/releases/v94.3.0)
- Updated `launch` glyph for `EuiIcon`
([#7670](https://github.com/elastic/eui/pull/7670))
- Updated `EuiComboBox`'s `options` to support including tooltip details
for selectable options. Use `toolTipContent` to render tooltip
information, and `toolTipProps` to optionally customize the tooltip
rendering behavior ([#7700](https://github.com/elastic/eui/pull/7700))
- Updated the following existing glyphs in `EuiIcon`:
([#7727](https://github.com/elastic/eui/pull/7727))
- `error` (now an outlined version instead of filled)
- `tokenMetricCounter`
- `tokenMetricGauge`
- Added the following new glyphs to `EuiIcon`:
([#7727](https://github.com/elastic/eui/pull/7727))
- `tokenDimension`
- `clickLeft`
- `clickRight`
- `clockCounter`
- `errorFilled` (the previous `error` glyph design)
- `warningFilled`
**Bug fixes**
- Fixed a visual layout bug for `EuiComboBox` with `isLoading` in mobile
views ([#7700](https://github.com/elastic/eui/pull/7700))
- Fixed missing styles on header cells of `EuiDataGrid` that prevented
content text alignment styles to apply
([#7720](https://github.com/elastic/eui/pull/7720))
- Fixed `EuiFlexGroup` and `EuiFlexItem` `ref` prop typing to support
refs of the same type as the passed `component` type and allow
`displayName` to be defined for easy component naming when using
component wrappers like `styled()`
([#7724](https://github.com/elastic/eui/pull/7724))
---
Most of the code changes you'll see in this PR are caused by the recent
EuiFlex* changes making it generic. This, unfortunately, is something
that `styled()` doesn't always like. I replaced the failing usages of
`styled(EuiFlexGroup)` and `styled(EuiFlexItem)` to use `component` and
other native EuiFlex* props, resulting in the same output but being
better typed.
We plan to add more props to EuiFlex* components giving developers
control over properties like `flex-grow` and `flex-shring`, and reducing
the need for writing any custom CSS when using these components. This
should reduce the number of `styled()` wrappers needed even further
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
---
package.json | 2 +-
.../__snapshots__/entry_content.test.tsx.snap | 4 +-
...erate_linked_rules_menu_item.test.tsx.snap | 16 ++--
.../__snapshots__/list_header.test.tsx.snap | 80 +++++++++----------
.../__snapshots__/menu_items.test.tsx.snap | 20 ++---
.../text_with_edit.test.tsx.snap | 16 ++--
.../src/utils/get_render_cell_value.test.tsx | 4 +-
src/dev/license_checker/config.ts | 2 +-
.../summary_actions/index.tsx | 9 +--
.../ilm_phase_counts/index.tsx | 3 +-
.../pattern_summary/stats_rollup/index.tsx | 10 +--
.../__snapshots__/app.test.tsx.snap | 2 +-
.../extend_index_management.test.tsx.snap | 16 ++--
.../__snapshots__/index.test.tsx.snap | 16 ++--
.../components/expression_row.tsx | 32 ++++----
.../sub_components/selector_footer.tsx | 6 +-
.../components/expression_row.tsx | 9 ---
.../public/components/async_component.tsx | 11 ++-
.../waterfall_legend_item.tsx | 9 ++-
.../components/paginated_table/index.tsx | 2 +-
.../cypress/fixtures/artifacts_page.ts | 5 +-
.../body/renderers/alert_renderer/index.tsx | 14 +---
.../timeline/search_or_filter/index.tsx | 7 +-
.../components/timeline/tabs/notes/index.tsx | 10 ++-
yarn.lock | 8 +-
25 files changed, 145 insertions(+), 168 deletions(-)
diff --git a/package.json b/package.json
index d5e4ad418c0f4..e6d2b684c3615 100644
--- a/package.json
+++ b/package.json
@@ -108,7 +108,7 @@
"@elastic/ecs": "^8.11.1",
"@elastic/elasticsearch": "^8.13.0",
"@elastic/ems-client": "8.5.1",
- "@elastic/eui": "94.2.1-backport.0",
+ "@elastic/eui": "94.3.0",
"@elastic/filesaver": "1.1.2",
"@elastic/node-crypto": "1.2.1",
"@elastic/numeral": "^2.5.1",
diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/__snapshots__/entry_content.test.tsx.snap b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/__snapshots__/entry_content.test.tsx.snap
index bd4792360e0c9..9927750e4f84e 100644
--- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/__snapshots__/entry_content.test.tsx.snap
+++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/__snapshots__/entry_content.test.tsx.snap
@@ -12,7 +12,7 @@ Object {
css="You have tried to stringify object returned from \`css\` function. It isn't supposed to be used directly (e.g. as value of the \`className\` prop), but rather handed to emotion so it can handle it (e.g. as value of \`css\` prop)."
>