Skip to content

Commit 5496674

Browse files
Add maxLength values to global_search/find schema (#272054)
## Summary This PR adds `maxLength` limits to `global_search/find` schema.
1 parent a927b4f commit 5496674

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

  • x-pack/platform/plugins/shared/global_search/server/routes

x-pack/platform/plugins/shared/global_search/server/routes/find.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@ export const registerInternalFindRoute = (router: GlobalSearchRouter) => {
2323
validate: {
2424
body: schema.object({
2525
params: schema.object({
26-
term: schema.maybe(schema.string()),
27-
types: schema.maybe(schema.arrayOf(schema.string(), { maxSize: 100 })),
28-
tags: schema.maybe(schema.arrayOf(schema.string(), { maxSize: 100 })),
26+
// maxLength: matches client-side `input_max_limit` config default (1000)
27+
// see x-pack/platform/plugins/private/global_search_bar/server/config.ts
28+
term: schema.maybe(schema.string({ maxLength: 1000 })),
29+
// maxLength: longest type is 'cloud-security-posture-settings' (31 chars), 128 adds buffer
30+
types: schema.maybe(
31+
schema.arrayOf(schema.string({ maxLength: 128 }), { maxSize: 100 })
32+
),
33+
// maxLength: tags are saved object UUIDs (36 chars), 128 adds buffer for non-standard IDs
34+
tags: schema.maybe(schema.arrayOf(schema.string({ maxLength: 128 }), { maxSize: 100 })),
2935
}),
3036
options: schema.maybe(
3137
schema.object({

0 commit comments

Comments
 (0)