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

[7.x] [SIEM] Server cutover to New Platform (#63430) #63912

Merged
merged 1 commit into from
Apr 18, 2020
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ module.exports = {
},
{
// typescript only for front and back end
files: ['x-pack/legacy/plugins/siem/**/*.{ts,tsx}'],
files: ['x-pack/{,legacy/}plugins/siem/**/*.{ts,tsx}'],
rules: {
// This will be turned on after bug fixes are complete
// '@typescript-eslint/explicit-member-accessibility': 'warn',
Expand Down Expand Up @@ -617,7 +617,7 @@ module.exports = {
// },
{
// typescript and javascript for front and back end
files: ['x-pack/legacy/plugins/siem/**/*.{js,ts,tsx}'],
files: ['x-pack/{,legacy/}plugins/siem/**/*.{js,ts,tsx}'],
plugins: ['eslint-plugin-node', 'react'],
env: {
mocha: true,
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ kibanaPipeline(timeoutMinutes: 135, checkPrChanges: true) {
'xpack-ciGroup10': kibanaPipeline.xpackCiGroupProcess(10),
'xpack-accessibility': kibanaPipeline.functionalTestProcess('xpack-accessibility', './test/scripts/jenkins_xpack_accessibility.sh'),
'xpack-siemCypress': { processNumber ->
whenChanged(['x-pack/legacy/plugins/siem/', 'x-pack/test/siem_cypress/']) {
whenChanged(['x-pack/plugins/siem/', 'x-pack/legacy/plugins/siem/', 'x-pack/test/siem_cypress/']) {
kibanaPipeline.functionalTestProcess('xpack-siemCypress', './test/scripts/jenkins_siem_cypress.sh')(processNumber)
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/cli/cluster/cluster_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export class ClusterManager {
...pluginInternalDirsIgnore,
fromRoot('src/legacy/server/sass/__tmp__'),
fromRoot('x-pack/legacy/plugins/reporting/.chromium'),
fromRoot('x-pack/legacy/plugins/siem/cypress'),
fromRoot('x-pack/plugins/siem/cypress'),
fromRoot('x-pack/legacy/plugins/apm/e2e'),
fromRoot('x-pack/legacy/plugins/apm/scripts'),
fromRoot('x-pack/legacy/plugins/canvas/canvas_plugin_src'), // prevents server from restarting twice for Canvas plugin changes,
Expand Down
2 changes: 1 addition & 1 deletion src/dev/storybook/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ export const storybookAliases = {
drilldowns: 'x-pack/plugins/drilldowns/scripts/storybook.js',
embeddable: 'src/plugins/embeddable/scripts/storybook.js',
infra: 'x-pack/legacy/plugins/infra/scripts/storybook.js',
siem: 'x-pack/legacy/plugins/siem/scripts/storybook.js',
siem: 'x-pack/plugins/siem/scripts/storybook.js',
ui_actions: 'x-pack/plugins/advanced_ui_actions/scripts/storybook.js',
};
2 changes: 1 addition & 1 deletion src/dev/typescript/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const PROJECTS = [
new Project(resolve(REPO_ROOT, 'test/tsconfig.json'), { name: 'kibana/test' }),
new Project(resolve(REPO_ROOT, 'x-pack/tsconfig.json')),
new Project(resolve(REPO_ROOT, 'x-pack/test/tsconfig.json'), { name: 'x-pack/test' }),
new Project(resolve(REPO_ROOT, 'x-pack/legacy/plugins/siem/cypress/tsconfig.json'), {
new Project(resolve(REPO_ROOT, 'x-pack/plugins/siem/cypress/tsconfig.json'), {
name: 'siem/cypress',
}),
new Project(resolve(REPO_ROOT, 'x-pack/legacy/plugins/apm/e2e/tsconfig.json'), {
Expand Down
2 changes: 1 addition & 1 deletion test/scripts/jenkins_xpack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ echo ""

echo " -> Running SIEM cyclic dependency test"
cd "$XPACK_DIR"
checks-reporter-with-killswitch "X-Pack SIEM cyclic dependency test" node legacy/plugins/siem/scripts/check_circular_deps
checks-reporter-with-killswitch "X-Pack SIEM cyclic dependency test" node plugins/siem/scripts/check_circular_deps
echo ""
echo ""

Expand Down
2 changes: 1 addition & 1 deletion x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"xpack.searchProfiler": "plugins/searchprofiler",
"xpack.security": ["legacy/plugins/security", "plugins/security"],
"xpack.server": "legacy/server",
"xpack.siem": "legacy/plugins/siem",
"xpack.siem": ["plugins/siem", "legacy/plugins/siem"],
"xpack.snapshotRestore": "plugins/snapshot_restore",
"xpack.spaces": ["legacy/plugins/spaces", "plugins/spaces"],
"xpack.taskManager": "legacy/plugins/task_manager",
Expand Down
1 change: 0 additions & 1 deletion x-pack/legacy/plugins/siem/.gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Auto-collapse generated files in GitHub
# https://help.github.com/en/articles/customizing-how-changed-files-appear-on-github
x-pack/legacy/plugins/siem/public/graphql/types.ts linguist-generated=true
x-pack/legacy/plugins/siem/server/graphql/types.ts linguist-generated=true
x-pack/legacy/plugins/siem/public/graphql/introspection.json linguist-generated=true

8 changes: 0 additions & 8 deletions x-pack/legacy/plugins/siem/cypress.json

This file was deleted.

34 changes: 6 additions & 28 deletions x-pack/legacy/plugins/siem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@

import { i18n } from '@kbn/i18n';
import { resolve } from 'path';
import { Server } from 'hapi';
import { Root } from 'joi';

import { plugin } from './server';
import { savedObjectMappings } from './server/saved_objects';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { savedObjectMappings } from '../../../plugins/siem/server/saved_objects';

import {
APP_ID,
Expand All @@ -23,15 +22,13 @@ import {
DEFAULT_INTERVAL_VALUE,
DEFAULT_FROM,
DEFAULT_TO,
DEFAULT_SIGNALS_INDEX,
ENABLE_NEWS_FEED_SETTING,
NEWS_FEED_URL_SETTING,
NEWS_FEED_URL_SETTING_DEFAULT,
SIGNALS_INDEX_KEY,
IP_REPUTATION_LINKS_SETTING,
IP_REPUTATION_LINKS_SETTING_DEFAULT,
} from './common/constants';
import { defaultIndexPattern } from './default_index_pattern';
DEFAULT_INDEX_PATTERN,
} from '../../../plugins/siem/common/constants';
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils';

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down Expand Up @@ -102,7 +99,7 @@ export const siem = (kibana: any) => {
name: i18n.translate('xpack.siem.uiSettings.defaultIndexLabel', {
defaultMessage: 'Elasticsearch indices',
}),
value: defaultIndexPattern,
value: DEFAULT_INDEX_PATTERN,
description: i18n.translate('xpack.siem.uiSettings.defaultIndexDescription', {
defaultMessage:
'<p>Comma-delimited list of Elasticsearch indices from which the SIEM app collects events.</p>',
Expand Down Expand Up @@ -162,31 +159,12 @@ export const siem = (kibana: any) => {
},
mappings: savedObjectMappings,
},
init(server: Server) {
const { coreContext, env, setup, start } = server.newPlatform;
const initializerContext = { ...coreContext, env };
const __legacy = {
config: server.config,
route: server.route.bind(server),
};

// @ts-ignore-next-line: NewPlatform shim is too loosely typed
const pluginInstance = plugin(initializerContext);
// @ts-ignore-next-line: NewPlatform shim is too loosely typed
pluginInstance.setup(setup.core, setup.plugins, __legacy);
// @ts-ignore-next-line: NewPlatform shim is too loosely typed
pluginInstance.start(start.core, start.plugins);
},
config(Joi: Root) {
// See x-pack/plugins/siem/server/config.ts if you're adding another
// value where the configuration has to be duplicated at the moment.
// When we move over to the new platform completely this will be
// removed and only server/config.ts should be used.
return Joi.object()
.keys({
enabled: Joi.boolean().default(true),
[SIGNALS_INDEX_KEY]: Joi.string().default(DEFAULT_SIGNALS_INDEX),
})
.unknown(true)
.default();
},
});
Expand Down
10 changes: 2 additions & 8 deletions x-pack/legacy/plugins/siem/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
{
"author": "Elastic",
"name": "siem",
"name": "siem-legacy-ui",
"version": "8.0.0",
"private": true,
"license": "Elastic-License",
"scripts": {
"extract-mitre-attacks": "node scripts/extract_tactics_techniques_mitre.js & node ../../../../scripts/eslint ./public/pages/detection_engine/mitre/mitre_tactics_techniques.ts --fix",
"build-graphql-types": "node scripts/generate_types_from_graphql.js",
"cypress:open": "../../../node_modules/.bin/cypress open",
"cypress:run": "../../../node_modules/.bin/cypress run --spec ./cypress/integration/**/*.spec.ts --reporter ../../../node_modules/cypress-multi-reporters --reporter-options configFile=./reporter_config.json; status=$?; ../../../node_modules/.bin/mochawesome-merge --reportDir ../../../../target/kibana-siem/cypress/results > ../../../../target/kibana-siem/cypress/results/output.json; ../../../../node_modules/.bin/marge ../../../../target/kibana-siem/cypress/results/output.json --reportDir ../../../../target/kibana-siem/cypress/results; mkdir -p ../../../../target/junit && cp ../../../../target/kibana-siem/cypress/results/*.xml ../../../../target/junit/ && exit $status;",
"cypress:run-as-ci": "node ../../../../scripts/functional_tests --config ../../../test/siem_cypress/config.ts"
},
"scripts": {},
"devDependencies": {
"@types/lodash": "^4.14.110",
"@types/js-yaml": "^3.12.1",
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/siem/public/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { pluck } from 'rxjs/operators';
import { KibanaContextProvider, useKibana, useUiSetting$ } from '../lib/kibana';
import { Storage } from '../../../../../../src/plugins/kibana_utils/public';

import { DEFAULT_DARK_MODE } from '../../common/constants';
import { DEFAULT_DARK_MODE } from '../../../../../plugins/siem/common/constants';
import { ErrorToastDispatcher } from '../components/error_toast_dispatcher';
import { compose } from '../lib/compose/kibana_compose';
import { AppFrontendLibs, AppApolloClient } from '../lib/lib';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import React, { useEffect, useCallback, useMemo } from 'react';
import numeral from '@elastic/numeral';

import { DEFAULT_NUMBER_FORMAT } from '../../../../../../plugins/siem/common/constants';
import { AlertsComponentsQueryProps } from './types';
import { AlertsTable } from './alerts_table';
import * as i18n from './translations';
import { useUiSetting$ } from '../../lib/kibana';
import { DEFAULT_NUMBER_FORMAT } from '../../../common/constants';
import { MatrixHistogramContainer } from '../matrix_histogram';
import { histogramConfigs } from './histogram_configs';
import { MatrixHisrogramConfigs } from '../matrix_histogram/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import {
import React, { useMemo } from 'react';
import styled from 'styled-components';

import { DEFAULT_DARK_MODE } from '../../../../../../plugins/siem/common/constants';
import { useUiSetting } from '../../lib/kibana';
import { DEFAULT_DARK_MODE } from '../../../common/constants';

export const defaultChartHeight = '100%';
export const defaultChartWidth = '100%';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { EuiBadge, EuiToolTip, IconType } from '@elastic/eui';
import React from 'react';
import styled from 'styled-components';

import { Omit } from '../../../common/utility_types';
import { DragEffects, DraggableWrapper } from '../drag_and_drop/draggable_wrapper';
import { escapeDataProviderId } from '../drag_and_drop/helpers';
import { getEmptyStringTag } from '../empty_value';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
EmbeddablePanel,
ErrorEmbeddable,
} from '../../../../../../../src/plugins/embeddable/public';
import { DEFAULT_INDEX_KEY } from '../../../common/constants';
import { DEFAULT_INDEX_KEY } from '../../../../../../plugins/siem/common/constants';
import { getIndexPatternTitleIdMapping } from '../../hooks/api/helpers';
import { useIndexPatterns } from '../../hooks/use_index_patterns';
import { Loader } from '../loader';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import React, { useCallback, useMemo, useEffect } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import deepEqual from 'fast-deep-equal';

import { DEFAULT_INDEX_KEY } from '../../../../../../plugins/siem/common/constants';
import { inputsModel, inputsSelectors, State, timelineSelectors } from '../../store';
import { inputsActions, timelineActions } from '../../store/actions';
import {
Expand All @@ -17,12 +18,10 @@ import {
} from '../../store/timeline/model';
import { OnChangeItemsPerPage } from '../timeline/events';
import { Filter } from '../../../../../../../src/plugins/data/public';

import { useUiSetting } from '../../lib/kibana';
import { EventsViewer } from './events_viewer';
import { useFetchIndexPatterns } from '../../containers/detection_engine/rules/fetch_index_patterns';
import { TimelineTypeContextProps } from '../timeline/timeline_context';
import { DEFAULT_INDEX_KEY } from '../../../common/constants';
import { InspectButtonContainer } from '../inspect';
import * as i18n from './translations';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import React from 'react';
import numeral from '@elastic/numeral';

import { DEFAULT_BYTES_FORMAT } from '../../../common/constants';
import { DEFAULT_BYTES_FORMAT } from '../../../../../../plugins/siem/common/constants';
import { useUiSetting$ } from '../../lib/kibana';

type Bytes = string | number;
Expand Down
4 changes: 2 additions & 2 deletions x-pack/legacy/plugins/siem/public/components/links/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

import { EuiLink, EuiToolTip, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import React, { useMemo } from 'react';

import { isNil } from 'lodash/fp';
import styled from 'styled-components';

import { IP_REPUTATION_LINKS_SETTING } from '../../../../../../plugins/siem/common/constants';
import {
DefaultFieldRendererOverflow,
DEFAULT_MORE_MAX_HEIGHT,
Expand All @@ -22,7 +23,6 @@ import {
} from '../link_to';
import { FlowTarget, FlowTargetSourceDest } from '../../graphql/types';
import { useUiSetting$ } from '../../lib/kibana';
import { IP_REPUTATION_LINKS_SETTING } from '../../../common/constants';
import { isUrlInvalid } from '../../pages/detection_engine/rules/components/step_about_rule/helpers';
import { ExternalLinkIcon } from '../external_link_icon';
import { navTabs } from '../../pages/home/home_navigations';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { EuiTitleSize } from '@elastic/eui';
import { ScaleType, Position, TickFormatter } from '@elastic/charts';
import { ActionCreator } from 'redux';
import { ESQuery } from '../../../common/typed_json';
import { ESQuery } from '../../../../../../plugins/siem/common/typed_json';
import { SetQuery } from '../../pages/hosts/navigation/types';
import { InputsModelId } from '../../store/inputs/constants';
import { HistogramType } from '../../graphql/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/

import { useState, useEffect } from 'react';

import { DEFAULT_ANOMALY_SCORE } from '../../../../../../../plugins/siem/common/constants';
import { anomaliesTableData } from '../api/anomalies_table_data';
import { InfluencerInput, Anomalies, CriteriaFields } from '../types';
import { hasMlUserPermissions } from '../permissions/has_ml_user_permissions';
Expand All @@ -14,7 +16,6 @@ import { useStateToaster, errorToToaster } from '../../toasters';

import * as i18n from './translations';
import { useTimeZone, useUiSetting$ } from '../../../lib/kibana';
import { DEFAULT_ANOMALY_SCORE } from '../../../../common/constants';

interface Args {
influencers?: InfluencerInput[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
import { EuiText, EuiSpacer, EuiFlexGroup, EuiFlexItem, EuiLink } from '@elastic/eui';
import React from 'react';
import styled from 'styled-components';

import { DescriptionList } from '../../../../../../../plugins/siem/common/utility_types';
import { Anomaly, NarrowDateRange } from '../types';
import { getScoreString } from './score_health';
import { PreferenceFormattedDate } from '../../formatted_date';
import { createInfluencers } from './../influencers/create_influencers';
import { DescriptionList } from '../../../../common/utility_types';
import * as i18n from './translations';
import { createExplorerLink } from '../links/create_explorer_link';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

import { useEffect, useState } from 'react';

import { DEFAULT_INDEX_KEY } from '../../../../../../../plugins/siem/common/constants';
import { checkRecognizer, getJobsSummary, getModules } from '../api';
import { SiemJob } from '../types';
import { hasMlUserPermissions } from '../../ml/permissions/has_ml_user_permissions';
import { errorToToaster, useStateToaster } from '../../toasters';
import { useUiSetting$ } from '../../../lib/kibana';
import { DEFAULT_INDEX_KEY } from '../../../../common/constants';

import * as i18n from './translations';
import { createSiemJobs } from './use_siem_jobs_helpers';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import styled from 'styled-components';
import React, { useState, useCallback } from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner, EuiSwitch } from '@elastic/eui';
import { SiemJob } from '../types';
import {
isJobLoading,
isJobFailed,
isJobStarted,
} from '../../../../common/detection_engine/ml_helpers';
} from '../../../../../../../plugins/siem/common/detection_engine/ml_helpers';
import { SiemJob } from '../types';

const StaticSwitch = styled(EuiSwitch)`
.euiSwitch__thumb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { getOr, omit } from 'lodash/fp';

import { ChromeBreadcrumb } from '../../../../../../../../src/core/public';
import { APP_NAME } from '../../../../common/constants';
import { APP_NAME } from '../../../../../../../plugins/siem/common/constants';
import { StartServices } from '../../../plugin';
import { getBreadcrumbs as getHostDetailsBreadcrumbs } from '../../../pages/hosts/details/utils';
import { getBreadcrumbs as getIPDetailsBreadcrumbs } from '../../../pages/network/ip_details';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { NEWS_FEED_URL_SETTING_DEFAULT } from '../../../../../../plugins/siem/common/constants';
import { KibanaServices } from '../../lib/kibana';
import { NEWS_FEED_URL_SETTING_DEFAULT } from '../../../common/constants';
import { rawNewsApiResponse } from '../../mock/news';
import { rawNewsJSON } from '../../mock/raw_news';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import lightTheme from '@elastic/eui/dist/eui_theme_light.json';
import { getOr } from 'lodash/fp';
import React from 'react';

import { DEFAULT_DARK_MODE } from '../../../../../common/constants';
import { DescriptionList } from '../../../../../common/utility_types';
import { DEFAULT_DARK_MODE } from '../../../../../../../../plugins/siem/common/constants';
import { DescriptionList } from '../../../../../../../../plugins/siem/common/utility_types';
import { useUiSetting$ } from '../../../../lib/kibana';
import { getEmptyTagValue } from '../../../empty_value';
import { DefaultFieldRenderer, hostIdRenderer } from '../../../field_renderers/field_renderers';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import darkTheme from '@elastic/eui/dist/eui_theme_dark.json';
import lightTheme from '@elastic/eui/dist/eui_theme_light.json';
import React from 'react';

import { DEFAULT_DARK_MODE } from '../../../../../common/constants';
import { DescriptionList } from '../../../../../common/utility_types';
import { DEFAULT_DARK_MODE } from '../../../../../../../../plugins/siem/common/constants';
import { DescriptionList } from '../../../../../../../../plugins/siem/common/utility_types';
import { useUiSetting$ } from '../../../../lib/kibana';
import { FlowTarget, IpOverviewData, Overview } from '../../../../graphql/types';
import { networkModel } from '../../../../store';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import numeral from '@elastic/numeral';
import { FormattedMessage } from '@kbn/i18n/react';
import React, { useMemo } from 'react';

import { DEFAULT_NUMBER_FORMAT } from '../../../../../common/constants';
import { ESQuery } from '../../../../../common/typed_json';
import { DEFAULT_NUMBER_FORMAT } from '../../../../../../../../plugins/siem/common/constants';
import { ESQuery } from '../../../../../../../../plugins/siem/common/typed_json';
import {
ID as OverviewHostQueryId,
OverviewHostQuery,
Expand Down
Loading