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][Detection Engine] changes codeowners for rule create/edit form components #173906

Merged
merged 18 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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 @@ -14,7 +14,7 @@ import {
RISK_SCORE_MEDIUM,
RISK_SCORE_HIGH,
RISK_SCORE_CRITICAL,
} from '../../../../../detections/components/rules/step_about_rule/data';
} from '../../../../constants';
import { getFillColor, getRiskScorePalette, RISK_SCORE_STEPS } from '.';

describe('getFillColor', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
RISK_SCORE_MEDIUM,
RISK_SCORE_HIGH,
RISK_SCORE_CRITICAL,
} from '../../../../../detections/components/rules/step_about_rule/data';
} from '../../../../constants';

/**
* The detection engine creates risk scores in the range 1 - 100.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { Severity } from '@kbn/securitysolution-io-ts-alerting-types';
import { EuiBasicTable, EuiSkeletonText, EuiSpacer } from '@elastic/eui';

import { PreferenceFormattedDate } from '../../formatted_date';
import { SeverityBadge } from '../../../../detections/components/rules/severity_badge';
import { SeverityBadge } from '../../severity_badge';
import { useAlertsByIds } from '../../../containers/alerts/use_alerts_by_ids';
import { SIMPLE_ALERT_TABLE_ERROR, SIMPLE_ALERT_TABLE_LIMITED } from './translations';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
import { FormattedFieldValue } from '../../../../timelines/components/timeline/body/renderers/formatted_field';
import { OverviewCardWithActions, OverviewCard } from './overview_card';
import { StatusPopoverButton } from './status_popover_button';
import { SeverityBadge } from '../../../../detections/components/rules/severity_badge';
import { SeverityBadge } from '../../severity_badge';
import { useThrottledResizeObserver } from '../../utils';
import { isNotNull } from '../../../../timelines/store/helpers';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
SUB_PLUGINS_REDUCER,
TestProviders,
} from '../../../mock';
import { SeverityBadge } from '../../../../detections/components/rules/severity_badge';
import { SeverityBadge } from '../../severity_badge';
import type { State } from '../../../store';
import { createStore } from '../../../store';
import { TimelineId } from '../../../../../common/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* 2.0.
*/

import { useIsExperimentalFeatureEnabled } from '../../../common/hooks/use_experimental_features';
import { useKibana } from '../../../common/lib/kibana';
import { useIsExperimentalFeatureEnabled } from '../../hooks/use_experimental_features';
import { useKibana } from '../../lib/kibana';

export const useIsEsqlRuleTypeEnabled = (): boolean => {
const isEsqlSettingEnabled = useKibana().services.configSettings.ESQLEnabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { InputsModelId } from '../../store/inputs/constants';
import type { MatrixHistogramType } from '../../../../common/search_strategy/security_solution';
import type { UpdateDateRange } from '../charts/common';
import type { GlobalTimeArgs } from '../../containers/use_global_time';
import type { FieldValueThreshold } from '../../../detections/components/rules/threshold_input';
import type { FieldValueThreshold } from '../../../detection_engine/rule_creation_ui/components/threshold_input';
import type { GetLensAttributes, LensAttributes } from '../visualization_actions/types';

export type MatrixHistogramMappingTypes = Record<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { upperFirst } from 'lodash/fp';
import { euiLightVars } from '@kbn/ui-theme';
import type { Severity } from '@kbn/securitysolution-io-ts-alerting-types';

import { HealthTruncateText } from '../../../../common/components/health_truncate_text';
import { HealthTruncateText } from '../health_truncate_text';

const { euiColorVis0, euiColorVis5, euiColorVis7, euiColorVis9 } = euiLightVars;
const severityToColorMap: Record<Severity, string> = {
Expand Down
18 changes: 18 additions & 0 deletions x-pack/plugins/security_solution/public/common/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* 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 { euiLightVars } from '@kbn/ui-theme';

export const RISK_COLOR_LOW = euiLightVars.euiColorVis0;
export const RISK_COLOR_MEDIUM = euiLightVars.euiColorVis5;
export const RISK_COLOR_HIGH = euiLightVars.euiColorVis7;
export const RISK_COLOR_CRITICAL = euiLightVars.euiColorVis9;

export const RISK_SCORE_LOW = 21;
export const RISK_SCORE_MEDIUM = 47;
export const RISK_SCORE_HIGH = 73;
export const RISK_SCORE_CRITICAL = 99;
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import type { FieldHook } from '../../../../shared_imports';
import { getFieldValidityAndErrorMessage } from '../../../../shared_imports';
import { useSecurityJobs } from '../../../../common/components/ml_popover/hooks/use_security_jobs';
import { useKibana } from '../../../../common/lib/kibana';
import { ML_JOB_SELECT_PLACEHOLDER_TEXT } from '../step_define_rule/translations';
import { HelpText } from './help_text';

import * as i18n from './translations';
Expand Down Expand Up @@ -135,7 +134,7 @@ export const MlJobSelect: React.FC<MlJobSelectProps> = ({ describedByIds = [], f
isLoading={loading}
onChange={handleJobSelect}
options={jobOptions}
placeholder={ML_JOB_SELECT_PLACEHOLDER_TEXT}
placeholder={i18n.ML_JOB_SELECT_PLACEHOLDER_TEXT}
renderOption={renderJobOption}
rowHeight={50}
selectedOptions={selectedJobOptions}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ export const CREATE_CUSTOM_JOB_BUTTON_TITLE = i18n.translate(
defaultMessage: 'Create custom job',
}
);

export const ML_JOB_SELECT_PLACEHOLDER_TEXT = i18n.translate(
'xpack.securitySolution.detectionEngine.createRule.stepDefineRule.mlJobSelectPlaceholderText',
{
defaultMessage: 'Select a job',
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*/

import type { ActionTypeRegistryContract } from '@kbn/triggers-actions-ui-plugin/public';
import { debouncedValidateRuleActionsField } from '../../../containers/detection_engine/rules/validate_rule_actions_field';
import { debouncedValidateRuleActionsField } from '../../../../detections/containers/detection_engine/rules/validate_rule_actions_field';

import type { FormSchema } from '../../../../shared_imports';
import type { ActionsStepRule } from '../../../pages/detection_engine/rules/types';
import type { ActionsStepRule } from '../../../../detections/pages/detection_engine/rules/types';

export const getSchema = ({
actionTypeRegistry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import {
defaultSchedule,
stepAboutDefaultValue,
stepDefineDefaultValue,
} from '../../../pages/detection_engine/rules/utils';
import { useRuleForms } from '../../../../detection_engine/rule_creation_ui/pages/form';
} from '../../../../detections/pages/detection_engine/rules/utils';
import { useRuleForms } from '../../../rule_creation_ui/pages/form';
import type { FormHook } from '../../../../shared_imports';
import type { ActionsStepRule } from '../../../pages/detection_engine/rules/types';
import type { ActionsStepRule } from '../../../../detections/pages/detection_engine/rules/types';
import { FrequencyDescription } from './notification_action';

jest.mock('../../../../common/lib/kibana', () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@ import type { Type } from '@kbn/securitysolution-io-ts-alerting-types';
import type { RuleObjectId } from '../../../../../common/api/detection_engine/model/rule_schema';
import { isQueryRule } from '../../../../../common/detection_engine/utils';
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
import { ResponseActionsForm } from '../../../../detection_engine/rule_response_actions/response_actions_form';
import type { RuleStepProps, ActionsStepRule } from '../../../pages/detection_engine/rules/types';
import { ResponseActionsForm } from '../../../rule_response_actions/response_actions_form';
import type {
RuleStepProps,
ActionsStepRule,
} from '../../../../detections/pages/detection_engine/rules/types';
import { Form, UseField } from '../../../../shared_imports';
import type { FormHook } from '../../../../shared_imports';
import { StepContentWrapper } from '../step_content_wrapper';
import { RuleActionsField } from '../rule_actions_field';
import { useKibana } from '../../../../common/lib/kibana';
import { useFetchConnectorsQuery } from '../../../../detection_engine/rule_management/api/hooks/use_fetch_connectors_query';
import { useFetchConnectorTypesQuery } from '../../../../detection_engine/rule_management/api/hooks/use_fetch_connector_types_query';
import { useFetchConnectorsQuery } from '../../../rule_management/api/hooks/use_fetch_connectors_query';
import { useFetchConnectorTypesQuery } from '../../../rule_management/api/hooks/use_fetch_connector_types_query';
import * as i18n from './translations';
import { RuleSnoozeSection } from './rule_snooze_section';
import { NotificationAction } from './notification_action';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { ActionResult } from '@kbn/actions-plugin/server';
import type { RuleActionFrequency, RuleAction } from '@kbn/alerting-plugin/common';
import type { ActionTypeRegistryContract } from '@kbn/triggers-actions-ui-plugin/public';
import { FormattedMessage } from '@kbn/i18n-react';
import { getTimeTypeValue } from '../../../../detection_engine/rule_creation_ui/pages/rule_creation/helpers';
import { getTimeTypeValue } from '../../../rule_creation_ui/pages/rule_creation/helpers';
import * as i18n from './translations';

const DescriptionLine = ({ children }: { children: React.ReactNode }) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import React from 'react';
import { EuiToolTip, EuiText, EuiFlexGroup, EuiFlexItem, EuiIcon } from '@elastic/eui';
import type { RuleAction } from '@kbn/alerting-plugin/common';
import { getActionDetails } from '../../../../detection_engine/rule_response_actions/constants';
import { getActionDetails } from '../../../rule_response_actions/constants';

interface ResponseActionProps {
action: Omit<RuleAction, 'id' | 'group'>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import React from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';
import type { RuleObjectId } from '../../../../../common/api/detection_engine/model/rule_schema';
import { RuleSnoozeBadge } from '../../../../detection_engine/rule_management/components/rule_snooze_badge';
import { RuleSnoozeBadge } from '../../../rule_management/components/rule_snooze_badge';
import * as i18n from './translations';

interface RuleSnoozeSectionProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { securitySolutionQueryClient } from '../../../common/containers/query_cl
import type { ValidationError, ValidationFunc } from '../../../shared_imports';
import { isEsqlRule } from '../../../../common/detection_engine/utils';
import type { DefineStepRule } from '../../../detections/pages/detection_engine/rules/types';
import type { FieldValueQueryBar } from '../../../detections/components/rules/query_bar';
import type { FieldValueQueryBar } from '../../rule_creation_ui/components/query_bar';
import * as i18n from './translations';
import { getEsqlQueryConfig } from './get_esql_query_config';
export type FieldType = 'string';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type { ChangeEvent } from 'react';
import React, { useCallback, useEffect, useState, useRef } from 'react';
import styled from 'styled-components';

import * as RuleI18n from '../../../pages/detection_engine/rules/translations';
import * as RuleI18n from '../../../../detections/pages/detection_engine/rules/translations';
import type { FieldHook } from '../../../../shared_imports';
import { getFieldValidityAndErrorMessage } from '../../../../shared_imports';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { DataViewListItem } from '@kbn/data-views-plugin/common';
import type { FieldHook } from '../../../../shared_imports';
import { getFieldValidityAndErrorMessage } from '../../../../shared_imports';
import * as i18n from './translations';
import type { DefineStepRule } from '../../../pages/detection_engine/rules/types';
import type { DefineStepRule } from '../../../../detections/pages/detection_engine/rules/types';

export interface DataViewSelectorProps {
kibanaDataViews: Record<string, DataViewListItem>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import React from 'react';
import { EuiIcon, EuiToolTip } from '@elastic/eui';

import { TechnicalPreviewBadge } from '../technical_preview_badge';
import { TechnicalPreviewBadge } from '../../../../common/components/technical_preview_badge';
import { useUpsellingMessage } from '../../../../common/hooks/use_upselling';

interface TechnicalPreviewBadgeProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import React from 'react';
import type { ListItems } from './types';
import { MlJobsDescription } from '../ml_jobs_description';
import { MlJobsDescription } from '../../../rule_creation/components/ml_jobs_description';

export const buildMlJobsDescription = (jobIds: string[], label: string): ListItems => ({
title: label,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { FilterManager, UI_SETTINGS } from '@kbn/data-plugin/public';
import { FilterBadgeGroup } from '@kbn/unified-search-plugin/public';
import type { DataViewBase } from '@kbn/es-query';
import { FilterStateStore } from '@kbn/es-query';
import { SeverityBadge } from '../severity_badge';
import { SeverityBadge } from '../../../../common/components/severity_badge';

import * as i18n from './translations';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ import * as i18nRiskScore from '../risk_score_mapping/translations';

import * as i18n from './translations';
import type { BuildQueryBarDescription, ListItems } from './types';
import { SeverityBadge } from '../severity_badge';
import { SeverityBadge } from '../../../../common/components/severity_badge';
import type {
AboutStepRiskScore,
AboutStepSeverity,
Duration,
} from '../../../pages/detection_engine/rules/types';
import { GroupByOptions } from '../../../pages/detection_engine/rules/types';
} from '../../../../detections/pages/detection_engine/rules/types';
import { GroupByOptions } from '../../../../detections/pages/detection_engine/rules/types';
import { defaultToEmptyTag } from '../../../../common/components/empty_value';
import { ThreatEuiFlexGroup } from './threat_description';
import { AlertSuppressionTechnicalPreviewBadge } from './alert_suppression_technical_preview_badge';
import { TechnicalPreviewBadge } from '../technical_preview_badge';
import { TechnicalPreviewBadge } from '../../../../common/components/technical_preview_badge';
const NoteDescriptionContainer = styled(EuiFlexItem)`
height: 105px;
overflow-y: hidden;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import { FilterStateStore } from '@kbn/es-query';
import {
mockAboutStepRule,
mockDefineStepRule,
} from '../../../../detection_engine/rule_management_ui/components/rules_table/__mocks__/mock';
} from '../../../rule_management_ui/components/rules_table/__mocks__/mock';
import { coreMock } from '@kbn/core/public/mocks';
import { DEFAULT_TIMELINE_TITLE } from '../../../../timelines/components/timeline/translations';
import * as i18n from './translations';

import { schema } from '../step_about_rule/schema';
import type { ListItems } from './types';
import type { AboutStepRule } from '../../../pages/detection_engine/rules/types';
import type { AboutStepRule } from '../../../../detections/pages/detection_engine/rules/types';
import { createLicenseServiceMock } from '../../../../../common/license/mocks';

jest.mock('../../../../common/lib/kibana');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ import type {
RelatedIntegrationArray,
RequiredFieldArray,
} from '../../../../../common/api/detection_engine/model/rule_schema';
import { buildRelatedIntegrationsDescription } from '../related_integrations/integrations_description';
import { buildRelatedIntegrationsDescription } from '../../../../detections/components/rules/related_integrations/integrations_description';
import { DEFAULT_TIMELINE_TITLE } from '../../../../timelines/components/timeline/translations';
import type { EqlOptionsSelected } from '../../../../../common/search_strategy';
import { useKibana } from '../../../../common/lib/kibana';
import type {
AboutStepRiskScore,
AboutStepSeverity,
Duration,
} from '../../../pages/detection_engine/rules/types';
import type { FieldValueTimeline } from '../pick_timeline';
} from '../../../../detections/pages/detection_engine/rules/types';
import type { FieldValueTimeline } from '../../../rule_creation/components/pick_timeline';
import type { FormSchema } from '../../../../shared_imports';
import type { ListItems } from './types';
import {
Expand All @@ -53,7 +53,7 @@ import { buildMlJobsDescription } from './build_ml_jobs_description';
import { buildActionsDescription } from './actions_description';
import { buildThrottleDescription } from './throttle_description';
import { THREAT_QUERY_LABEL } from './translations';
import { filterEmptyThreats } from '../../../../detection_engine/rule_creation_ui/pages/rule_creation/helpers';
import { filterEmptyThreats } from '../../pages/rule_creation/helpers';
import { useLicense } from '../../../../common/hooks/use_license';
import type { LicenseService } from '../../../../../common/license';
import { isThresholdRule, isQueryRule } from '../../../../../common/detection_engine/utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import { EuiFlexItem, EuiLink, EuiFlexGroup, EuiButtonEmpty } from '@elastic/eui
import React, { useEffect, useState } from 'react';
import styled from 'styled-components';
import type { BuildThreatDescription } from './types';
import type { MitreSubTechnique, MitreTactic, MitreTechnique } from '../../../mitre/types';
import type {
MitreSubTechnique,
MitreTactic,
MitreTechnique,
} from '../../../../detections/mitre/types';
import ListTreeIcon from './assets/list_tree_icon.svg';

const lazyMitreConfiguration = () => {
Expand All @@ -18,7 +22,7 @@ const lazyMitreConfiguration = () => {
*/
return import(
/* webpackChunkName: "lazy_mitre_configuration" */
'../../../mitre/mitre_tactics_techniques'
'../../../../detections/mitre/mitre_tactics_techniques'
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React from 'react';
import { shallow, mount } from 'enzyme';

import { mockIndexPattern, TestProviders, useFormFieldMock } from '../../../../common/mock';
import { mockQueryBar } from '../../../../detection_engine/rule_management_ui/components/rules_table/__mocks__/mock';
import { mockQueryBar } from '../../../rule_management_ui/components/rules_table/__mocks__/mock';
import type { EqlQueryBarProps } from './eql_query_bar';
import { EqlQueryBar } from './eql_query_bar';
import { getEqlValidationError } from './validators.mock';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { FilterManager } from '@kbn/data-plugin/public';
import type { FieldHook } from '../../../../shared_imports';
import { FilterBar } from '../../../../common/components/filter_bar';
import { useAppToasts } from '../../../../common/hooks/use_app_toasts';
import type { DefineStepRule } from '../../../pages/detection_engine/rules/types';
import type { DefineStepRule } from '../../../../detections/pages/detection_engine/rules/types';
import * as i18n from './translations';
import { EqlQueryBarFooter } from './footer';
import { getValidationResults } from './validators';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { isEmpty } from 'lodash';
import type { FieldHook, ValidationError, ValidationFunc } from '../../../../shared_imports';
import { isEqlRule } from '../../../../../common/detection_engine/utils';
import { KibanaServices } from '../../../../common/lib/kibana';
import type { DefineStepRule } from '../../../pages/detection_engine/rules/types';
import { DataSourceType } from '../../../pages/detection_engine/rules/types';
import type { DefineStepRule } from '../../../../detections/pages/detection_engine/rules/types';
import { DataSourceType } from '../../../../detections/pages/detection_engine/rules/types';
import { validateEql } from '../../../../common/hooks/eql/api';
import type { FieldValueQueryBar } from '../query_bar';
import * as i18n from './translations';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { getValidThreat } from '../../../mitre/valid_threat_mock';
import { getValidThreat } from '../../../../detections/mitre/valid_threat_mock';
import { hasSubtechniqueOptions } from './helpers';

const mockTechniques = getValidThreat()[0].technique ?? [];
Expand Down
Loading