Skip to content

Commit 78150b4

Browse files
committed
Merge branch 'logs-ui-server-np-shim' of github.com:jasonrhodes/kibana into logs-ui-server-np-shim
2 parents e03770f + caba63f commit 78150b4

Some content is hidden

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

47 files changed

+969
-565
lines changed

.github/CODEOWNERS

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# App
66
/x-pack/legacy/plugins/lens/ @elastic/kibana-app
77
/x-pack/legacy/plugins/graph/ @elastic/kibana-app
8+
/src/legacy/server/sample_data/ @elastic/kibana-app
89

910
# App Architecture
1011
/src/plugins/data/ @elastic/kibana-app-arch
@@ -66,14 +67,25 @@
6667
/packages/kbn-es/ @elastic/kibana-operations
6768
/packages/kbn-pm/ @elastic/kibana-operations
6869
/packages/kbn-test/ @elastic/kibana-operations
70+
/src/legacy/server/keystore/ @elastic/kibana-operations
71+
/src/legacy/server/pid/ @elastic/kibana-operations
72+
/src/legacy/server/sass/ @elastic/kibana-operations
73+
/src/legacy/server/utils/ @elastic/kibana-operations
74+
/src/legacy/server/warnings/ @elastic/kibana-operations
6975

7076
# Platform
7177
/src/core/ @elastic/kibana-platform
72-
/src/legacy/server/saved_objects/ @elastic/kibana-platform
7378
/config/kibana.yml @elastic/kibana-platform
7479
/x-pack/plugins/features/ @elastic/kibana-platform
7580
/x-pack/plugins/licensing/ @elastic/kibana-platform
7681
/packages/kbn-config-schema/ @elastic/kibana-platform
82+
/src/legacy/server/config/ @elastic/kibana-platform
83+
/src/legacy/server/csp/ @elastic/kibana-platform
84+
/src/legacy/server/http/ @elastic/kibana-platform
85+
/src/legacy/server/i18n/ @elastic/kibana-platform
86+
/src/legacy/server/logging/ @elastic/kibana-platform
87+
/src/legacy/server/saved_objects/ @elastic/kibana-platform
88+
/src/legacy/server/status/ @elastic/kibana-platform
7789

7890
# Security
7991
/x-pack/legacy/plugins/security/ @elastic/kibana-security

src/core/server/http/http_config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@ export const config = {
3838
validate: match(validBasePathRegex, "must start with a slash, don't end with one"),
3939
})
4040
),
41-
defaultRoute: schema.maybe(schema.string()),
41+
defaultRoute: schema.maybe(
42+
schema.string({
43+
validate(value) {
44+
if (!value.startsWith('/')) {
45+
return 'must start with a slash';
46+
}
47+
},
48+
})
49+
),
4250
cors: schema.conditional(
4351
schema.contextRef('dev'),
4452
true,

src/core/server/legacy/config/__snapshots__/legacy_object_to_config_adapter.test.ts.snap

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/server/legacy/config/legacy_object_to_config_adapter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export class LegacyObjectToConfigAdapter extends ObjectToConfigAdapter {
6262
return {
6363
autoListen: configValue.autoListen,
6464
basePath: configValue.basePath,
65+
defaultRoute: configValue.defaultRoute,
6566
cors: configValue.cors,
6667
host: configValue.host,
6768
maxPayload: configValue.maxPayloadBytes,
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
import * as kbnTestServer from '../../../../test_utils/kbn_server';
20+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
21+
import { Root } from '../../../../core/server/root';
22+
23+
describe('default route provider', () => {
24+
let root: Root;
25+
26+
afterEach(async () => await root.shutdown());
27+
28+
it('redirects to the configured default route', async function() {
29+
root = kbnTestServer.createRoot({
30+
server: {
31+
defaultRoute: '/app/some/default/route',
32+
},
33+
});
34+
35+
await root.setup();
36+
await root.start();
37+
38+
const kbnServer = kbnTestServer.getKbnServer(root);
39+
40+
kbnServer.server.decorate('request', 'getSavedObjectsClient', function() {
41+
return {
42+
get: (type: string, id: string) => ({ attributes: {} }),
43+
};
44+
});
45+
46+
const { status, header } = await kbnTestServer.request.get(root, '/');
47+
48+
expect(status).toEqual(302);
49+
expect(header).toMatchObject({
50+
location: '/app/some/default/route',
51+
});
52+
});
53+
});

src/legacy/server/saved_objects/saved_objects_mixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function getImportableAndExportableTypes({ kbnServer, visibleTypes }) {
5555
);
5656
}
5757

58-
export async function savedObjectsMixin(kbnServer, server) {
58+
export function savedObjectsMixin(kbnServer, server) {
5959
const migrator = kbnServer.newPlatform.__internals.kibanaMigrator;
6060
const mappings = migrator.getActiveMappings();
6161
const allTypes = Object.keys(getRootPropertiesObjects(mappings));

x-pack/legacy/plugins/graph/public/components/search_bar.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ function wrapSearchBarInContext(testProps: OuterSearchBarProps) {
6363
);
6464
}
6565

66-
describe('search_bar', () => {
66+
// FLAKY: https://github.com/elastic/kibana/issues/52246
67+
describe.skip('search_bar', () => {
6768
const defaultProps = {
6869
isLoading: false,
6970
onQuerySubmit: jest.fn(),

x-pack/legacy/plugins/siem/common/constants.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ export const DEFAULT_TIME_RANGE = 'timepicker:timeDefaults';
1515
export const DEFAULT_REFRESH_RATE_INTERVAL = 'timepicker:refreshIntervalDefaults';
1616
export const DEFAULT_SIEM_TIME_RANGE = 'siem:timeDefaults';
1717
export const DEFAULT_SIEM_REFRESH_INTERVAL = 'siem:refreshIntervalDefaults';
18+
19+
// DEPRECATED: THIS WILL BE REMOVED VERY SOON AND IS NO LONGER USED ON THE BACKEND
20+
// TODO: Remove this as soon as no code is left that is pulling data from it.
1821
export const DEFAULT_SIGNALS_INDEX_KEY = 'siem:defaultSignalsIndex';
22+
1923
export const DEFAULT_SIGNALS_INDEX = '.siem-signals';
2024
export const DEFAULT_MAX_SIGNALS = 100;
2125
export const DEFAULT_SEARCH_AFTER_PAGE_SIZE = 100;
@@ -32,12 +36,18 @@ export const DEFAULT_INTERVAL_VALUE = 300000; // ms
3236
export const DEFAULT_TIMEPICKER_QUICK_RANGES = 'timepicker:quickRanges';
3337

3438
/**
35-
* Id for the SIGNALS alerting type
39+
* Id for the signals alerting type
3640
*/
3741
export const SIGNALS_ID = `${APP_ID}.signals`;
3842

3943
/**
40-
* Detection engine route
44+
* Detection engine routes
4145
*/
4246
export const DETECTION_ENGINE_URL = '/api/detection_engine';
4347
export const DETECTION_ENGINE_RULES_URL = `${DETECTION_ENGINE_URL}/rules`;
48+
export const DETECTION_ENGINE_INDEX_URL = `${DETECTION_ENGINE_URL}/index`;
49+
50+
/**
51+
* Default signals index key for kibana.dev.yml
52+
*/
53+
export const SIGNALS_INDEX_KEY = 'signalsIndex';

x-pack/legacy/plugins/siem/index.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import { i18n } from '@kbn/i18n';
88
import { resolve } from 'path';
99
import { Server } from 'hapi';
10+
import { Root } from 'joi';
1011

1112
import { PluginInitializerContext } from 'src/core/server';
1213
import { plugin } from './server';
@@ -24,6 +25,7 @@ import {
2425
DEFAULT_FROM,
2526
DEFAULT_TO,
2627
DEFAULT_SIGNALS_INDEX,
28+
SIGNALS_INDEX_KEY,
2729
DEFAULT_SIGNALS_INDEX_KEY,
2830
} from './common/constants';
2931
import { defaultIndexPattern } from './default_index_pattern';
@@ -103,6 +105,8 @@ export const siem = (kibana: any) => {
103105
category: ['siem'],
104106
requiresPageReload: true,
105107
},
108+
// DEPRECATED: This should be removed once the front end is no longer using any parts of it.
109+
// TODO: Remove this as soon as no code is left that is pulling data from it.
106110
[DEFAULT_SIGNALS_INDEX_KEY]: {
107111
name: i18n.translate('xpack.siem.uiSettings.defaultSignalsIndexLabel', {
108112
defaultMessage: 'Elasticsearch signals index',
@@ -155,7 +159,11 @@ export const siem = (kibana: any) => {
155159
getInjectedUiAppVars,
156160
indexPatternsServiceFactory,
157161
injectUiAppVars,
158-
plugins: { alerting: plugins.alerting, xpack_main: plugins.xpack_main },
162+
plugins: {
163+
alerting: plugins.alerting,
164+
xpack_main: plugins.xpack_main,
165+
spaces: plugins.spaces,
166+
},
159167
route: route.bind(server),
160168
savedObjects,
161169
};
@@ -166,5 +174,13 @@ export const siem = (kibana: any) => {
166174
serverFacade
167175
);
168176
},
177+
config(Joi: Root) {
178+
return Joi.object()
179+
.keys({
180+
enabled: Joi.boolean().default(true),
181+
[SIGNALS_INDEX_KEY]: Joi.string().default(DEFAULT_SIGNALS_INDEX),
182+
})
183+
.default();
184+
},
169185
});
170186
};

x-pack/legacy/plugins/siem/scripts/convert_saved_search_to_rules.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ const allRulesNdJson = 'all_rules.ndjson';
4242
// For converting, if you want to use these instead of rely on the defaults then
4343
// comment these in and use them for the script. Otherwise this is commented out
4444
// so we can utilize the defaults of input and output which are based on saved objects
45-
// of siem:defaultIndex and siem:defaultSignalsIndex
45+
// of siem:defaultIndex and your kibana.dev.yml setting of xpack.siem.signalsIndex. If
46+
// the setting of xpack.siem.signalsIndex is not set it defaults to .siem-signals
4647
// const INDEX = ['auditbeat-*', 'filebeat-*', 'packetbeat-*', 'winlogbeat-*'];
47-
// const OUTPUT_INDEX = process.env.SIGNALS_INDEX || '.siem-signals';
48+
// const OUTPUT_INDEX = '.siem-signals-some-other-index';
4849

4950
const walk = dir => {
5051
const list = fs.readdirSync(dir);

0 commit comments

Comments
 (0)