[Background Search] Add maxSize to unbounded arrays#253411
[Background Search] Add maxSize to unbounded arrays#253411AlexGPlay merged 3 commits intoelastic:mainfrom
Conversation
| schema.literal('expired'), | ||
| ]), | ||
| errors: schema.maybe(schema.arrayOf(schema.string())), | ||
| errors: schema.maybe(schema.arrayOf(schema.string(), { maxSize: 10000 })), |
There was a problem hiding this comment.
in theory we can have as many errors as searches in the background search - I'm just going with the elasticsearch default max here
| export const searchSessionsFindSchema = schema.object({ | ||
| total: schema.number(), | ||
| saved_objects: schema.arrayOf(searchSessionSchema), | ||
| saved_objects: schema.arrayOf(searchSessionSchema, { maxSize: 10000 }), |
There was a problem hiding this comment.
this would be the page size for the management page, by default it's 100 but it can be tweaked with data.search.sessions.management.maxSessions
| schema.object({ id: schema.string(), type: schema.string(), name: schema.string() }), | ||
| { maxSize: 10 } |
There was a problem hiding this comment.
for this one i'm using a low number just for future proofing because as far as i've seen we don't get references, it's always undefined
There was a problem hiding this comment.
Hmm, this is odd, I wonder if we can remove this altogether. I think this might be a bug. Anyway, not important for this PR.
| updated_by: schema.maybe(schema.string()), | ||
| version: schema.maybe(schema.string()), | ||
| namespaces: schema.maybe(schema.arrayOf(schema.string())), | ||
| namespaces: schema.maybe(schema.arrayOf(schema.string(), { maxSize: 1 })), |
There was a problem hiding this comment.
namespaces should always be 1 as defined in the saved object definition:
There was a problem hiding this comment.
Mind adding a comment noting that?
| ), | ||
| filter: schema.maybe(schema.string()), | ||
| searchFields: schema.maybe(schema.arrayOf(schema.string())), | ||
| searchFields: schema.maybe(schema.arrayOf(schema.string(), { maxSize: 10 })), |
There was a problem hiding this comment.
similar to references i'm going with a low number for future proofing, right now we don't pass down any filter through the _find api so this is not being used
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]
Historycc @AlexGPlay |
|
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
## Summary Updates the `schema.arrayOf` in background search so they have a maxSize, this way the code scanning alerts from this area get fixed. ### Checklist - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels.
Summary
Updates the
schema.arrayOfin background search so they have a maxSize, this way the code scanning alerts from this area get fixed.Checklist
release_note:*label is applied per the guidelinesbackport:*labels.