[Infrastructure UI] Add strict payload validation to inventory_views endpoint#160852
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
467885d to
58b71bb
Compare
|
@elasticmachine merge upstream |
|
|
||
| return ( | ||
| <SavedViewsToolbarControls<MetricExplorerViewState> | ||
| <SavedViewsToolbarControls<any, MetricExplorerViewState> |
|
Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI) |
| rt.type({ | ||
| id: rt.string, | ||
| attributes: inventoryViewSavedObjectAttributesRT, | ||
| attributes: inventoryViewAttributesRT, |
There was a problem hiding this comment.
note: I think coupling the attributes to the type defined and used also for the API responses revert the changes made for the migrations to versioned APIs, where is states the persistence schema shouldn't be directly exposed. In terms of SO attributes definition, I think we should approach it as done for the logView SO on this PR. Wdyt?
There was a problem hiding this comment.
Good catch! thanks
| export const inventoryColorPaletteRT = rt.union([ | ||
| rt.literal('status'), | ||
| rt.literal('temperature'), | ||
| rt.literal('cool'), | ||
| rt.literal('warm'), | ||
| rt.literal('positive'), | ||
| rt.literal('negative'), | ||
| ]); |
There was a problem hiding this comment.
nit: we could use the rt.keyof function here too
| import { nonEmptyStringRt } from '@kbn/io-ts-utils'; | ||
| import * as rt from 'io-ts'; | ||
|
|
||
| export const findInventoryViewAttributesResponseRT = rt.strict({ |
There was a problem hiding this comment.
question: I remembered this was a strict type to strip out the non-essential properties for this endpoint when the response is encoded in the server, I think doing so it will now leak all SO attributes on this response for every saved view, could you verify that please?
There was a problem hiding this comment.
I didn't see any weird attributes. I'll check it again.
There was a problem hiding this comment.
Fixed it. thanks!
| import React from 'react'; | ||
| import { euiStyled } from '@kbn/kibana-react-plugin/common'; | ||
| import { InventoryColorPalette } from '../../../../../lib/lib'; | ||
| import type { InventoryColorPalette } from '../../../../../lib/lib'; |
There was a problem hiding this comment.
nit: just cause I noticed it in some other files and I see here the change is pretty specific, the import type syntax is useful to tell the bundler that if an import has runtime code but we just want to use it for typing (e.g. an enum or class have runtime code), we can use that syntax then to exclude from the bundling.
In this case InventoryColorPalette is a simple type with no runtime code, so the import can be the normal one as import type won't bring any benefit in this case.
There was a problem hiding this comment.
It doesn't hurt to keep anyway, it's non-blocking at all :)
tonyghiani
left a comment
There was a problem hiding this comment.
LGTM, thanks for the changes 👏
|
@elasticmachine merge upstream |
| rt.type({ | ||
| id: rt.string, | ||
| attributes: inventoryViewSavedObjectAttributesRT, | ||
| attributes: inventoryViewsSavedObjectAttributesRT, |
There was a problem hiding this comment.
perhaps we should keep this as not plural, inventoryViewSavedObjectAttributesRT instead of inventoryViewsSavedObjectAttributesRT for consistency's sake with InventoryViewSavedObject below.
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
* main: (354 commits) [Synthetics] Overview page fix last refresh value display (elastic#161086) [Synthetics] Remove TLS alert option for ICMP monitor (elastic#161173) fixing the path of manifets for hints autodiscover (elastic#161075) [Fleet] Fix permissions in integrations Assets page (elastic#161233) Update publicBaseUrl warning id (elastic#161204) [ML] Fix Anomaly Explorer URL for alerting context with non-default space (elastic#160899) [Enterprise Search]Add 404 error handling for mappings and documents endpoints (elastic#161203) [Logs Shared] Move LogStream and LogView into new shared plugin (elastic#161151) [Security Solutions] Fix CellActions component should hide ShowTopN action for nested fields (elastic#159645) [SecuritySolutions] Remove filter actions from Cases alerts table and fix show_top_n action (elastic#161150) [Infrastructure UI] Add strict payload validation to inventory_views endpoint (elastic#160852) [api-docs] 2023-07-05 Daily api_docs build (elastic#161225) Fix errors in custom metric payload in SLO dev docs (elastic#161141) [data views] Fix overwrite param for create (elastic#160953) [Synthetics] Perform params API HTTP migration (elastic#160575) [Cloud Security][FTR]Refactor API FTR to use .to.eql instead of .to.be (elastic#160694) Have SLO routes return a 403 instead of a 400 when user has an insufficient license (elastic#161193) [Discover] Fix shared links flaky test (elastic#161172) [ftr] Improve FTR error handling for NoSuchSessionError (elastic#161025) skip flaky suite (elastic#151981) ...
* main: (354 commits) [Synthetics] Overview page fix last refresh value display (elastic#161086) [Synthetics] Remove TLS alert option for ICMP monitor (elastic#161173) fixing the path of manifets for hints autodiscover (elastic#161075) [Fleet] Fix permissions in integrations Assets page (elastic#161233) Update publicBaseUrl warning id (elastic#161204) [ML] Fix Anomaly Explorer URL for alerting context with non-default space (elastic#160899) [Enterprise Search]Add 404 error handling for mappings and documents endpoints (elastic#161203) [Logs Shared] Move LogStream and LogView into new shared plugin (elastic#161151) [Security Solutions] Fix CellActions component should hide ShowTopN action for nested fields (elastic#159645) [SecuritySolutions] Remove filter actions from Cases alerts table and fix show_top_n action (elastic#161150) [Infrastructure UI] Add strict payload validation to inventory_views endpoint (elastic#160852) [api-docs] 2023-07-05 Daily api_docs build (elastic#161225) Fix errors in custom metric payload in SLO dev docs (elastic#161141) [data views] Fix overwrite param for create (elastic#160953) [Synthetics] Perform params API HTTP migration (elastic#160575) [Cloud Security][FTR]Refactor API FTR to use .to.eql instead of .to.be (elastic#160694) Have SLO routes return a 403 instead of a 400 when user has an insufficient license (elastic#161193) [Discover] Fix shared links flaky test (elastic#161172) [ftr] Improve FTR error handling for NoSuchSessionError (elastic#161025) skip flaky suite (elastic#151981) ...
…_views endpoint (#160982) closes [#157520](#157520) ## Summary This PR adds strict payload validation to `metrics_explorer_views` endpoint. This PR depends on this to be merged #160852 ### How to test - Call the endpoint below trying to use invalid values. see [here](https://github.com/elastic/kibana/pull/160982/files#diff-4573683b3b62cdf5f6426ec345b7ad6c7d6e6328237b213ca7519f686d8fa951R125-R131). ```bash [POST|PUT] kbn:/api/infra/metrics_explorer_views { "attributes": { "name": "Ad-hoc", "options": { "aggregation": "avg", "metrics": [ { "aggregation": "avg", "field": "system.cpu.total.norm.pct", "color": "color0" }, ], "source": "default", "groupBy": [ "host.name" ] }, "chartOptions": { "type": "line", "yAxisMode": "fromZero", "stack": false }, "currentTimerange": { "from": "now-1h", "to": "now", "interval": ">=10s" } } } ``` - Set up a local Kibana instance - Navigate to `Infrastructure > Metrics Explorer` - In the UI, use the Saved View feature and try different field combinations --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
## Summary Fixes #187254 Strict checks on the attribute `legend.steps` was added to the inventory view API in v8.10 (#160852), but they were not defined in the saved object type for that data, resulting in older versions migrating bad data, and being unable to use the API. This PR adds versioning to the Inventory view saved object type that constrains legend.steps to between 2 and 18, per the strict typing added in #160852 #### Open questions Should we add notes to all versions of kibana between v8.10 and oldest version available for backport describing this bug? ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [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) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary Fixes elastic#187254 Strict checks on the attribute `legend.steps` was added to the inventory view API in v8.10 (elastic#160852), but they were not defined in the saved object type for that data, resulting in older versions migrating bad data, and being unable to use the API. This PR adds versioning to the Inventory view saved object type that constrains legend.steps to between 2 and 18, per the strict typing added in elastic#160852 #### Open questions Should we add notes to all versions of kibana between v8.10 and oldest version available for backport describing this bug? ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [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) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit a108c63) # Conflicts: # x-pack/solutions/observability/plugins/infra/tsconfig.json
## Summary Fixes elastic#187254 Strict checks on the attribute `legend.steps` was added to the inventory view API in v8.10 (elastic#160852), but they were not defined in the saved object type for that data, resulting in older versions migrating bad data, and being unable to use the API. This PR adds versioning to the Inventory view saved object type that constrains legend.steps to between 2 and 18, per the strict typing added in elastic#160852 #### Open questions Should we add notes to all versions of kibana between v8.10 and oldest version available for backport describing this bug? ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [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) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit a108c63) # Conflicts: # x-pack/plugins/observability_solution/infra/server/saved_objects/inventory_view/inventory_view_saved_object.test.ts # x-pack/plugins/observability_solution/infra/tsconfig.json
) # Backport This will backport the following commits from `main` to `8.x`: - [Added versioning to inventory_view_saved_object (#207007)](#207007) <!--- Backport version: 9.6.4 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Bryce Buchanan","email":"75274611+bryce-b@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-01-27T18:09:32Z","message":"Added versioning to inventory_view_saved_object (#207007)\n\n## Summary\r\n\r\nFixes #187254 \r\nStrict checks on the attribute `legend.steps` was added to the inventory\r\nview API in v8.10 (#160852), but they were not defined in the\r\nsaved object type for that data, resulting in older versions migrating\r\nbad data, and being unable to use the API. This PR adds versioning to\r\nthe Inventory view saved object type that constrains legend.steps to\r\nbetween 2 and 18, per the strict typing added in #160852\r\n\r\n#### Open questions\r\nShould we add notes to all versions of kibana between v8.10 and oldest\r\nversion available for backport describing this bug?\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"a108c632a459240f9c27262395e2584f92d43779","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:fix","backport missing","v9.0.0","Team:obs-ux-infra_services"],"title":"Added versioning to inventory_view_saved_object","number":207007,"url":"https://github.com/elastic/kibana/pull/207007","mergeCommit":{"message":"Added versioning to inventory_view_saved_object (#207007)\n\n## Summary\r\n\r\nFixes #187254 \r\nStrict checks on the attribute `legend.steps` was added to the inventory\r\nview API in v8.10 (#160852), but they were not defined in the\r\nsaved object type for that data, resulting in older versions migrating\r\nbad data, and being unable to use the API. This PR adds versioning to\r\nthe Inventory view saved object type that constrains legend.steps to\r\nbetween 2 and 18, per the strict typing added in #160852\r\n\r\n#### Open questions\r\nShould we add notes to all versions of kibana between v8.10 and oldest\r\nversion available for backport describing this bug?\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"a108c632a459240f9c27262395e2584f92d43779"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/207007","number":207007,"mergeCommit":{"message":"Added versioning to inventory_view_saved_object (#207007)\n\n## Summary\r\n\r\nFixes #187254 \r\nStrict checks on the attribute `legend.steps` was added to the inventory\r\nview API in v8.10 (#160852), but they were not defined in the\r\nsaved object type for that data, resulting in older versions migrating\r\nbad data, and being unable to use the API. This PR adds versioning to\r\nthe Inventory view saved object type that constrains legend.steps to\r\nbetween 2 and 18, per the strict typing added in #160852\r\n\r\n#### Open questions\r\nShould we add notes to all versions of kibana between v8.10 and oldest\r\nversion available for backport describing this bug?\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"a108c632a459240f9c27262395e2584f92d43779"}}]}] BACKPORT-->
…1632) # Backport This will backport the following commits from `main` to `8.18`: - [Added versioning to inventory_view_saved_object (#207007)](#207007) <!--- Backport version: 9.6.4 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Bryce Buchanan","email":"75274611+bryce-b@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-01-27T18:09:32Z","message":"Added versioning to inventory_view_saved_object (#207007)\n\n## Summary\r\n\r\nFixes #187254 \r\nStrict checks on the attribute `legend.steps` was added to the inventory\r\nview API in v8.10 (#160852), but they were not defined in the\r\nsaved object type for that data, resulting in older versions migrating\r\nbad data, and being unable to use the API. This PR adds versioning to\r\nthe Inventory view saved object type that constrains legend.steps to\r\nbetween 2 and 18, per the strict typing added in #160852\r\n\r\n#### Open questions\r\nShould we add notes to all versions of kibana between v8.10 and oldest\r\nversion available for backport describing this bug?\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"a108c632a459240f9c27262395e2584f92d43779","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:fix","backport missing","v9.0.0","Team:obs-ux-infra_services"],"title":"Added versioning to inventory_view_saved_object","number":207007,"url":"https://github.com/elastic/kibana/pull/207007","mergeCommit":{"message":"Added versioning to inventory_view_saved_object (#207007)\n\n## Summary\r\n\r\nFixes #187254 \r\nStrict checks on the attribute `legend.steps` was added to the inventory\r\nview API in v8.10 (#160852), but they were not defined in the\r\nsaved object type for that data, resulting in older versions migrating\r\nbad data, and being unable to use the API. This PR adds versioning to\r\nthe Inventory view saved object type that constrains legend.steps to\r\nbetween 2 and 18, per the strict typing added in #160852\r\n\r\n#### Open questions\r\nShould we add notes to all versions of kibana between v8.10 and oldest\r\nversion available for backport describing this bug?\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"a108c632a459240f9c27262395e2584f92d43779"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/207007","number":207007,"mergeCommit":{"message":"Added versioning to inventory_view_saved_object (#207007)\n\n## Summary\r\n\r\nFixes #187254 \r\nStrict checks on the attribute `legend.steps` was added to the inventory\r\nview API in v8.10 (#160852), but they were not defined in the\r\nsaved object type for that data, resulting in older versions migrating\r\nbad data, and being unable to use the API. This PR adds versioning to\r\nthe Inventory view saved object type that constrains legend.steps to\r\nbetween 2 and 18, per the strict typing added in #160852\r\n\r\n#### Open questions\r\nShould we add notes to all versions of kibana between v8.10 and oldest\r\nversion available for backport describing this bug?\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"a108c632a459240f9c27262395e2584f92d43779"}}]}] BACKPORT-->
…1634) # Backport This will backport the following commits from `main` to `8.17`: - [Added versioning to inventory_view_saved_object (#207007)](#207007) <!--- Backport version: 9.6.4 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Bryce Buchanan","email":"75274611+bryce-b@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-01-27T18:09:32Z","message":"Added versioning to inventory_view_saved_object (#207007)\n\n## Summary\r\n\r\nFixes #187254 \r\nStrict checks on the attribute `legend.steps` was added to the inventory\r\nview API in v8.10 (#160852), but they were not defined in the\r\nsaved object type for that data, resulting in older versions migrating\r\nbad data, and being unable to use the API. This PR adds versioning to\r\nthe Inventory view saved object type that constrains legend.steps to\r\nbetween 2 and 18, per the strict typing added in #160852\r\n\r\n#### Open questions\r\nShould we add notes to all versions of kibana between v8.10 and oldest\r\nversion available for backport describing this bug?\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"a108c632a459240f9c27262395e2584f92d43779","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:fix","backport missing","v9.0.0","Team:obs-ux-infra_services"],"title":"Added versioning to inventory_view_saved_object","number":207007,"url":"https://github.com/elastic/kibana/pull/207007","mergeCommit":{"message":"Added versioning to inventory_view_saved_object (#207007)\n\n## Summary\r\n\r\nFixes #187254 \r\nStrict checks on the attribute `legend.steps` was added to the inventory\r\nview API in v8.10 (#160852), but they were not defined in the\r\nsaved object type for that data, resulting in older versions migrating\r\nbad data, and being unable to use the API. This PR adds versioning to\r\nthe Inventory view saved object type that constrains legend.steps to\r\nbetween 2 and 18, per the strict typing added in #160852\r\n\r\n#### Open questions\r\nShould we add notes to all versions of kibana between v8.10 and oldest\r\nversion available for backport describing this bug?\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"a108c632a459240f9c27262395e2584f92d43779"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/207007","number":207007,"mergeCommit":{"message":"Added versioning to inventory_view_saved_object (#207007)\n\n## Summary\r\n\r\nFixes #187254 \r\nStrict checks on the attribute `legend.steps` was added to the inventory\r\nview API in v8.10 (#160852), but they were not defined in the\r\nsaved object type for that data, resulting in older versions migrating\r\nbad data, and being unable to use the API. This PR adds versioning to\r\nthe Inventory view saved object type that constrains legend.steps to\r\nbetween 2 and 18, per the strict typing added in #160852\r\n\r\n#### Open questions\r\nShould we add notes to all versions of kibana between v8.10 and oldest\r\nversion available for backport describing this bug?\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"a108c632a459240f9c27262395e2584f92d43779"}}]}] BACKPORT-->
closes #157505
fixes #157740
Summary
This PR adds strict payload validation to
inventory_viewsendpoint. I tried to make the types consistent between sever and frontend code and because of that more changes had to be made. I also refactored thetoolbar_controlcomponent, decoupling them from Inventory View and Metrics Explorer View typesHow to test
Infrastructure