Skip to content

Commit 61078aa

Browse files
committed
Use @kbn/config-schema (not validate: false) on routes!
1 parent c47884c commit 61078aa

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

x-pack/legacy/plugins/watcher/server/np_ready/routes/api/indices/register_get_route.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7+
import { schema } from '@kbn/config-schema';
78
import { RequestHandler } from 'src/core/server';
89
import { reduce, size } from 'lodash';
910
import { callWithRequestFactory } from '../../../lib/call_with_request_factory';
@@ -82,7 +83,9 @@ export function registerGetRoute(deps: RouteDependencies, legacy: ServerShim) {
8283
deps.router.post(
8384
{
8485
path: '/api/watcher/indices',
85-
validate: false,
86+
validate: {
87+
body: schema.object({}, { allowUnknowns: true }),
88+
},
8689
},
8790
licensePreRoutingFactory(legacy, handler)
8891
);

x-pack/legacy/plugins/watcher/server/np_ready/routes/api/register_list_fields_route.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7+
import { schema } from '@kbn/config-schema';
78
import { RequestHandler } from 'src/core/server';
89
import { callWithRequestFactory } from '../../lib/call_with_request_factory';
910
import { isEsError } from '../../lib/is_es_error';
@@ -53,7 +54,11 @@ export function registerListFieldsRoute(deps: RouteDependencies, legacy: ServerS
5354
deps.router.post(
5455
{
5556
path: '/api/watcher/fields',
56-
validate: false,
57+
validate: {
58+
body: schema.object({
59+
indexes: schema.arrayOf(schema.string()),
60+
}),
61+
},
5762
},
5863
licensePreRoutingFactory(legacy, handler)
5964
);

0 commit comments

Comments
 (0)