Skip to content
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

[Security Solution][Detections] Adds SOM privilege check for Related Integrations #134168

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useInstalledIntegrations } from '../use_installed_integrations';
import { getInstalledRelatedIntegrations, getIntegrationLink, IntegrationDetails } from '../utils';

import { RelatedIntegrationArray } from '../../../../../../common/detection_engine/schemas/common';
import { useBasePath } from '../../../../../common/lib/kibana';
import { useBasePath, useKibana } from '../../../../../common/lib/kibana';
import { ListItems } from '../../description_step/types';
import * as i18n from '../translations';

Expand All @@ -32,6 +32,9 @@ export const IntegrationDescriptionComponent: React.FC<{ integration: Integratio
integration,
}) => {
const basePath = useBasePath();
const services = useKibana().services;
const isSOMAvailable = services.application.capabilities.savedObjectsManagement.read;

const badgeInstalledColor = 'success';
const badgeUninstalledColor = '#E0E5EE';
const badgeColor = integration.is_installed ? badgeInstalledColor : badgeUninstalledColor;
Expand All @@ -49,10 +52,12 @@ export const IntegrationDescriptionComponent: React.FC<{ integration: Integratio
return (
<Wrapper>
{getIntegrationLink(integration, basePath)}{' '}
<EuiToolTip content={badgeTooltip}>
<PaddedBadge color={badgeColor}>{badgeText}</PaddedBadge>
</EuiToolTip>
{integration.is_installed && !integration.version_satisfied && (
{isSOMAvailable && (
<EuiToolTip content={badgeTooltip}>
<PaddedBadge color={badgeColor}>{badgeText}</PaddedBadge>
</EuiToolTip>
)}
{isSOMAvailable && integration.is_installed && !integration.version_satisfied && (
<VersionWarningIconContainer>
<EuiIconTip
type={'alert'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
EuiSpacer,
} from '@elastic/eui';
import styled from 'styled-components';
import { useKibana } from '../../../../../common/lib/kibana';
import { IntegrationDescription } from '../integrations_description';
import { getInstalledRelatedIntegrations } from '../utils';
import { useInstalledIntegrations } from '../use_installed_integrations';
Expand Down Expand Up @@ -54,6 +55,8 @@ const IntegrationListItem = styled('li')`
const IntegrationsPopoverComponent = ({ integrations }: IntegrationsPopoverProps) => {
const [isPopoverOpen, setPopoverOpen] = useState(false);
const { data: allInstalledIntegrations } = useInstalledIntegrations({ packages: [] });
const services = useKibana().services;
const isSOMAvailable = services.application.capabilities.savedObjectsManagement.read;

const integrationDetails = getInstalledRelatedIntegrations(
integrations,
Expand All @@ -62,7 +65,7 @@ const IntegrationsPopoverComponent = ({ integrations }: IntegrationsPopoverProps

const totalRelatedIntegrationsInstalled = integrationDetails.filter((i) => i.is_enabled).length;
const badgeTitle =
allInstalledIntegrations != null
allInstalledIntegrations != null && isSOMAvailable
? `${totalRelatedIntegrationsInstalled}/${integrations.length} ${i18n.INTEGRATIONS_BADGE}`
: `${integrations.length} ${i18n.INTEGRATIONS_BADGE}`;

Expand Down