-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
Summary
Kibana version: 8.10.0+
Describe the bug:
The data views swap_references API does not handle hidden saved objects, meaning some references (e.g. alerting rules) can be missed and left dangling after swapping references.
For example, this request:
POST /api/data_views/swap_references/_preview
{
"fromId" : "90943e30-9a47-11e8-b64d-95841ca0b247",
"toId" : "d3d7af60-4c81-11e8-b3d7-01146121b73d"
}
Returns this response:
{
"result": [
{
"id": "06cf9c40-9ee8-11e7-8711-e7a007dcef99",
"type": "visualization"
},
{
"id": "16b1d7d0-ea71-11eb-8b4b-f7b600de0f7d",
"type": "lens"
},
{
"id": "edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b",
"type": "dashboard"
},
{
"id": "de71f4f0-1902-11e9-919b-ffe5949a18d2",
"type": "map"
}
]
}When it should actually return this response including the hidden alert saved object:
{
"result": [
{
"id": "730c7728-e71e-4dd0-8998-4f9f1a5f4279",
"type": "alert"
},
{
"id": "06cf9c40-9ee8-11e7-8711-e7a007dcef99",
"type": "visualization"
},
{
"id": "16b1d7d0-ea71-11eb-8b4b-f7b600de0f7d",
"type": "lens"
},
{
"id": "edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b",
"type": "dashboard"
},
{
"id": "de71f4f0-1902-11e9-919b-ffe5949a18d2",
"type": "map"
}
]
}Steps to reproduce:
- Create a data view referenced by at least one hidden saved object (e.g. an alerting rule targeting the data view).
- Create another data view to use as the target when swapping references.
- Make a request to the
swap_referencesAPI like this:
POST /api/data_views/swap_references/_preview
{
"fromId" : "{SOURCE_DATA_VIEW_ID}",
"toId" : "{TARGET_DATA_VIEW_ID}"
}
- Observe that the
resultarray in the response does not include any hidden saved objects.
Expected behavior:
It should be possible to swap all saved object references, including for hidden saved objects, through the swap_references API.
Any additional context:
The current behaviour is a bug, but it could be possible that some consumers are depending on it working this way (seems unlikely though, it's pretty misleading right now). If we're concerned that changing the default behaviour could be a breaking change, we could consider instead supporting an includeHiddenObjects param or similar to enable it.
Hidden saved object approvals
We are tracking approvals from owning teams to include their existing hidden saved objects in the swap_references API. We believe this is the correct behaviour for the API given the dangling references bug outlined in this issue, but to be sure, we'd like to get each team's explicit approval.
Once the owning team has reviewed their hidden saved objects listed below, please check yourselves off the list to help with tracking. If you feel any or all of your hidden saved objects should not be included in the swap_references API, please leave a comment on this issue explaining why to discuss.
Approvals list
- @elastic/response-ops (11 types)
| Saved Object Type | Registration File |
|---|---|
action |
x-pack/platform/plugins/shared/actions/server/saved_objects/index.ts |
action_task_params |
x-pack/platform/plugins/shared/actions/server/saved_objects/index.ts |
connector_token |
x-pack/platform/plugins/shared/actions/server/saved_objects/index.ts |
ad_hoc_run_params |
x-pack/platform/plugins/shared/alerting/server/saved_objects/index.ts |
alert |
x-pack/platform/plugins/shared/alerting/server/saved_objects/index.ts |
alerting_rule_template |
x-pack/platform/plugins/shared/alerting/server/saved_objects/index.ts |
api_key_pending_invalidation |
x-pack/platform/plugins/shared/alerting/server/saved_objects/index.ts |
maintenance-window |
x-pack/platform/plugins/shared/alerting/server/saved_objects/index.ts |
rules-settings |
x-pack/platform/plugins/shared/alerting/server/saved_objects/index.ts |
background-task-node |
x-pack/platform/plugins/shared/task_manager/server/saved_objects/index.ts |
task |
x-pack/platform/plugins/shared/task_manager/server/saved_objects/index.ts |
Plugin kibana.jsonc files:
- Actions:
x-pack/platform/plugins/shared/actions/kibana.jsonc - Alerting:
x-pack/platform/plugins/shared/alerting/kibana.jsonc - Task Manager:
x-pack/platform/plugins/shared/task_manager/kibana.jsonc
- @elastic/kibana-cases (7 types)
| Saved Object Type | Registration File |
|---|---|
cases |
x-pack/platform/plugins/shared/cases/server/saved_object_types/index.ts |
cases-comments |
x-pack/platform/plugins/shared/cases/server/saved_object_types/index.ts |
cases-configure |
x-pack/platform/plugins/shared/cases/server/saved_object_types/index.ts |
cases-connector-mappings |
x-pack/platform/plugins/shared/cases/server/saved_object_types/index.ts |
cases-incrementing-id |
x-pack/platform/plugins/shared/cases/server/saved_object_types/index.ts |
cases-rules |
x-pack/platform/plugins/shared/cases/server/saved_object_types/index.ts |
cases-user-actions |
x-pack/platform/plugins/shared/cases/server/saved_object_types/index.ts |
Plugin kibana.jsonc: x-pack/platform/plugins/shared/cases/kibana.jsonc
- @elastic/kibana-core (5 types)
| Saved Object Type | Registration File |
|---|---|
cloud |
x-pack/platform/plugins/shared/cloud/server/saved_objects/index.ts |
core-usage-stats |
src/core/packages/usage-data/server-internal/src/saved_objects/core_usage_stats.ts |
dynamic-config-overrides |
src/core/packages/apps/server-internal/src/core_app.ts |
event_loop_delays_daily |
src/platform/plugins/private/kibana_usage_collection/server/saved_objects/event_loop_delays_daily.ts |
telemetry |
src/platform/plugins/shared/telemetry/server/saved_objects/register_telemetry_saved_object.ts |
Plugin kibana.jsonc files:
- Cloud:
x-pack/platform/plugins/shared/cloud/kibana.jsonc - Core usage stats: Core Kibana (no plugin kibana.jsonc)
- Dynamic config: Core Kibana (no plugin kibana.jsonc)
- Event loop delays:
src/platform/plugins/private/kibana_usage_collection/kibana.jsonc - Telemetry:
src/platform/plugins/shared/telemetry/kibana.jsonc
- @elastic/appex-sharedux (5 types)
| Saved Object Type | Registration File |
|---|---|
favorites |
src/platform/plugins/shared/content_management/server/favorites/favorites_saved_object.ts |
file |
src/platform/plugins/shared/files/server/saved_objects/file.ts |
fileShare |
src/platform/plugins/shared/files/server/saved_objects/file_share.ts |
intercept_interaction_record |
x-pack/platform/plugins/private/intercepts/server/saved_objects/intercept_user_interaction_record.ts |
intercept_trigger_record |
x-pack/platform/plugins/private/intercepts/server/saved_objects/intercept_trigger_record.ts |
Plugin kibana.jsonc files:
- Content Management:
src/platform/plugins/shared/content_management/kibana.jsonc - Files:
src/platform/plugins/shared/files/kibana.jsonc - Intercepts:
x-pack/platform/plugins/private/intercepts/kibana.jsonc
- @elastic/kibana-security (2 types)
| Saved Object Type | Registration File |
|---|---|
space |
x-pack/platform/plugins/shared/spaces/server/saved_objects/saved_objects_service.ts |
spaces-usage-stats |
x-pack/platform/plugins/shared/spaces/server/saved_objects/saved_objects_service.ts |
Plugin kibana.jsonc: x-pack/platform/plugins/shared/spaces/kibana.jsonc
- @elastic/security-solution (2 types)
| Saved Object Type | Registration File |
|---|---|
privmon-api-key |
x-pack/solutions/security/plugins/security_solution/server/lib/entity_analytics/privilege_monitoring/saved_objects/privmon_api_key.ts |
security:reference-data |
x-pack/solutions/security/plugins/security_solution/server/endpoint/lib/reference_data/saved_object_type.ts |
Plugin kibana.jsonc: x-pack/solutions/security/plugins/security_solution/kibana.jsonc
- @elastic/fleet (2 types)
| Saved Object Type | Registration File |
|---|---|
fleet-message-signing-keys |
x-pack/platform/plugins/shared/fleet/server/saved_objects/index.ts |
fleet-uninstall-tokens |
x-pack/platform/plugins/shared/fleet/server/saved_objects/index.ts |
Plugin kibana.jsonc: x-pack/platform/plugins/shared/fleet/kibana.jsonc
- @elastic/kibana-management (2 types)
| Saved Object Type | Registration File |
|---|---|
upgrade-assistant-ml-upgrade-operation |
packages/kbn-upgrade-assistant-pkg/src/server/saved_object_types/ml_upgrade_operation.ts |
upgrade-assistant-reindex-operation |
packages/kbn-upgrade-assistant-pkg/src/server/saved_object_types/reindex_operation.ts |
Plugin kibana.jsonc: x-pack/platform/plugins/private/upgrade_assistant/kibana.jsonc
- @elastic/kibana-visualizations, @elastic/kibana-data-discovery (1 type)
| Saved Object Type | Registration File |
|---|---|
search-session |
src/platform/plugins/shared/data/server/search/session/saved_object_type.ts |
Plugin kibana.jsonc: src/platform/plugins/shared/data/kibana.jsonc
- @elastic/obs-entities (1 type)
| Saved Object Type | Registration File |
|---|---|
entity-discovery-api-key |
x-pack/platform/plugins/shared/entity_manager/server/saved_objects/entity_discovery_api_key.ts |
Plugin kibana.jsonc: x-pack/platform/plugins/shared/entity_manager/kibana.jsonc
- @elastic/contextual-security-apps (1 type)
| Saved Object Type | Registration File |
|---|---|
cloud-security-posture-settings |
x-pack/solutions/security/plugins/cloud_security_posture/server/saved_objects/csp_settings.ts |
Plugin kibana.jsonc: x-pack/solutions/security/plugins/cloud_security_posture/kibana.jsonc
- @elastic/stack-monitoring (1 type)
| Saved Object Type | Registration File |
|---|---|
monitoring-telemetry |
x-pack/platform/plugins/private/monitoring/server/plugin.ts |
Plugin kibana.jsonc: x-pack/platform/plugins/private/monitoring/kibana.jsonc
- @elastic/appex-ai-infra (1 type)
| Saved Object Type | Registration File |
|---|---|
product-doc-install-status |
x-pack/platform/plugins/shared/ai_infra/product_doc_base/server/saved_objects/product_doc_install_status.ts |
Plugin kibana.jsonc: x-pack/platform/plugins/shared/ai_infra/product_doc_base/kibana.jsonc
- @elastic/obs-ux-management-team (1 type)
| Saved Object Type | Registration File |
|---|---|
uptime-synthetics-api-key |
x-pack/solutions/observability/plugins/synthetics/server/saved_objects/service_api_key.ts |
Plugin kibana.jsonc: x-pack/solutions/observability/plugins/synthetics/kibana.jsonc