Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.12] [Security Solution] Rule upgrade JSON diff: Hide runtime and i…
…nternal properties (#174789) (#175625) # Backport This will backport the following commits from `main` to `8.12`: - [[Security Solution] Rule upgrade JSON diff: Hide runtime and internal properties (#174789)](#174789) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Nikita Indik","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-01-25T17:25:23Z","message":"[Security Solution] Rule upgrade JSON diff: Hide runtime and internal properties (#174789)\n\n**Resolves: https://github.com/elastic/kibana/issues/174844**\r\n\r\n## Summary\r\nHides technical/runtime fields that shouldn't be displayed in the JSON\r\ndiff view.\r\nWe used to hide only the `revision` field because it can be confused\r\nwith `version`. This PR hides more fields.\r\n\r\nProperties that might be displayed as having diff, but shouldn't:\r\n- `actions`: shown as diff if user defined an action for a rule\r\n- `exceptions_list`: shown as diff if user defined an exception list for\r\na rule\r\n- `execution_summary`: shown as diff if user has enabled a rule and it\r\nexecuted at least once\r\n- `enabled`: shown as diff if user enabled a rule that's disabled by\r\ndefault (or vice versa)\r\n- `updated_at`: always shown as diff because its value is a timestamp of\r\nwhen an API request made\r\n- `from`: might be shown as diff if user has clicked \"save\" after\r\nediting a rule, because edit screen's FE code converts value to a\r\ndifferent time unit, like 2h -> 7200s\r\n- `note`: shown as diff if an old version of a rule didn't define this\r\nproperty, but a new version of a rule has it defined as ''\r\n- `threat`: might be shown as diff if user has clicked \"save\" after\r\nediting a rule, because edit screen's FE code adds empty arrays as\r\ndefaults if threats/techniques/subtechniques weren't set by the user\r\n- `machine_learning_job_id`: might be shown as diff if a prebuilt rule\r\nuses the legacy string format for this property. On installation, the\r\nvalue is converted into a new array format, which creates a difference\r\nbetween the installed rule (array format) and the update (string format)\r\n- `threat_filters`: might be shown as diff if user has clicked \"save\"\r\nafter editing a rule, because edit screen's FE code adds null as a\r\ndefault value for \"meta\" subproperty\r\n- `filters`: might be shown as diff if user has clicked \"save\" after\r\nediting a rule, because edit screen's FE code adds [] as a default value\r\n- `timestamp_override_fallback_disabled`: might be shown as diff if user\r\nhas clicked \"save\" after editing a rule\r\n- `meta`: might be shown as diff if user has clicked \"save\" after\r\nediting a rule\r\n- `output_index`: unused, shouldn't be shown\r\n- `updated_at`, `updated_by`, `created_at`, `created_by`: should be\r\nhidden because these are not relevant for the upgrade flow\r\n\r\n\r\n\r\n#### Before\r\n<img width=\"1271\" alt=\"Schermafbeelding 2024-01-16 om 13 50 00\"\r\nsrc=\"https://github.com/elastic/kibana/assets/15949146/f72283dc-9a8a-4c95-a9b6-daa84d9356da\">\r\n\r\n\r\n\r\n#### After\r\n<img width=\"1271\" alt=\"Schermafbeelding 2024-01-16 om 13 50 36\"\r\nsrc=\"https://github.com/elastic/kibana/assets/15949146/080ef2ea-c108-4d05-8814-0a2ce7f5a0b0\">","sha":"5bf935b5c30dd489ce381fc337e674443349940c","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Detections and Resp","Team: SecuritySolution","Team:Detection Rule Management","Feature:Prebuilt Detection Rules","v8.12.1","v8.13.0"],"title":"[Security Solution] Rule upgrade JSON diff: Hide runtime and internal properties","number":174789,"url":"https://github.com/elastic/kibana/pull/174789","mergeCommit":{"message":"[Security Solution] Rule upgrade JSON diff: Hide runtime and internal properties (#174789)\n\n**Resolves: https://github.com/elastic/kibana/issues/174844**\r\n\r\n## Summary\r\nHides technical/runtime fields that shouldn't be displayed in the JSON\r\ndiff view.\r\nWe used to hide only the `revision` field because it can be confused\r\nwith `version`. This PR hides more fields.\r\n\r\nProperties that might be displayed as having diff, but shouldn't:\r\n- `actions`: shown as diff if user defined an action for a rule\r\n- `exceptions_list`: shown as diff if user defined an exception list for\r\na rule\r\n- `execution_summary`: shown as diff if user has enabled a rule and it\r\nexecuted at least once\r\n- `enabled`: shown as diff if user enabled a rule that's disabled by\r\ndefault (or vice versa)\r\n- `updated_at`: always shown as diff because its value is a timestamp of\r\nwhen an API request made\r\n- `from`: might be shown as diff if user has clicked \"save\" after\r\nediting a rule, because edit screen's FE code converts value to a\r\ndifferent time unit, like 2h -> 7200s\r\n- `note`: shown as diff if an old version of a rule didn't define this\r\nproperty, but a new version of a rule has it defined as ''\r\n- `threat`: might be shown as diff if user has clicked \"save\" after\r\nediting a rule, because edit screen's FE code adds empty arrays as\r\ndefaults if threats/techniques/subtechniques weren't set by the user\r\n- `machine_learning_job_id`: might be shown as diff if a prebuilt rule\r\nuses the legacy string format for this property. On installation, the\r\nvalue is converted into a new array format, which creates a difference\r\nbetween the installed rule (array format) and the update (string format)\r\n- `threat_filters`: might be shown as diff if user has clicked \"save\"\r\nafter editing a rule, because edit screen's FE code adds null as a\r\ndefault value for \"meta\" subproperty\r\n- `filters`: might be shown as diff if user has clicked \"save\" after\r\nediting a rule, because edit screen's FE code adds [] as a default value\r\n- `timestamp_override_fallback_disabled`: might be shown as diff if user\r\nhas clicked \"save\" after editing a rule\r\n- `meta`: might be shown as diff if user has clicked \"save\" after\r\nediting a rule\r\n- `output_index`: unused, shouldn't be shown\r\n- `updated_at`, `updated_by`, `created_at`, `created_by`: should be\r\nhidden because these are not relevant for the upgrade flow\r\n\r\n\r\n\r\n#### Before\r\n<img width=\"1271\" alt=\"Schermafbeelding 2024-01-16 om 13 50 00\"\r\nsrc=\"https://github.com/elastic/kibana/assets/15949146/f72283dc-9a8a-4c95-a9b6-daa84d9356da\">\r\n\r\n\r\n\r\n#### After\r\n<img width=\"1271\" alt=\"Schermafbeelding 2024-01-16 om 13 50 36\"\r\nsrc=\"https://github.com/elastic/kibana/assets/15949146/080ef2ea-c108-4d05-8814-0a2ce7f5a0b0\">","sha":"5bf935b5c30dd489ce381fc337e674443349940c"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/174789","number":174789,"mergeCommit":{"message":"[Security Solution] Rule upgrade JSON diff: Hide runtime and internal properties (#174789)\n\n**Resolves: https://github.com/elastic/kibana/issues/174844**\r\n\r\n## Summary\r\nHides technical/runtime fields that shouldn't be displayed in the JSON\r\ndiff view.\r\nWe used to hide only the `revision` field because it can be confused\r\nwith `version`. This PR hides more fields.\r\n\r\nProperties that might be displayed as having diff, but shouldn't:\r\n- `actions`: shown as diff if user defined an action for a rule\r\n- `exceptions_list`: shown as diff if user defined an exception list for\r\na rule\r\n- `execution_summary`: shown as diff if user has enabled a rule and it\r\nexecuted at least once\r\n- `enabled`: shown as diff if user enabled a rule that's disabled by\r\ndefault (or vice versa)\r\n- `updated_at`: always shown as diff because its value is a timestamp of\r\nwhen an API request made\r\n- `from`: might be shown as diff if user has clicked \"save\" after\r\nediting a rule, because edit screen's FE code converts value to a\r\ndifferent time unit, like 2h -> 7200s\r\n- `note`: shown as diff if an old version of a rule didn't define this\r\nproperty, but a new version of a rule has it defined as ''\r\n- `threat`: might be shown as diff if user has clicked \"save\" after\r\nediting a rule, because edit screen's FE code adds empty arrays as\r\ndefaults if threats/techniques/subtechniques weren't set by the user\r\n- `machine_learning_job_id`: might be shown as diff if a prebuilt rule\r\nuses the legacy string format for this property. On installation, the\r\nvalue is converted into a new array format, which creates a difference\r\nbetween the installed rule (array format) and the update (string format)\r\n- `threat_filters`: might be shown as diff if user has clicked \"save\"\r\nafter editing a rule, because edit screen's FE code adds null as a\r\ndefault value for \"meta\" subproperty\r\n- `filters`: might be shown as diff if user has clicked \"save\" after\r\nediting a rule, because edit screen's FE code adds [] as a default value\r\n- `timestamp_override_fallback_disabled`: might be shown as diff if user\r\nhas clicked \"save\" after editing a rule\r\n- `meta`: might be shown as diff if user has clicked \"save\" after\r\nediting a rule\r\n- `output_index`: unused, shouldn't be shown\r\n- `updated_at`, `updated_by`, `created_at`, `created_by`: should be\r\nhidden because these are not relevant for the upgrade flow\r\n\r\n\r\n\r\n#### Before\r\n<img width=\"1271\" alt=\"Schermafbeelding 2024-01-16 om 13 50 00\"\r\nsrc=\"https://github.com/elastic/kibana/assets/15949146/f72283dc-9a8a-4c95-a9b6-daa84d9356da\">\r\n\r\n\r\n\r\n#### After\r\n<img width=\"1271\" alt=\"Schermafbeelding 2024-01-16 om 13 50 36\"\r\nsrc=\"https://github.com/elastic/kibana/assets/15949146/080ef2ea-c108-4d05-8814-0a2ce7f5a0b0\">","sha":"5bf935b5c30dd489ce381fc337e674443349940c"}}]}] BACKPORT--> Co-authored-by: Nikita Indik <[email protected]>
- Loading branch information