Skip to content

[Security Solution] Fix enable/disable action for rules with non-migrated lastRun.outcomeMsg#258105

Merged
maximpn merged 3 commits intoelastic:mainfrom
maximpn:fix-legacy-rules-enabling-disabling
Mar 25, 2026
Merged

[Security Solution] Fix enable/disable action for rules with non-migrated lastRun.outcomeMsg#258105
maximpn merged 3 commits intoelastic:mainfrom
maximpn:fix-legacy-rules-enabling-disabling

Conversation

@maximpn
Copy link
Copy Markdown
Contributor

@maximpn maximpn commented Mar 17, 2026

Resolves: #177852
Relates to: #251164

Summary

This PR fixes an issue blocking enabling and disabling security rules with non-migrated lastRun.outcomeMsg field.

Details

Some time ago Alerting Framework migrated lastRun.outcomeMsg from string to string[]. At that moment usual migrations were deprecated due to Serverless and model version migration wasn't ready yet. This migration went smoothly thanks to the according changes to the codebase. However, the changes didn't cover customers upgrading from 7.x stack version and having something written to lastRun.outcomeMsg.

#251164 fixed the issue appearing in attempt to update prebuilt rules.

This PR fixes the left issue blocking enabling and disabling non-migrated security rules with lastRun.outcomeMsg type string field.

Testing

  • Start Kibana
  • Log in under system_indices_superuser to be able to write to the system indices
  • Create a rule by using the command below
  • Enable/Disable the rule
  • Perform any other bulk and non-bulk actions on the rule

ER: All actions should work without errors.

Without this fix enable/disable action will result in error.

ES command to put a non-migrated rule
PUT .kibana_alerting_cases/_doc/alert:d62167ce-1022-4b2c-915d-024fe3e6e557
{
    "alert": {
      "name": "Test rule 1",
      "tags": [],
      "enabled": false,
      "alertTypeId": "siem.queryRule",
      "consumer": "siem",
      "legacyId": null,
      "schedule": {
        "interval": "5m"
      },
      "actions": [],
      "params": {
        "author": [],
        "description": "123",
        "falsePositives": [],
        "from": "now-6m",
        "ruleId": "5ecfb16d-5af2-4a31-b880-319a4a2ca92b",
        "immutable": false,
        "ruleSource": {
          "type": "internal"
        },
        "license": "",
        "outputIndex": "",
        "meta": {
          "kibana_siem_app_url": "http://localhost:5601/kbn/app/security"
        },
        "maxSignals": 100,
        "riskScore": 21,
        "riskScoreMapping": [],
        "severity": "low",
        "severityMapping": [],
        "threat": [],
        "to": "now",
        "references": [],
        "version": 1,
        "exceptionsList": [],
        "relatedIntegrations": [],
        "requiredFields": [],
        "setup": "",
        "type": "query",
        "language": "kuery",
        "index": [
          "apm-*-transaction*",
          "auditbeat-*",
          "endgame-*",
          "filebeat-*",
          "logs-*",
          "packetbeat-*",
          "traces-apm*",
          "winlogbeat-*",
          "-*elastic-cloud-logs-*"
        ],
        "query": "*:*",
        "filters": []
      },
      "mapped_params": {
        "risk_score": 21,
        "severity": "20-low"
      },
      "createdBy": "elastic",
      "updatedBy": "elastic",
      "createdAt": "2026-03-17T10:52:28.688Z",
      "updatedAt": "2026-03-17T10:52:28.688Z",
      "apiKey": null,
      "apiKeyOwner": null,
      "apiKeyCreatedByUser": null,
      "throttle": null,
      "notifyWhen": null,
      "muteAll": false,
      "mutedInstanceIds": [],
      "executionStatus": {
        "status": "pending",
        "lastExecutionDate": "2026-03-17T10:52:28.688Z"
      },
      "monitoring": {
        "run": {
          "history": [],
          "calculated_metrics": {
            "success_ratio": 0
          },
          "last_run": {
            "timestamp": "2026-03-17T10:52:28.688Z",
            "metrics": {
              "duration": 0,
              "total_search_duration_ms": null,
              "total_indexing_duration_ms": null,
              "total_alerts_detected": null,
              "total_alerts_created": null,
              "gap_duration_s": null
            }
          }
        }
      },
      "lastRun": {
        "outcome": "failed",
        "outcomeMsg": "security_exception: [security_exception] Reason: missing authentication credentials for REST request [/_security/user/_has_privileges], caused by: \"\"",
        "warning": "read",
        "alertsCount": {},
        "outcomeOrder": 20
    },
      "snoozeSchedule": [],
      "revision": 0,
      "running": false,
      "artifacts": {
        "dashboards": [],
        "investigation_guide": {
          "blob": ""
        }
      },
      "meta": {
        "versionApiKeyLastmodified": "9.4.0"
      }
    },
    "type": "alert",
    "references": [],
    "managed": false,
    "namespaces": [
      "default"
    ],
    "coreMigrationVersion": "8.8.0",
    "typeMigrationVersion": "10.10.0",
    "updated_at": "2026-03-17T10:52:28.688Z",
    "created_at": "2026-03-17T10:52:28.688Z"
  }

@maximpn maximpn self-assigned this Mar 17, 2026
@maximpn maximpn added bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Feature:Rule Management Security Solution Detection Rule Management area Team:Detection Rule Management Security Detection Rule Management Team backport:version Backport to applied version labels v9.4.0 v8.19.13 v9.2.7 v9.3.2 labels Mar 17, 2026
@maximpn maximpn changed the title fix enable/disable action for rules with non-migrated lastRun.outcomeMsg [Security Solution] Fix enable/disable action for rules with non-migrated lastRun.outcomeMsg Mar 17, 2026
@maximpn maximpn marked this pull request as ready for review March 17, 2026 13:36
@maximpn maximpn requested a review from a team as a code owner March 17, 2026 13:36
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management)

@maximpn maximpn added the ci:cloud-deploy Create or update a Cloud deployment label Mar 17, 2026
@chetnarajput-qasource
Copy link
Copy Markdown

Hi @maximpn

We attempted to set up the PR with the local Kibana environment. At our end, the setup completes without errors, but the UI does not load in the browser.

Below are the details for reference:

Kibana Configuration (kibana.yml):
kibana.yml

Terminal Output:
TerminalOutput.rtf

Screenshot:
image

Could you please help us identify if anything is missing or misconfigured, or suggest any additional steps to troubleshoot this issue?

Thanks

cc @pborgonovi

@maximpn maximpn added the ci:cloud-persist-deployment Persist cloud deployment indefinitely label Mar 23, 2026
@maximpn
Copy link
Copy Markdown
Contributor Author

maximpn commented Mar 23, 2026

Hi @chetnarajput-qasource,

I've added labels to create a ECH deployment. You may use this one for testing.

Alternatively you may test it locally. In that case you should have git, node.js and yarn installed. There is extra info in Getting Started Kibana Developer Guide (internal).

When the dependencies are installed to run Kibana may perform the following steps

  • pull my Kibana fork
  • checkout to fix-legacy-rules-enabling-disabling branch
  • bootstrap Kibana by running
yarn kbn bootstrap && node scripts/build_kibana_platform_plugins
  • start Elasticsearch by running
yarn es snapshot --license trial -E xpack.security.authc.api_key.enabled=true
  • start Kibana in another terminal by running
yarn start

@chetnarajput-qasource
Copy link
Copy Markdown

Hi @maximpn

Thanks for sharing the ECH deployment. We have successfully validated the issue using it, and it was very helpful.

We have validated this issue on 9.4.0 snapshot build and verified that issue is fixed there 🟢

Please find below the testing details:

Build details

VERSION: 9.4.0
BUILD: 99339
COMMIT: a00477027cdcb0bf7ec3b4ac7e9c7bc32b5f31db

Observations:

  1. We logged in using the system_indices_superuser role and executed provided ES command from Dev Tools to create a non-migrated rule. We observed that the user was able to create the rule successfully and could enable and disable rule both individually and through bulk actions without any errors.
ES.command.to.put.a.non-migrated.rule.-.enable.disable.mp4
Role Description
{
  "system_indices_superuser": {
    "cluster": [],
    "indices": [
      {
        "names": [
          ".kibana_*",
          ".security*",
          ".alerts-*"
        ],
        "privileges": [
          "all"
        ],
        "allow_restricted_indices": true
      }
    ],
    "applications": [
      {
        "application": "kibana-.kibana",
        "privileges": [
          "all"
        ],
        "resources": [
          "*"
        ]
      }
    ],
    "run_as": [],
    "metadata": {},
    "transient_metadata": {
      "enabled": true
    }
  }
}
  1. We verified the issue with elastic user and installed all the elastic rules and observed that the user is able to enable/ disable rules individually and from bulk actions without any error.
elastic.rule.enable.1.mp4
elastic.rule.enable.disable.mp4
elastic.rule.enable.disable.2.mp4

Hence, marking this ticket as QA validated.

Thanks!

cc @pborgonovi

@chetnarajput-qasource chetnarajput-qasource added the QA:Validated Issue has been validated by QA label Mar 24, 2026
Copy link
Copy Markdown
Contributor

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine, but there should be jest tests and FTs.

@maximpn maximpn removed ci:cloud-deploy Create or update a Cloud deployment ci:cloud-persist-deployment Persist cloud deployment indefinitely labels Mar 24, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @maximpn

@maximpn maximpn merged commit b48ac09 into elastic:main Mar 25, 2026
11 checks passed
@maximpn maximpn deleted the fix-legacy-rules-enabling-disabling branch March 25, 2026 14:46
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.19, 9.2, 9.3

https://github.com/elastic/kibana/actions/runs/23547100369

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Mar 25, 2026
…ated lastRun.outcomeMsg (elastic#258105)

**Resolves: elastic#177852
**Relates to: elastic#251164

## Summary

This PR fixes an issue blocking enabling and disabling security rules with non-migrated `lastRun.outcomeMsg` field.

## Details

Some time ago Alerting Framework migrated `lastRun.outcomeMsg` from `string` to `string[]`. At that moment usual migrations were deprecated due to Serverless and model version migration wasn't ready yet. This migration went smoothly thanks to the according changes to the codebase. However, the changes didn't cover customers upgrading from `7.x` stack version and having something written to `lastRun.outcomeMsg`.

elastic#251164 fixed the issue appearing in attempt to update prebuilt rules.

This PR fixes the left issue blocking enabling and disabling non-migrated security rules with `lastRun.outcomeMsg` type `string` field.

## Testing

- Start Kibana
- Log in under `system_indices_superuser` to be able to write to the system indices
- Create a rule by using the command below
- Enable/Disable the rule
- Perform any other bulk and non-bulk actions on the rule

ER: All actions should work without errors.

Without this fix enable/disable action will result in error.

<details>
  <summary>ES command to put a non-migrated rule</summary>

```
PUT .kibana_alerting_cases/_doc/alert:d62167ce-1022-4b2c-915d-024fe3e6e557
{
    "alert": {
      "name": "Test rule 1",
      "tags": [],
      "enabled": false,
      "alertTypeId": "siem.queryRule",
      "consumer": "siem",
      "legacyId": null,
      "schedule": {
        "interval": "5m"
      },
      "actions": [],
      "params": {
        "author": [],
        "description": "123",
        "falsePositives": [],
        "from": "now-6m",
        "ruleId": "5ecfb16d-5af2-4a31-b880-319a4a2ca92b",
        "immutable": false,
        "ruleSource": {
          "type": "internal"
        },
        "license": "",
        "outputIndex": "",
        "meta": {
          "kibana_siem_app_url": "http://localhost:5601/kbn/app/security"
        },
        "maxSignals": 100,
        "riskScore": 21,
        "riskScoreMapping": [],
        "severity": "low",
        "severityMapping": [],
        "threat": [],
        "to": "now",
        "references": [],
        "version": 1,
        "exceptionsList": [],
        "relatedIntegrations": [],
        "requiredFields": [],
        "setup": "",
        "type": "query",
        "language": "kuery",
        "index": [
          "apm-*-transaction*",
          "auditbeat-*",
          "endgame-*",
          "filebeat-*",
          "logs-*",
          "packetbeat-*",
          "traces-apm*",
          "winlogbeat-*",
          "-*elastic-cloud-logs-*"
        ],
        "query": "*:*",
        "filters": []
      },
      "mapped_params": {
        "risk_score": 21,
        "severity": "20-low"
      },
      "createdBy": "elastic",
      "updatedBy": "elastic",
      "createdAt": "2026-03-17T10:52:28.688Z",
      "updatedAt": "2026-03-17T10:52:28.688Z",
      "apiKey": null,
      "apiKeyOwner": null,
      "apiKeyCreatedByUser": null,
      "throttle": null,
      "notifyWhen": null,
      "muteAll": false,
      "mutedInstanceIds": [],
      "executionStatus": {
        "status": "pending",
        "lastExecutionDate": "2026-03-17T10:52:28.688Z"
      },
      "monitoring": {
        "run": {
          "history": [],
          "calculated_metrics": {
            "success_ratio": 0
          },
          "last_run": {
            "timestamp": "2026-03-17T10:52:28.688Z",
            "metrics": {
              "duration": 0,
              "total_search_duration_ms": null,
              "total_indexing_duration_ms": null,
              "total_alerts_detected": null,
              "total_alerts_created": null,
              "gap_duration_s": null
            }
          }
        }
      },
      "lastRun": {
        "outcome": "failed",
        "outcomeMsg": "security_exception: [security_exception] Reason: missing authentication credentials for REST request [/_security/user/_has_privileges], caused by: \"\"",
        "warning": "read",
        "alertsCount": {},
        "outcomeOrder": 20
    },
      "snoozeSchedule": [],
      "revision": 0,
      "running": false,
      "artifacts": {
        "dashboards": [],
        "investigation_guide": {
          "blob": ""
        }
      },
      "meta": {
        "versionApiKeyLastmodified": "9.4.0"
      }
    },
    "type": "alert",
    "references": [],
    "managed": false,
    "namespaces": [
      "default"
    ],
    "coreMigrationVersion": "8.8.0",
    "typeMigrationVersion": "10.10.0",
    "updated_at": "2026-03-17T10:52:28.688Z",
    "created_at": "2026-03-17T10:52:28.688Z"
  }
```
</details>

(cherry picked from commit b48ac09)
@kibanamachine
Copy link
Copy Markdown
Contributor

💔 Some backports could not be created

Status Branch Result
8.19 Backport failed because of merge conflicts
9.2 Backport failed because of merge conflicts
9.3

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 258105

Questions ?

Please refer to the Backport tool documentation

@maximpn
Copy link
Copy Markdown
Contributor Author

maximpn commented Mar 25, 2026

💚 All backports created successfully

Status Branch Result
9.2
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

maximpn added a commit to maximpn/kibana that referenced this pull request Mar 25, 2026
…ated lastRun.outcomeMsg (elastic#258105)

**Resolves: elastic#177852
**Relates to: elastic#251164

## Summary

This PR fixes an issue blocking enabling and disabling security rules with non-migrated `lastRun.outcomeMsg` field.

## Details

Some time ago Alerting Framework migrated `lastRun.outcomeMsg` from `string` to `string[]`. At that moment usual migrations were deprecated due to Serverless and model version migration wasn't ready yet. This migration went smoothly thanks to the according changes to the codebase. However, the changes didn't cover customers upgrading from `7.x` stack version and having something written to `lastRun.outcomeMsg`.

elastic#251164 fixed the issue appearing in attempt to update prebuilt rules.

This PR fixes the left issue blocking enabling and disabling non-migrated security rules with `lastRun.outcomeMsg` type `string` field.

## Testing

- Start Kibana
- Log in under `system_indices_superuser` to be able to write to the system indices
- Create a rule by using the command below
- Enable/Disable the rule
- Perform any other bulk and non-bulk actions on the rule

ER: All actions should work without errors.

Without this fix enable/disable action will result in error.

<details>
  <summary>ES command to put a non-migrated rule</summary>

```
PUT .kibana_alerting_cases/_doc/alert:d62167ce-1022-4b2c-915d-024fe3e6e557
{
    "alert": {
      "name": "Test rule 1",
      "tags": [],
      "enabled": false,
      "alertTypeId": "siem.queryRule",
      "consumer": "siem",
      "legacyId": null,
      "schedule": {
        "interval": "5m"
      },
      "actions": [],
      "params": {
        "author": [],
        "description": "123",
        "falsePositives": [],
        "from": "now-6m",
        "ruleId": "5ecfb16d-5af2-4a31-b880-319a4a2ca92b",
        "immutable": false,
        "ruleSource": {
          "type": "internal"
        },
        "license": "",
        "outputIndex": "",
        "meta": {
          "kibana_siem_app_url": "http://localhost:5601/kbn/app/security"
        },
        "maxSignals": 100,
        "riskScore": 21,
        "riskScoreMapping": [],
        "severity": "low",
        "severityMapping": [],
        "threat": [],
        "to": "now",
        "references": [],
        "version": 1,
        "exceptionsList": [],
        "relatedIntegrations": [],
        "requiredFields": [],
        "setup": "",
        "type": "query",
        "language": "kuery",
        "index": [
          "apm-*-transaction*",
          "auditbeat-*",
          "endgame-*",
          "filebeat-*",
          "logs-*",
          "packetbeat-*",
          "traces-apm*",
          "winlogbeat-*",
          "-*elastic-cloud-logs-*"
        ],
        "query": "*:*",
        "filters": []
      },
      "mapped_params": {
        "risk_score": 21,
        "severity": "20-low"
      },
      "createdBy": "elastic",
      "updatedBy": "elastic",
      "createdAt": "2026-03-17T10:52:28.688Z",
      "updatedAt": "2026-03-17T10:52:28.688Z",
      "apiKey": null,
      "apiKeyOwner": null,
      "apiKeyCreatedByUser": null,
      "throttle": null,
      "notifyWhen": null,
      "muteAll": false,
      "mutedInstanceIds": [],
      "executionStatus": {
        "status": "pending",
        "lastExecutionDate": "2026-03-17T10:52:28.688Z"
      },
      "monitoring": {
        "run": {
          "history": [],
          "calculated_metrics": {
            "success_ratio": 0
          },
          "last_run": {
            "timestamp": "2026-03-17T10:52:28.688Z",
            "metrics": {
              "duration": 0,
              "total_search_duration_ms": null,
              "total_indexing_duration_ms": null,
              "total_alerts_detected": null,
              "total_alerts_created": null,
              "gap_duration_s": null
            }
          }
        }
      },
      "lastRun": {
        "outcome": "failed",
        "outcomeMsg": "security_exception: [security_exception] Reason: missing authentication credentials for REST request [/_security/user/_has_privileges], caused by: \"\"",
        "warning": "read",
        "alertsCount": {},
        "outcomeOrder": 20
    },
      "snoozeSchedule": [],
      "revision": 0,
      "running": false,
      "artifacts": {
        "dashboards": [],
        "investigation_guide": {
          "blob": ""
        }
      },
      "meta": {
        "versionApiKeyLastmodified": "9.4.0"
      }
    },
    "type": "alert",
    "references": [],
    "managed": false,
    "namespaces": [
      "default"
    ],
    "coreMigrationVersion": "8.8.0",
    "typeMigrationVersion": "10.10.0",
    "updated_at": "2026-03-17T10:52:28.688Z",
    "created_at": "2026-03-17T10:52:28.688Z"
  }
```
</details>

(cherry picked from commit b48ac09)

# Conflicts:
#	x-pack/platform/plugins/shared/alerting/server/application/rule/methods/bulk_enable/bulk_enable_rules.test.ts
maximpn added a commit to maximpn/kibana that referenced this pull request Mar 25, 2026
…ated lastRun.outcomeMsg (elastic#258105)

**Resolves: elastic#177852
**Relates to: elastic#251164

## Summary

This PR fixes an issue blocking enabling and disabling security rules with non-migrated `lastRun.outcomeMsg` field.

## Details

Some time ago Alerting Framework migrated `lastRun.outcomeMsg` from `string` to `string[]`. At that moment usual migrations were deprecated due to Serverless and model version migration wasn't ready yet. This migration went smoothly thanks to the according changes to the codebase. However, the changes didn't cover customers upgrading from `7.x` stack version and having something written to `lastRun.outcomeMsg`.

elastic#251164 fixed the issue appearing in attempt to update prebuilt rules.

This PR fixes the left issue blocking enabling and disabling non-migrated security rules with `lastRun.outcomeMsg` type `string` field.

## Testing

- Start Kibana
- Log in under `system_indices_superuser` to be able to write to the system indices
- Create a rule by using the command below
- Enable/Disable the rule
- Perform any other bulk and non-bulk actions on the rule

ER: All actions should work without errors.

Without this fix enable/disable action will result in error.

<details>
  <summary>ES command to put a non-migrated rule</summary>

```
PUT .kibana_alerting_cases/_doc/alert:d62167ce-1022-4b2c-915d-024fe3e6e557
{
    "alert": {
      "name": "Test rule 1",
      "tags": [],
      "enabled": false,
      "alertTypeId": "siem.queryRule",
      "consumer": "siem",
      "legacyId": null,
      "schedule": {
        "interval": "5m"
      },
      "actions": [],
      "params": {
        "author": [],
        "description": "123",
        "falsePositives": [],
        "from": "now-6m",
        "ruleId": "5ecfb16d-5af2-4a31-b880-319a4a2ca92b",
        "immutable": false,
        "ruleSource": {
          "type": "internal"
        },
        "license": "",
        "outputIndex": "",
        "meta": {
          "kibana_siem_app_url": "http://localhost:5601/kbn/app/security"
        },
        "maxSignals": 100,
        "riskScore": 21,
        "riskScoreMapping": [],
        "severity": "low",
        "severityMapping": [],
        "threat": [],
        "to": "now",
        "references": [],
        "version": 1,
        "exceptionsList": [],
        "relatedIntegrations": [],
        "requiredFields": [],
        "setup": "",
        "type": "query",
        "language": "kuery",
        "index": [
          "apm-*-transaction*",
          "auditbeat-*",
          "endgame-*",
          "filebeat-*",
          "logs-*",
          "packetbeat-*",
          "traces-apm*",
          "winlogbeat-*",
          "-*elastic-cloud-logs-*"
        ],
        "query": "*:*",
        "filters": []
      },
      "mapped_params": {
        "risk_score": 21,
        "severity": "20-low"
      },
      "createdBy": "elastic",
      "updatedBy": "elastic",
      "createdAt": "2026-03-17T10:52:28.688Z",
      "updatedAt": "2026-03-17T10:52:28.688Z",
      "apiKey": null,
      "apiKeyOwner": null,
      "apiKeyCreatedByUser": null,
      "throttle": null,
      "notifyWhen": null,
      "muteAll": false,
      "mutedInstanceIds": [],
      "executionStatus": {
        "status": "pending",
        "lastExecutionDate": "2026-03-17T10:52:28.688Z"
      },
      "monitoring": {
        "run": {
          "history": [],
          "calculated_metrics": {
            "success_ratio": 0
          },
          "last_run": {
            "timestamp": "2026-03-17T10:52:28.688Z",
            "metrics": {
              "duration": 0,
              "total_search_duration_ms": null,
              "total_indexing_duration_ms": null,
              "total_alerts_detected": null,
              "total_alerts_created": null,
              "gap_duration_s": null
            }
          }
        }
      },
      "lastRun": {
        "outcome": "failed",
        "outcomeMsg": "security_exception: [security_exception] Reason: missing authentication credentials for REST request [/_security/user/_has_privileges], caused by: \"\"",
        "warning": "read",
        "alertsCount": {},
        "outcomeOrder": 20
    },
      "snoozeSchedule": [],
      "revision": 0,
      "running": false,
      "artifacts": {
        "dashboards": [],
        "investigation_guide": {
          "blob": ""
        }
      },
      "meta": {
        "versionApiKeyLastmodified": "9.4.0"
      }
    },
    "type": "alert",
    "references": [],
    "managed": false,
    "namespaces": [
      "default"
    ],
    "coreMigrationVersion": "8.8.0",
    "typeMigrationVersion": "10.10.0",
    "updated_at": "2026-03-17T10:52:28.688Z",
    "created_at": "2026-03-17T10:52:28.688Z"
  }
```
</details>

(cherry picked from commit b48ac09)

# Conflicts:
#	x-pack/platform/plugins/shared/alerting/server/application/rule/methods/bulk_enable/bulk_enable_rules.test.ts
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Mar 26, 2026
…ated lastRun.outcomeMsg (elastic#258105)

**Resolves: elastic#177852
**Relates to: elastic#251164

## Summary

This PR fixes an issue blocking enabling and disabling security rules with non-migrated `lastRun.outcomeMsg` field.

## Details

Some time ago Alerting Framework migrated `lastRun.outcomeMsg` from `string` to `string[]`. At that moment usual migrations were deprecated due to Serverless and model version migration wasn't ready yet. This migration went smoothly thanks to the according changes to the codebase. However, the changes didn't cover customers upgrading from `7.x` stack version and having something written to `lastRun.outcomeMsg`.

elastic#251164 fixed the issue appearing in attempt to update prebuilt rules.

This PR fixes the left issue blocking enabling and disabling non-migrated security rules with `lastRun.outcomeMsg` type `string` field.

## Testing

- Start Kibana
- Log in under `system_indices_superuser` to be able to write to the system indices
- Create a rule by using the command below
- Enable/Disable the rule
- Perform any other bulk and non-bulk actions on the rule

ER: All actions should work without errors.

Without this fix enable/disable action will result in error.

<details>
  <summary>ES command to put a non-migrated rule</summary>
  
```
PUT .kibana_alerting_cases/_doc/alert:d62167ce-1022-4b2c-915d-024fe3e6e557
{
    "alert": {
      "name": "Test rule 1",
      "tags": [],
      "enabled": false,
      "alertTypeId": "siem.queryRule",
      "consumer": "siem",
      "legacyId": null,
      "schedule": {
        "interval": "5m"
      },
      "actions": [],
      "params": {
        "author": [],
        "description": "123",
        "falsePositives": [],
        "from": "now-6m",
        "ruleId": "5ecfb16d-5af2-4a31-b880-319a4a2ca92b",
        "immutable": false,
        "ruleSource": {
          "type": "internal"
        },
        "license": "",
        "outputIndex": "",
        "meta": {
          "kibana_siem_app_url": "http://localhost:5601/kbn/app/security"
        },
        "maxSignals": 100,
        "riskScore": 21,
        "riskScoreMapping": [],
        "severity": "low",
        "severityMapping": [],
        "threat": [],
        "to": "now",
        "references": [],
        "version": 1,
        "exceptionsList": [],
        "relatedIntegrations": [],
        "requiredFields": [],
        "setup": "",
        "type": "query",
        "language": "kuery",
        "index": [
          "apm-*-transaction*",
          "auditbeat-*",
          "endgame-*",
          "filebeat-*",
          "logs-*",
          "packetbeat-*",
          "traces-apm*",
          "winlogbeat-*",
          "-*elastic-cloud-logs-*"
        ],
        "query": "*:*",
        "filters": []
      },
      "mapped_params": {
        "risk_score": 21,
        "severity": "20-low"
      },
      "createdBy": "elastic",
      "updatedBy": "elastic",
      "createdAt": "2026-03-17T10:52:28.688Z",
      "updatedAt": "2026-03-17T10:52:28.688Z",
      "apiKey": null,
      "apiKeyOwner": null,
      "apiKeyCreatedByUser": null,
      "throttle": null,
      "notifyWhen": null,
      "muteAll": false,
      "mutedInstanceIds": [],
      "executionStatus": {
        "status": "pending",
        "lastExecutionDate": "2026-03-17T10:52:28.688Z"
      },
      "monitoring": {
        "run": {
          "history": [],
          "calculated_metrics": {
            "success_ratio": 0
          },
          "last_run": {
            "timestamp": "2026-03-17T10:52:28.688Z",
            "metrics": {
              "duration": 0,
              "total_search_duration_ms": null,
              "total_indexing_duration_ms": null,
              "total_alerts_detected": null,
              "total_alerts_created": null,
              "gap_duration_s": null
            }
          }
        }
      },
      "lastRun": {
        "outcome": "failed",
        "outcomeMsg": "security_exception: [security_exception] Reason: missing authentication credentials for REST request [/_security/user/_has_privileges], caused by: \"\"",
        "warning": "read",
        "alertsCount": {},
        "outcomeOrder": 20
    },
      "snoozeSchedule": [],
      "revision": 0,
      "running": false,
      "artifacts": {
        "dashboards": [],
        "investigation_guide": {
          "blob": ""
        }
      },
      "meta": {
        "versionApiKeyLastmodified": "9.4.0"
      }
    },
    "type": "alert",
    "references": [],
    "managed": false,
    "namespaces": [
      "default"
    ],
    "coreMigrationVersion": "8.8.0",
    "typeMigrationVersion": "10.10.0",
    "updated_at": "2026-03-17T10:52:28.688Z",
    "created_at": "2026-03-17T10:52:28.688Z"
  }
```
</details>
kibanamachine added a commit that referenced this pull request Mar 27, 2026
…n-migrated lastRun.outcomeMsg (#258105) (#259592)

# Backport

This will backport the following commits from `main` to `9.3`:
- [[Security Solution] Fix enable/disable action for rules with
non-migrated lastRun.outcomeMsg
(#258105)](#258105)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Maxim
Palenov","email":"maxim.palenov@elastic.co"},"sourceCommit":{"committedDate":"2026-03-25T14:45:55Z","message":"[Security
Solution] Fix enable/disable action for rules with non-migrated
lastRun.outcomeMsg (#258105)\n\n**Resolves:
https://github.com/elastic/kibana/issues/177852**\n**Relates to:
https://github.com/elastic/kibana/pull/251164**\n\n## Summary\n\nThis PR
fixes an issue blocking enabling and disabling security rules with
non-migrated `lastRun.outcomeMsg` field.\n\n## Details\n\nSome time ago
Alerting Framework migrated `lastRun.outcomeMsg` from `string` to
`string[]`. At that moment usual migrations were deprecated due to
Serverless and model version migration wasn't ready yet. This migration
went smoothly thanks to the according changes to the codebase. However,
the changes didn't cover customers upgrading from `7.x` stack version
and having something written to
`lastRun.outcomeMsg`.\n\nhttps://github.com//pull/251164
fixed the issue appearing in attempt to update prebuilt rules.\n\nThis
PR fixes the left issue blocking enabling and disabling non-migrated
security rules with `lastRun.outcomeMsg` type `string` field.\n\n##
Testing\n\n- Start Kibana\n- Log in under `system_indices_superuser` to
be able to write to the system indices\n- Create a rule by using the
command below\n- Enable/Disable the rule\n- Perform any other bulk and
non-bulk actions on the rule\n\nER: All actions should work without
errors.\n\nWithout this fix enable/disable action will result in
error.\n\n<details>\n <summary>ES command to put a non-migrated
rule</summary>\n \n```\nPUT
.kibana_alerting_cases/_doc/alert:d62167ce-1022-4b2c-915d-024fe3e6e557\n{\n
\"alert\": {\n \"name\": \"Test rule 1\",\n \"tags\": [],\n \"enabled\":
false,\n \"alertTypeId\": \"siem.queryRule\",\n \"consumer\":
\"siem\",\n \"legacyId\": null,\n \"schedule\": {\n \"interval\":
\"5m\"\n },\n \"actions\": [],\n \"params\": {\n \"author\": [],\n
\"description\": \"123\",\n \"falsePositives\": [],\n \"from\":
\"now-6m\",\n \"ruleId\": \"5ecfb16d-5af2-4a31-b880-319a4a2ca92b\",\n
\"immutable\": false,\n \"ruleSource\": {\n \"type\": \"internal\"\n
},\n \"license\": \"\",\n \"outputIndex\": \"\",\n \"meta\": {\n
\"kibana_siem_app_url\": \"http://localhost:5601/kbn/app/security\"\n
},\n \"maxSignals\": 100,\n \"riskScore\": 21,\n \"riskScoreMapping\":
[],\n \"severity\": \"low\",\n \"severityMapping\": [],\n \"threat\":
[],\n \"to\": \"now\",\n \"references\": [],\n \"version\": 1,\n
\"exceptionsList\": [],\n \"relatedIntegrations\": [],\n
\"requiredFields\": [],\n \"setup\": \"\",\n \"type\": \"query\",\n
\"language\": \"kuery\",\n \"index\": [\n \"apm-*-transaction*\",\n
\"auditbeat-*\",\n \"endgame-*\",\n \"filebeat-*\",\n \"logs-*\",\n
\"packetbeat-*\",\n \"traces-apm*\",\n \"winlogbeat-*\",\n
\"-*elastic-cloud-logs-*\"\n ],\n \"query\": \"*:*\",\n \"filters\":
[]\n },\n \"mapped_params\": {\n \"risk_score\": 21,\n \"severity\":
\"20-low\"\n },\n \"createdBy\": \"elastic\",\n \"updatedBy\":
\"elastic\",\n \"createdAt\": \"2026-03-17T10:52:28.688Z\",\n
\"updatedAt\": \"2026-03-17T10:52:28.688Z\",\n \"apiKey\": null,\n
\"apiKeyOwner\": null,\n \"apiKeyCreatedByUser\": null,\n \"throttle\":
null,\n \"notifyWhen\": null,\n \"muteAll\": false,\n
\"mutedInstanceIds\": [],\n \"executionStatus\": {\n \"status\":
\"pending\",\n \"lastExecutionDate\": \"2026-03-17T10:52:28.688Z\"\n
},\n \"monitoring\": {\n \"run\": {\n \"history\": [],\n
\"calculated_metrics\": {\n \"success_ratio\": 0\n },\n \"last_run\":
{\n \"timestamp\": \"2026-03-17T10:52:28.688Z\",\n \"metrics\": {\n
\"duration\": 0,\n \"total_search_duration_ms\": null,\n
\"total_indexing_duration_ms\": null,\n \"total_alerts_detected\":
null,\n \"total_alerts_created\": null,\n \"gap_duration_s\": null\n }\n
}\n }\n },\n \"lastRun\": {\n \"outcome\": \"failed\",\n \"outcomeMsg\":
\"security_exception: [security_exception] Reason: missing
authentication credentials for REST request
[/_security/user/_has_privileges], caused by: \\\"\\\"\",\n \"warning\":
\"read\",\n \"alertsCount\": {},\n \"outcomeOrder\": 20\n },\n
\"snoozeSchedule\": [],\n \"revision\": 0,\n \"running\": false,\n
\"artifacts\": {\n \"dashboards\": [],\n \"investigation_guide\": {\n
\"blob\": \"\"\n }\n },\n \"meta\": {\n \"versionApiKeyLastmodified\":
\"9.4.0\"\n }\n },\n \"type\": \"alert\",\n \"references\": [],\n
\"managed\": false,\n \"namespaces\": [\n \"default\"\n ],\n
\"coreMigrationVersion\": \"8.8.0\",\n \"typeMigrationVersion\":
\"10.10.0\",\n \"updated_at\": \"2026-03-17T10:52:28.688Z\",\n
\"created_at\": \"2026-03-17T10:52:28.688Z\"\n
}\n```\n</details>","sha":"b48ac09918bbd6e150c8b05b8ec963678458fee8","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:Detections
and Resp","Team: SecuritySolution","QA:Validated","Feature:Rule
Management","Team:Detection Rule
Management","backport:version","v9.4.0","v8.19.13","v9.2.7","v9.3.2"],"title":"[Security
Solution] Fix enable/disable action for rules with non-migrated
lastRun.outcomeMsg","number":258105,"url":"https://github.com/elastic/kibana/pull/258105","mergeCommit":{"message":"[Security
Solution] Fix enable/disable action for rules with non-migrated
lastRun.outcomeMsg (#258105)\n\n**Resolves:
https://github.com/elastic/kibana/issues/177852**\n**Relates to:
https://github.com/elastic/kibana/pull/251164**\n\n## Summary\n\nThis PR
fixes an issue blocking enabling and disabling security rules with
non-migrated `lastRun.outcomeMsg` field.\n\n## Details\n\nSome time ago
Alerting Framework migrated `lastRun.outcomeMsg` from `string` to
`string[]`. At that moment usual migrations were deprecated due to
Serverless and model version migration wasn't ready yet. This migration
went smoothly thanks to the according changes to the codebase. However,
the changes didn't cover customers upgrading from `7.x` stack version
and having something written to
`lastRun.outcomeMsg`.\n\nhttps://github.com//pull/251164
fixed the issue appearing in attempt to update prebuilt rules.\n\nThis
PR fixes the left issue blocking enabling and disabling non-migrated
security rules with `lastRun.outcomeMsg` type `string` field.\n\n##
Testing\n\n- Start Kibana\n- Log in under `system_indices_superuser` to
be able to write to the system indices\n- Create a rule by using the
command below\n- Enable/Disable the rule\n- Perform any other bulk and
non-bulk actions on the rule\n\nER: All actions should work without
errors.\n\nWithout this fix enable/disable action will result in
error.\n\n<details>\n <summary>ES command to put a non-migrated
rule</summary>\n \n```\nPUT
.kibana_alerting_cases/_doc/alert:d62167ce-1022-4b2c-915d-024fe3e6e557\n{\n
\"alert\": {\n \"name\": \"Test rule 1\",\n \"tags\": [],\n \"enabled\":
false,\n \"alertTypeId\": \"siem.queryRule\",\n \"consumer\":
\"siem\",\n \"legacyId\": null,\n \"schedule\": {\n \"interval\":
\"5m\"\n },\n \"actions\": [],\n \"params\": {\n \"author\": [],\n
\"description\": \"123\",\n \"falsePositives\": [],\n \"from\":
\"now-6m\",\n \"ruleId\": \"5ecfb16d-5af2-4a31-b880-319a4a2ca92b\",\n
\"immutable\": false,\n \"ruleSource\": {\n \"type\": \"internal\"\n
},\n \"license\": \"\",\n \"outputIndex\": \"\",\n \"meta\": {\n
\"kibana_siem_app_url\": \"http://localhost:5601/kbn/app/security\"\n
},\n \"maxSignals\": 100,\n \"riskScore\": 21,\n \"riskScoreMapping\":
[],\n \"severity\": \"low\",\n \"severityMapping\": [],\n \"threat\":
[],\n \"to\": \"now\",\n \"references\": [],\n \"version\": 1,\n
\"exceptionsList\": [],\n \"relatedIntegrations\": [],\n
\"requiredFields\": [],\n \"setup\": \"\",\n \"type\": \"query\",\n
\"language\": \"kuery\",\n \"index\": [\n \"apm-*-transaction*\",\n
\"auditbeat-*\",\n \"endgame-*\",\n \"filebeat-*\",\n \"logs-*\",\n
\"packetbeat-*\",\n \"traces-apm*\",\n \"winlogbeat-*\",\n
\"-*elastic-cloud-logs-*\"\n ],\n \"query\": \"*:*\",\n \"filters\":
[]\n },\n \"mapped_params\": {\n \"risk_score\": 21,\n \"severity\":
\"20-low\"\n },\n \"createdBy\": \"elastic\",\n \"updatedBy\":
\"elastic\",\n \"createdAt\": \"2026-03-17T10:52:28.688Z\",\n
\"updatedAt\": \"2026-03-17T10:52:28.688Z\",\n \"apiKey\": null,\n
\"apiKeyOwner\": null,\n \"apiKeyCreatedByUser\": null,\n \"throttle\":
null,\n \"notifyWhen\": null,\n \"muteAll\": false,\n
\"mutedInstanceIds\": [],\n \"executionStatus\": {\n \"status\":
\"pending\",\n \"lastExecutionDate\": \"2026-03-17T10:52:28.688Z\"\n
},\n \"monitoring\": {\n \"run\": {\n \"history\": [],\n
\"calculated_metrics\": {\n \"success_ratio\": 0\n },\n \"last_run\":
{\n \"timestamp\": \"2026-03-17T10:52:28.688Z\",\n \"metrics\": {\n
\"duration\": 0,\n \"total_search_duration_ms\": null,\n
\"total_indexing_duration_ms\": null,\n \"total_alerts_detected\":
null,\n \"total_alerts_created\": null,\n \"gap_duration_s\": null\n }\n
}\n }\n },\n \"lastRun\": {\n \"outcome\": \"failed\",\n \"outcomeMsg\":
\"security_exception: [security_exception] Reason: missing
authentication credentials for REST request
[/_security/user/_has_privileges], caused by: \\\"\\\"\",\n \"warning\":
\"read\",\n \"alertsCount\": {},\n \"outcomeOrder\": 20\n },\n
\"snoozeSchedule\": [],\n \"revision\": 0,\n \"running\": false,\n
\"artifacts\": {\n \"dashboards\": [],\n \"investigation_guide\": {\n
\"blob\": \"\"\n }\n },\n \"meta\": {\n \"versionApiKeyLastmodified\":
\"9.4.0\"\n }\n },\n \"type\": \"alert\",\n \"references\": [],\n
\"managed\": false,\n \"namespaces\": [\n \"default\"\n ],\n
\"coreMigrationVersion\": \"8.8.0\",\n \"typeMigrationVersion\":
\"10.10.0\",\n \"updated_at\": \"2026-03-17T10:52:28.688Z\",\n
\"created_at\": \"2026-03-17T10:52:28.688Z\"\n
}\n```\n</details>","sha":"b48ac09918bbd6e150c8b05b8ec963678458fee8"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.2","9.3"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/258105","number":258105,"mergeCommit":{"message":"[Security
Solution] Fix enable/disable action for rules with non-migrated
lastRun.outcomeMsg (#258105)\n\n**Resolves:
https://github.com/elastic/kibana/issues/177852**\n**Relates to:
https://github.com/elastic/kibana/pull/251164**\n\n## Summary\n\nThis PR
fixes an issue blocking enabling and disabling security rules with
non-migrated `lastRun.outcomeMsg` field.\n\n## Details\n\nSome time ago
Alerting Framework migrated `lastRun.outcomeMsg` from `string` to
`string[]`. At that moment usual migrations were deprecated due to
Serverless and model version migration wasn't ready yet. This migration
went smoothly thanks to the according changes to the codebase. However,
the changes didn't cover customers upgrading from `7.x` stack version
and having something written to
`lastRun.outcomeMsg`.\n\nhttps://github.com//pull/251164
fixed the issue appearing in attempt to update prebuilt rules.\n\nThis
PR fixes the left issue blocking enabling and disabling non-migrated
security rules with `lastRun.outcomeMsg` type `string` field.\n\n##
Testing\n\n- Start Kibana\n- Log in under `system_indices_superuser` to
be able to write to the system indices\n- Create a rule by using the
command below\n- Enable/Disable the rule\n- Perform any other bulk and
non-bulk actions on the rule\n\nER: All actions should work without
errors.\n\nWithout this fix enable/disable action will result in
error.\n\n<details>\n <summary>ES command to put a non-migrated
rule</summary>\n \n```\nPUT
.kibana_alerting_cases/_doc/alert:d62167ce-1022-4b2c-915d-024fe3e6e557\n{\n
\"alert\": {\n \"name\": \"Test rule 1\",\n \"tags\": [],\n \"enabled\":
false,\n \"alertTypeId\": \"siem.queryRule\",\n \"consumer\":
\"siem\",\n \"legacyId\": null,\n \"schedule\": {\n \"interval\":
\"5m\"\n },\n \"actions\": [],\n \"params\": {\n \"author\": [],\n
\"description\": \"123\",\n \"falsePositives\": [],\n \"from\":
\"now-6m\",\n \"ruleId\": \"5ecfb16d-5af2-4a31-b880-319a4a2ca92b\",\n
\"immutable\": false,\n \"ruleSource\": {\n \"type\": \"internal\"\n
},\n \"license\": \"\",\n \"outputIndex\": \"\",\n \"meta\": {\n
\"kibana_siem_app_url\": \"http://localhost:5601/kbn/app/security\"\n
},\n \"maxSignals\": 100,\n \"riskScore\": 21,\n \"riskScoreMapping\":
[],\n \"severity\": \"low\",\n \"severityMapping\": [],\n \"threat\":
[],\n \"to\": \"now\",\n \"references\": [],\n \"version\": 1,\n
\"exceptionsList\": [],\n \"relatedIntegrations\": [],\n
\"requiredFields\": [],\n \"setup\": \"\",\n \"type\": \"query\",\n
\"language\": \"kuery\",\n \"index\": [\n \"apm-*-transaction*\",\n
\"auditbeat-*\",\n \"endgame-*\",\n \"filebeat-*\",\n \"logs-*\",\n
\"packetbeat-*\",\n \"traces-apm*\",\n \"winlogbeat-*\",\n
\"-*elastic-cloud-logs-*\"\n ],\n \"query\": \"*:*\",\n \"filters\":
[]\n },\n \"mapped_params\": {\n \"risk_score\": 21,\n \"severity\":
\"20-low\"\n },\n \"createdBy\": \"elastic\",\n \"updatedBy\":
\"elastic\",\n \"createdAt\": \"2026-03-17T10:52:28.688Z\",\n
\"updatedAt\": \"2026-03-17T10:52:28.688Z\",\n \"apiKey\": null,\n
\"apiKeyOwner\": null,\n \"apiKeyCreatedByUser\": null,\n \"throttle\":
null,\n \"notifyWhen\": null,\n \"muteAll\": false,\n
\"mutedInstanceIds\": [],\n \"executionStatus\": {\n \"status\":
\"pending\",\n \"lastExecutionDate\": \"2026-03-17T10:52:28.688Z\"\n
},\n \"monitoring\": {\n \"run\": {\n \"history\": [],\n
\"calculated_metrics\": {\n \"success_ratio\": 0\n },\n \"last_run\":
{\n \"timestamp\": \"2026-03-17T10:52:28.688Z\",\n \"metrics\": {\n
\"duration\": 0,\n \"total_search_duration_ms\": null,\n
\"total_indexing_duration_ms\": null,\n \"total_alerts_detected\":
null,\n \"total_alerts_created\": null,\n \"gap_duration_s\": null\n }\n
}\n }\n },\n \"lastRun\": {\n \"outcome\": \"failed\",\n \"outcomeMsg\":
\"security_exception: [security_exception] Reason: missing
authentication credentials for REST request
[/_security/user/_has_privileges], caused by: \\\"\\\"\",\n \"warning\":
\"read\",\n \"alertsCount\": {},\n \"outcomeOrder\": 20\n },\n
\"snoozeSchedule\": [],\n \"revision\": 0,\n \"running\": false,\n
\"artifacts\": {\n \"dashboards\": [],\n \"investigation_guide\": {\n
\"blob\": \"\"\n }\n },\n \"meta\": {\n \"versionApiKeyLastmodified\":
\"9.4.0\"\n }\n },\n \"type\": \"alert\",\n \"references\": [],\n
\"managed\": false,\n \"namespaces\": [\n \"default\"\n ],\n
\"coreMigrationVersion\": \"8.8.0\",\n \"typeMigrationVersion\":
\"10.10.0\",\n \"updated_at\": \"2026-03-17T10:52:28.688Z\",\n
\"created_at\": \"2026-03-17T10:52:28.688Z\"\n
}\n```\n</details>","sha":"b48ac09918bbd6e150c8b05b8ec963678458fee8"}},{"branch":"8.19","label":"v8.19.13","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.2","label":"v9.2.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.3","label":"v9.3.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
maximpn added a commit that referenced this pull request Mar 27, 2026
…kiness (#259955)

**Resolves: #259634
**Relates to:** #258105

## Summary

This PR fixes rule's `lastRun.outcomeMsg` functional test flakiness. The flakiness was caused by race condition between rule execution and setting the legacy `outcomeMsg`'s value.
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Mar 27, 2026
…kiness (elastic#259955)

**Resolves: elastic#259634
**Relates to:** elastic#258105

## Summary

This PR fixes rule's `lastRun.outcomeMsg` functional test flakiness. The flakiness was caused by race condition between rule execution and setting the legacy `outcomeMsg`'s value.

(cherry picked from commit 737848b)
maximpn added a commit that referenced this pull request Mar 27, 2026
…n-migrated lastRun.outcomeMsg (#258105) (#259661)

# Backport

This will backport the following commits from `main` to `9.2`:
- [[Security Solution] Fix enable/disable action for rules with
non-migrated lastRun.outcomeMsg
(#258105)](#258105)

<!--- Backport version: 11.0.1 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Maxim
Palenov","email":"maxim.palenov@elastic.co"},"sourceCommit":{"committedDate":"2026-03-25T14:45:55Z","message":"[Security
Solution] Fix enable/disable action for rules with non-migrated
lastRun.outcomeMsg (#258105)\n\n**Resolves:
https://github.com/elastic/kibana/issues/177852**\n**Relates to:
https://github.com/elastic/kibana/pull/251164**\n\n## Summary\n\nThis PR
fixes an issue blocking enabling and disabling security rules with
non-migrated `lastRun.outcomeMsg` field.\n\n## Details\n\nSome time ago
Alerting Framework migrated `lastRun.outcomeMsg` from `string` to
`string[]`. At that moment usual migrations were deprecated due to
Serverless and model version migration wasn't ready yet. This migration
went smoothly thanks to the according changes to the codebase. However,
the changes didn't cover customers upgrading from `7.x` stack version
and having something written to
`lastRun.outcomeMsg`.\n\nhttps://github.com//pull/251164
fixed the issue appearing in attempt to update prebuilt rules.\n\nThis
PR fixes the left issue blocking enabling and disabling non-migrated
security rules with `lastRun.outcomeMsg` type `string` field.\n\n##
Testing\n\n- Start Kibana\n- Log in under `system_indices_superuser` to
be able to write to the system indices\n- Create a rule by using the
command below\n- Enable/Disable the rule\n- Perform any other bulk and
non-bulk actions on the rule\n\nER: All actions should work without
errors.\n\nWithout this fix enable/disable action will result in
error.\n\n<details>\n <summary>ES command to put a non-migrated
rule</summary>\n \n```\nPUT
.kibana_alerting_cases/_doc/alert:d62167ce-1022-4b2c-915d-024fe3e6e557\n{\n
\"alert\": {\n \"name\": \"Test rule 1\",\n \"tags\": [],\n \"enabled\":
false,\n \"alertTypeId\": \"siem.queryRule\",\n \"consumer\":
\"siem\",\n \"legacyId\": null,\n \"schedule\": {\n \"interval\":
\"5m\"\n },\n \"actions\": [],\n \"params\": {\n \"author\": [],\n
\"description\": \"123\",\n \"falsePositives\": [],\n \"from\":
\"now-6m\",\n \"ruleId\": \"5ecfb16d-5af2-4a31-b880-319a4a2ca92b\",\n
\"immutable\": false,\n \"ruleSource\": {\n \"type\": \"internal\"\n
},\n \"license\": \"\",\n \"outputIndex\": \"\",\n \"meta\": {\n
\"kibana_siem_app_url\": \"http://localhost:5601/kbn/app/security\"\n
},\n \"maxSignals\": 100,\n \"riskScore\": 21,\n \"riskScoreMapping\":
[],\n \"severity\": \"low\",\n \"severityMapping\": [],\n \"threat\":
[],\n \"to\": \"now\",\n \"references\": [],\n \"version\": 1,\n
\"exceptionsList\": [],\n \"relatedIntegrations\": [],\n
\"requiredFields\": [],\n \"setup\": \"\",\n \"type\": \"query\",\n
\"language\": \"kuery\",\n \"index\": [\n \"apm-*-transaction*\",\n
\"auditbeat-*\",\n \"endgame-*\",\n \"filebeat-*\",\n \"logs-*\",\n
\"packetbeat-*\",\n \"traces-apm*\",\n \"winlogbeat-*\",\n
\"-*elastic-cloud-logs-*\"\n ],\n \"query\": \"*:*\",\n \"filters\":
[]\n },\n \"mapped_params\": {\n \"risk_score\": 21,\n \"severity\":
\"20-low\"\n },\n \"createdBy\": \"elastic\",\n \"updatedBy\":
\"elastic\",\n \"createdAt\": \"2026-03-17T10:52:28.688Z\",\n
\"updatedAt\": \"2026-03-17T10:52:28.688Z\",\n \"apiKey\": null,\n
\"apiKeyOwner\": null,\n \"apiKeyCreatedByUser\": null,\n \"throttle\":
null,\n \"notifyWhen\": null,\n \"muteAll\": false,\n
\"mutedInstanceIds\": [],\n \"executionStatus\": {\n \"status\":
\"pending\",\n \"lastExecutionDate\": \"2026-03-17T10:52:28.688Z\"\n
},\n \"monitoring\": {\n \"run\": {\n \"history\": [],\n
\"calculated_metrics\": {\n \"success_ratio\": 0\n },\n \"last_run\":
{\n \"timestamp\": \"2026-03-17T10:52:28.688Z\",\n \"metrics\": {\n
\"duration\": 0,\n \"total_search_duration_ms\": null,\n
\"total_indexing_duration_ms\": null,\n \"total_alerts_detected\":
null,\n \"total_alerts_created\": null,\n \"gap_duration_s\": null\n }\n
}\n }\n },\n \"lastRun\": {\n \"outcome\": \"failed\",\n \"outcomeMsg\":
\"security_exception: [security_exception] Reason: missing
authentication credentials for REST request
[/_security/user/_has_privileges], caused by: \\\"\\\"\",\n \"warning\":
\"read\",\n \"alertsCount\": {},\n \"outcomeOrder\": 20\n },\n
\"snoozeSchedule\": [],\n \"revision\": 0,\n \"running\": false,\n
\"artifacts\": {\n \"dashboards\": [],\n \"investigation_guide\": {\n
\"blob\": \"\"\n }\n },\n \"meta\": {\n \"versionApiKeyLastmodified\":
\"9.4.0\"\n }\n },\n \"type\": \"alert\",\n \"references\": [],\n
\"managed\": false,\n \"namespaces\": [\n \"default\"\n ],\n
\"coreMigrationVersion\": \"8.8.0\",\n \"typeMigrationVersion\":
\"10.10.0\",\n \"updated_at\": \"2026-03-17T10:52:28.688Z\",\n
\"created_at\": \"2026-03-17T10:52:28.688Z\"\n
}\n```\n</details>","sha":"b48ac09918bbd6e150c8b05b8ec963678458fee8","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:Detections
and Resp","Team: SecuritySolution","QA:Validated","Feature:Rule
Management","Team:Detection Rule
Management","backport:version","v9.4.0","v8.19.13","v9.2.7","v9.3.2"],"title":"[Security
Solution] Fix enable/disable action for rules with non-migrated
lastRun.outcomeMsg","number":258105,"url":"https://github.com/elastic/kibana/pull/258105","mergeCommit":{"message":"[Security
Solution] Fix enable/disable action for rules with non-migrated
lastRun.outcomeMsg (#258105)\n\n**Resolves:
https://github.com/elastic/kibana/issues/177852**\n**Relates to:
https://github.com/elastic/kibana/pull/251164**\n\n## Summary\n\nThis PR
fixes an issue blocking enabling and disabling security rules with
non-migrated `lastRun.outcomeMsg` field.\n\n## Details\n\nSome time ago
Alerting Framework migrated `lastRun.outcomeMsg` from `string` to
`string[]`. At that moment usual migrations were deprecated due to
Serverless and model version migration wasn't ready yet. This migration
went smoothly thanks to the according changes to the codebase. However,
the changes didn't cover customers upgrading from `7.x` stack version
and having something written to
`lastRun.outcomeMsg`.\n\nhttps://github.com//pull/251164
fixed the issue appearing in attempt to update prebuilt rules.\n\nThis
PR fixes the left issue blocking enabling and disabling non-migrated
security rules with `lastRun.outcomeMsg` type `string` field.\n\n##
Testing\n\n- Start Kibana\n- Log in under `system_indices_superuser` to
be able to write to the system indices\n- Create a rule by using the
command below\n- Enable/Disable the rule\n- Perform any other bulk and
non-bulk actions on the rule\n\nER: All actions should work without
errors.\n\nWithout this fix enable/disable action will result in
error.\n\n<details>\n <summary>ES command to put a non-migrated
rule</summary>\n \n```\nPUT
.kibana_alerting_cases/_doc/alert:d62167ce-1022-4b2c-915d-024fe3e6e557\n{\n
\"alert\": {\n \"name\": \"Test rule 1\",\n \"tags\": [],\n \"enabled\":
false,\n \"alertTypeId\": \"siem.queryRule\",\n \"consumer\":
\"siem\",\n \"legacyId\": null,\n \"schedule\": {\n \"interval\":
\"5m\"\n },\n \"actions\": [],\n \"params\": {\n \"author\": [],\n
\"description\": \"123\",\n \"falsePositives\": [],\n \"from\":
\"now-6m\",\n \"ruleId\": \"5ecfb16d-5af2-4a31-b880-319a4a2ca92b\",\n
\"immutable\": false,\n \"ruleSource\": {\n \"type\": \"internal\"\n
},\n \"license\": \"\",\n \"outputIndex\": \"\",\n \"meta\": {\n
\"kibana_siem_app_url\": \"http://localhost:5601/kbn/app/security\"\n
},\n \"maxSignals\": 100,\n \"riskScore\": 21,\n \"riskScoreMapping\":
[],\n \"severity\": \"low\",\n \"severityMapping\": [],\n \"threat\":
[],\n \"to\": \"now\",\n \"references\": [],\n \"version\": 1,\n
\"exceptionsList\": [],\n \"relatedIntegrations\": [],\n
\"requiredFields\": [],\n \"setup\": \"\",\n \"type\": \"query\",\n
\"language\": \"kuery\",\n \"index\": [\n \"apm-*-transaction*\",\n
\"auditbeat-*\",\n \"endgame-*\",\n \"filebeat-*\",\n \"logs-*\",\n
\"packetbeat-*\",\n \"traces-apm*\",\n \"winlogbeat-*\",\n
\"-*elastic-cloud-logs-*\"\n ],\n \"query\": \"*:*\",\n \"filters\":
[]\n },\n \"mapped_params\": {\n \"risk_score\": 21,\n \"severity\":
\"20-low\"\n },\n \"createdBy\": \"elastic\",\n \"updatedBy\":
\"elastic\",\n \"createdAt\": \"2026-03-17T10:52:28.688Z\",\n
\"updatedAt\": \"2026-03-17T10:52:28.688Z\",\n \"apiKey\": null,\n
\"apiKeyOwner\": null,\n \"apiKeyCreatedByUser\": null,\n \"throttle\":
null,\n \"notifyWhen\": null,\n \"muteAll\": false,\n
\"mutedInstanceIds\": [],\n \"executionStatus\": {\n \"status\":
\"pending\",\n \"lastExecutionDate\": \"2026-03-17T10:52:28.688Z\"\n
},\n \"monitoring\": {\n \"run\": {\n \"history\": [],\n
\"calculated_metrics\": {\n \"success_ratio\": 0\n },\n \"last_run\":
{\n \"timestamp\": \"2026-03-17T10:52:28.688Z\",\n \"metrics\": {\n
\"duration\": 0,\n \"total_search_duration_ms\": null,\n
\"total_indexing_duration_ms\": null,\n \"total_alerts_detected\":
null,\n \"total_alerts_created\": null,\n \"gap_duration_s\": null\n }\n
}\n }\n },\n \"lastRun\": {\n \"outcome\": \"failed\",\n \"outcomeMsg\":
\"security_exception: [security_exception] Reason: missing
authentication credentials for REST request
[/_security/user/_has_privileges], caused by: \\\"\\\"\",\n \"warning\":
\"read\",\n \"alertsCount\": {},\n \"outcomeOrder\": 20\n },\n
\"snoozeSchedule\": [],\n \"revision\": 0,\n \"running\": false,\n
\"artifacts\": {\n \"dashboards\": [],\n \"investigation_guide\": {\n
\"blob\": \"\"\n }\n },\n \"meta\": {\n \"versionApiKeyLastmodified\":
\"9.4.0\"\n }\n },\n \"type\": \"alert\",\n \"references\": [],\n
\"managed\": false,\n \"namespaces\": [\n \"default\"\n ],\n
\"coreMigrationVersion\": \"8.8.0\",\n \"typeMigrationVersion\":
\"10.10.0\",\n \"updated_at\": \"2026-03-17T10:52:28.688Z\",\n
\"created_at\": \"2026-03-17T10:52:28.688Z\"\n
}\n```\n</details>","sha":"b48ac09918bbd6e150c8b05b8ec963678458fee8"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/258105","number":258105,"mergeCommit":{"message":"[Security
Solution] Fix enable/disable action for rules with non-migrated
lastRun.outcomeMsg (#258105)\n\n**Resolves:
https://github.com/elastic/kibana/issues/177852**\n**Relates to:
https://github.com/elastic/kibana/pull/251164**\n\n## Summary\n\nThis PR
fixes an issue blocking enabling and disabling security rules with
non-migrated `lastRun.outcomeMsg` field.\n\n## Details\n\nSome time ago
Alerting Framework migrated `lastRun.outcomeMsg` from `string` to
`string[]`. At that moment usual migrations were deprecated due to
Serverless and model version migration wasn't ready yet. This migration
went smoothly thanks to the according changes to the codebase. However,
the changes didn't cover customers upgrading from `7.x` stack version
and having something written to
`lastRun.outcomeMsg`.\n\nhttps://github.com//pull/251164
fixed the issue appearing in attempt to update prebuilt rules.\n\nThis
PR fixes the left issue blocking enabling and disabling non-migrated
security rules with `lastRun.outcomeMsg` type `string` field.\n\n##
Testing\n\n- Start Kibana\n- Log in under `system_indices_superuser` to
be able to write to the system indices\n- Create a rule by using the
command below\n- Enable/Disable the rule\n- Perform any other bulk and
non-bulk actions on the rule\n\nER: All actions should work without
errors.\n\nWithout this fix enable/disable action will result in
error.\n\n<details>\n <summary>ES command to put a non-migrated
rule</summary>\n \n```\nPUT
.kibana_alerting_cases/_doc/alert:d62167ce-1022-4b2c-915d-024fe3e6e557\n{\n
\"alert\": {\n \"name\": \"Test rule 1\",\n \"tags\": [],\n \"enabled\":
false,\n \"alertTypeId\": \"siem.queryRule\",\n \"consumer\":
\"siem\",\n \"legacyId\": null,\n \"schedule\": {\n \"interval\":
\"5m\"\n },\n \"actions\": [],\n \"params\": {\n \"author\": [],\n
\"description\": \"123\",\n \"falsePositives\": [],\n \"from\":
\"now-6m\",\n \"ruleId\": \"5ecfb16d-5af2-4a31-b880-319a4a2ca92b\",\n
\"immutable\": false,\n \"ruleSource\": {\n \"type\": \"internal\"\n
},\n \"license\": \"\",\n \"outputIndex\": \"\",\n \"meta\": {\n
\"kibana_siem_app_url\": \"http://localhost:5601/kbn/app/security\"\n
},\n \"maxSignals\": 100,\n \"riskScore\": 21,\n \"riskScoreMapping\":
[],\n \"severity\": \"low\",\n \"severityMapping\": [],\n \"threat\":
[],\n \"to\": \"now\",\n \"references\": [],\n \"version\": 1,\n
\"exceptionsList\": [],\n \"relatedIntegrations\": [],\n
\"requiredFields\": [],\n \"setup\": \"\",\n \"type\": \"query\",\n
\"language\": \"kuery\",\n \"index\": [\n \"apm-*-transaction*\",\n
\"auditbeat-*\",\n \"endgame-*\",\n \"filebeat-*\",\n \"logs-*\",\n
\"packetbeat-*\",\n \"traces-apm*\",\n \"winlogbeat-*\",\n
\"-*elastic-cloud-logs-*\"\n ],\n \"query\": \"*:*\",\n \"filters\":
[]\n },\n \"mapped_params\": {\n \"risk_score\": 21,\n \"severity\":
\"20-low\"\n },\n \"createdBy\": \"elastic\",\n \"updatedBy\":
\"elastic\",\n \"createdAt\": \"2026-03-17T10:52:28.688Z\",\n
\"updatedAt\": \"2026-03-17T10:52:28.688Z\",\n \"apiKey\": null,\n
\"apiKeyOwner\": null,\n \"apiKeyCreatedByUser\": null,\n \"throttle\":
null,\n \"notifyWhen\": null,\n \"muteAll\": false,\n
\"mutedInstanceIds\": [],\n \"executionStatus\": {\n \"status\":
\"pending\",\n \"lastExecutionDate\": \"2026-03-17T10:52:28.688Z\"\n
},\n \"monitoring\": {\n \"run\": {\n \"history\": [],\n
\"calculated_metrics\": {\n \"success_ratio\": 0\n },\n \"last_run\":
{\n \"timestamp\": \"2026-03-17T10:52:28.688Z\",\n \"metrics\": {\n
\"duration\": 0,\n \"total_search_duration_ms\": null,\n
\"total_indexing_duration_ms\": null,\n \"total_alerts_detected\":
null,\n \"total_alerts_created\": null,\n \"gap_duration_s\": null\n }\n
}\n }\n },\n \"lastRun\": {\n \"outcome\": \"failed\",\n \"outcomeMsg\":
\"security_exception: [security_exception] Reason: missing
authentication credentials for REST request
[/_security/user/_has_privileges], caused by: \\\"\\\"\",\n \"warning\":
\"read\",\n \"alertsCount\": {},\n \"outcomeOrder\": 20\n },\n
\"snoozeSchedule\": [],\n \"revision\": 0,\n \"running\": false,\n
\"artifacts\": {\n \"dashboards\": [],\n \"investigation_guide\": {\n
\"blob\": \"\"\n }\n },\n \"meta\": {\n \"versionApiKeyLastmodified\":
\"9.4.0\"\n }\n },\n \"type\": \"alert\",\n \"references\": [],\n
\"managed\": false,\n \"namespaces\": [\n \"default\"\n ],\n
\"coreMigrationVersion\": \"8.8.0\",\n \"typeMigrationVersion\":
\"10.10.0\",\n \"updated_at\": \"2026-03-17T10:52:28.688Z\",\n
\"created_at\": \"2026-03-17T10:52:28.688Z\"\n
}\n```\n</details>","sha":"b48ac09918bbd6e150c8b05b8ec963678458fee8"}},{"branch":"8.19","label":"v8.19.13","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.2","label":"v9.2.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.3","label":"v9.3.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/259592","number":259592,"state":"OPEN"}]}]
BACKPORT-->
maximpn added a commit that referenced this pull request Mar 27, 2026
…on-migrated lastRun.outcomeMsg (#258105) (#259662)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Security Solution] Fix enable/disable action for rules with
non-migrated lastRun.outcomeMsg
(#258105)](#258105)

<!--- Backport version: 11.0.1 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Maxim
Palenov","email":"maxim.palenov@elastic.co"},"sourceCommit":{"committedDate":"2026-03-25T14:45:55Z","message":"[Security
Solution] Fix enable/disable action for rules with non-migrated
lastRun.outcomeMsg (#258105)\n\n**Resolves:
https://github.com/elastic/kibana/issues/177852**\n**Relates to:
https://github.com/elastic/kibana/pull/251164**\n\n## Summary\n\nThis PR
fixes an issue blocking enabling and disabling security rules with
non-migrated `lastRun.outcomeMsg` field.\n\n## Details\n\nSome time ago
Alerting Framework migrated `lastRun.outcomeMsg` from `string` to
`string[]`. At that moment usual migrations were deprecated due to
Serverless and model version migration wasn't ready yet. This migration
went smoothly thanks to the according changes to the codebase. However,
the changes didn't cover customers upgrading from `7.x` stack version
and having something written to
`lastRun.outcomeMsg`.\n\nhttps://github.com//pull/251164
fixed the issue appearing in attempt to update prebuilt rules.\n\nThis
PR fixes the left issue blocking enabling and disabling non-migrated
security rules with `lastRun.outcomeMsg` type `string` field.\n\n##
Testing\n\n- Start Kibana\n- Log in under `system_indices_superuser` to
be able to write to the system indices\n- Create a rule by using the
command below\n- Enable/Disable the rule\n- Perform any other bulk and
non-bulk actions on the rule\n\nER: All actions should work without
errors.\n\nWithout this fix enable/disable action will result in
error.\n\n<details>\n <summary>ES command to put a non-migrated
rule</summary>\n \n```\nPUT
.kibana_alerting_cases/_doc/alert:d62167ce-1022-4b2c-915d-024fe3e6e557\n{\n
\"alert\": {\n \"name\": \"Test rule 1\",\n \"tags\": [],\n \"enabled\":
false,\n \"alertTypeId\": \"siem.queryRule\",\n \"consumer\":
\"siem\",\n \"legacyId\": null,\n \"schedule\": {\n \"interval\":
\"5m\"\n },\n \"actions\": [],\n \"params\": {\n \"author\": [],\n
\"description\": \"123\",\n \"falsePositives\": [],\n \"from\":
\"now-6m\",\n \"ruleId\": \"5ecfb16d-5af2-4a31-b880-319a4a2ca92b\",\n
\"immutable\": false,\n \"ruleSource\": {\n \"type\": \"internal\"\n
},\n \"license\": \"\",\n \"outputIndex\": \"\",\n \"meta\": {\n
\"kibana_siem_app_url\": \"http://localhost:5601/kbn/app/security\"\n
},\n \"maxSignals\": 100,\n \"riskScore\": 21,\n \"riskScoreMapping\":
[],\n \"severity\": \"low\",\n \"severityMapping\": [],\n \"threat\":
[],\n \"to\": \"now\",\n \"references\": [],\n \"version\": 1,\n
\"exceptionsList\": [],\n \"relatedIntegrations\": [],\n
\"requiredFields\": [],\n \"setup\": \"\",\n \"type\": \"query\",\n
\"language\": \"kuery\",\n \"index\": [\n \"apm-*-transaction*\",\n
\"auditbeat-*\",\n \"endgame-*\",\n \"filebeat-*\",\n \"logs-*\",\n
\"packetbeat-*\",\n \"traces-apm*\",\n \"winlogbeat-*\",\n
\"-*elastic-cloud-logs-*\"\n ],\n \"query\": \"*:*\",\n \"filters\":
[]\n },\n \"mapped_params\": {\n \"risk_score\": 21,\n \"severity\":
\"20-low\"\n },\n \"createdBy\": \"elastic\",\n \"updatedBy\":
\"elastic\",\n \"createdAt\": \"2026-03-17T10:52:28.688Z\",\n
\"updatedAt\": \"2026-03-17T10:52:28.688Z\",\n \"apiKey\": null,\n
\"apiKeyOwner\": null,\n \"apiKeyCreatedByUser\": null,\n \"throttle\":
null,\n \"notifyWhen\": null,\n \"muteAll\": false,\n
\"mutedInstanceIds\": [],\n \"executionStatus\": {\n \"status\":
\"pending\",\n \"lastExecutionDate\": \"2026-03-17T10:52:28.688Z\"\n
},\n \"monitoring\": {\n \"run\": {\n \"history\": [],\n
\"calculated_metrics\": {\n \"success_ratio\": 0\n },\n \"last_run\":
{\n \"timestamp\": \"2026-03-17T10:52:28.688Z\",\n \"metrics\": {\n
\"duration\": 0,\n \"total_search_duration_ms\": null,\n
\"total_indexing_duration_ms\": null,\n \"total_alerts_detected\":
null,\n \"total_alerts_created\": null,\n \"gap_duration_s\": null\n }\n
}\n }\n },\n \"lastRun\": {\n \"outcome\": \"failed\",\n \"outcomeMsg\":
\"security_exception: [security_exception] Reason: missing
authentication credentials for REST request
[/_security/user/_has_privileges], caused by: \\\"\\\"\",\n \"warning\":
\"read\",\n \"alertsCount\": {},\n \"outcomeOrder\": 20\n },\n
\"snoozeSchedule\": [],\n \"revision\": 0,\n \"running\": false,\n
\"artifacts\": {\n \"dashboards\": [],\n \"investigation_guide\": {\n
\"blob\": \"\"\n }\n },\n \"meta\": {\n \"versionApiKeyLastmodified\":
\"9.4.0\"\n }\n },\n \"type\": \"alert\",\n \"references\": [],\n
\"managed\": false,\n \"namespaces\": [\n \"default\"\n ],\n
\"coreMigrationVersion\": \"8.8.0\",\n \"typeMigrationVersion\":
\"10.10.0\",\n \"updated_at\": \"2026-03-17T10:52:28.688Z\",\n
\"created_at\": \"2026-03-17T10:52:28.688Z\"\n
}\n```\n</details>","sha":"b48ac09918bbd6e150c8b05b8ec963678458fee8","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:Detections
and Resp","Team: SecuritySolution","QA:Validated","Feature:Rule
Management","Team:Detection Rule
Management","backport:version","v9.4.0","v8.19.13","v9.2.7","v9.3.2"],"title":"[Security
Solution] Fix enable/disable action for rules with non-migrated
lastRun.outcomeMsg","number":258105,"url":"https://github.com/elastic/kibana/pull/258105","mergeCommit":{"message":"[Security
Solution] Fix enable/disable action for rules with non-migrated
lastRun.outcomeMsg (#258105)\n\n**Resolves:
https://github.com/elastic/kibana/issues/177852**\n**Relates to:
https://github.com/elastic/kibana/pull/251164**\n\n## Summary\n\nThis PR
fixes an issue blocking enabling and disabling security rules with
non-migrated `lastRun.outcomeMsg` field.\n\n## Details\n\nSome time ago
Alerting Framework migrated `lastRun.outcomeMsg` from `string` to
`string[]`. At that moment usual migrations were deprecated due to
Serverless and model version migration wasn't ready yet. This migration
went smoothly thanks to the according changes to the codebase. However,
the changes didn't cover customers upgrading from `7.x` stack version
and having something written to
`lastRun.outcomeMsg`.\n\nhttps://github.com//pull/251164
fixed the issue appearing in attempt to update prebuilt rules.\n\nThis
PR fixes the left issue blocking enabling and disabling non-migrated
security rules with `lastRun.outcomeMsg` type `string` field.\n\n##
Testing\n\n- Start Kibana\n- Log in under `system_indices_superuser` to
be able to write to the system indices\n- Create a rule by using the
command below\n- Enable/Disable the rule\n- Perform any other bulk and
non-bulk actions on the rule\n\nER: All actions should work without
errors.\n\nWithout this fix enable/disable action will result in
error.\n\n<details>\n <summary>ES command to put a non-migrated
rule</summary>\n \n```\nPUT
.kibana_alerting_cases/_doc/alert:d62167ce-1022-4b2c-915d-024fe3e6e557\n{\n
\"alert\": {\n \"name\": \"Test rule 1\",\n \"tags\": [],\n \"enabled\":
false,\n \"alertTypeId\": \"siem.queryRule\",\n \"consumer\":
\"siem\",\n \"legacyId\": null,\n \"schedule\": {\n \"interval\":
\"5m\"\n },\n \"actions\": [],\n \"params\": {\n \"author\": [],\n
\"description\": \"123\",\n \"falsePositives\": [],\n \"from\":
\"now-6m\",\n \"ruleId\": \"5ecfb16d-5af2-4a31-b880-319a4a2ca92b\",\n
\"immutable\": false,\n \"ruleSource\": {\n \"type\": \"internal\"\n
},\n \"license\": \"\",\n \"outputIndex\": \"\",\n \"meta\": {\n
\"kibana_siem_app_url\": \"http://localhost:5601/kbn/app/security\"\n
},\n \"maxSignals\": 100,\n \"riskScore\": 21,\n \"riskScoreMapping\":
[],\n \"severity\": \"low\",\n \"severityMapping\": [],\n \"threat\":
[],\n \"to\": \"now\",\n \"references\": [],\n \"version\": 1,\n
\"exceptionsList\": [],\n \"relatedIntegrations\": [],\n
\"requiredFields\": [],\n \"setup\": \"\",\n \"type\": \"query\",\n
\"language\": \"kuery\",\n \"index\": [\n \"apm-*-transaction*\",\n
\"auditbeat-*\",\n \"endgame-*\",\n \"filebeat-*\",\n \"logs-*\",\n
\"packetbeat-*\",\n \"traces-apm*\",\n \"winlogbeat-*\",\n
\"-*elastic-cloud-logs-*\"\n ],\n \"query\": \"*:*\",\n \"filters\":
[]\n },\n \"mapped_params\": {\n \"risk_score\": 21,\n \"severity\":
\"20-low\"\n },\n \"createdBy\": \"elastic\",\n \"updatedBy\":
\"elastic\",\n \"createdAt\": \"2026-03-17T10:52:28.688Z\",\n
\"updatedAt\": \"2026-03-17T10:52:28.688Z\",\n \"apiKey\": null,\n
\"apiKeyOwner\": null,\n \"apiKeyCreatedByUser\": null,\n \"throttle\":
null,\n \"notifyWhen\": null,\n \"muteAll\": false,\n
\"mutedInstanceIds\": [],\n \"executionStatus\": {\n \"status\":
\"pending\",\n \"lastExecutionDate\": \"2026-03-17T10:52:28.688Z\"\n
},\n \"monitoring\": {\n \"run\": {\n \"history\": [],\n
\"calculated_metrics\": {\n \"success_ratio\": 0\n },\n \"last_run\":
{\n \"timestamp\": \"2026-03-17T10:52:28.688Z\",\n \"metrics\": {\n
\"duration\": 0,\n \"total_search_duration_ms\": null,\n
\"total_indexing_duration_ms\": null,\n \"total_alerts_detected\":
null,\n \"total_alerts_created\": null,\n \"gap_duration_s\": null\n }\n
}\n }\n },\n \"lastRun\": {\n \"outcome\": \"failed\",\n \"outcomeMsg\":
\"security_exception: [security_exception] Reason: missing
authentication credentials for REST request
[/_security/user/_has_privileges], caused by: \\\"\\\"\",\n \"warning\":
\"read\",\n \"alertsCount\": {},\n \"outcomeOrder\": 20\n },\n
\"snoozeSchedule\": [],\n \"revision\": 0,\n \"running\": false,\n
\"artifacts\": {\n \"dashboards\": [],\n \"investigation_guide\": {\n
\"blob\": \"\"\n }\n },\n \"meta\": {\n \"versionApiKeyLastmodified\":
\"9.4.0\"\n }\n },\n \"type\": \"alert\",\n \"references\": [],\n
\"managed\": false,\n \"namespaces\": [\n \"default\"\n ],\n
\"coreMigrationVersion\": \"8.8.0\",\n \"typeMigrationVersion\":
\"10.10.0\",\n \"updated_at\": \"2026-03-17T10:52:28.688Z\",\n
\"created_at\": \"2026-03-17T10:52:28.688Z\"\n
}\n```\n</details>","sha":"b48ac09918bbd6e150c8b05b8ec963678458fee8"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/258105","number":258105,"mergeCommit":{"message":"[Security
Solution] Fix enable/disable action for rules with non-migrated
lastRun.outcomeMsg (#258105)\n\n**Resolves:
https://github.com/elastic/kibana/issues/177852**\n**Relates to:
https://github.com/elastic/kibana/pull/251164**\n\n## Summary\n\nThis PR
fixes an issue blocking enabling and disabling security rules with
non-migrated `lastRun.outcomeMsg` field.\n\n## Details\n\nSome time ago
Alerting Framework migrated `lastRun.outcomeMsg` from `string` to
`string[]`. At that moment usual migrations were deprecated due to
Serverless and model version migration wasn't ready yet. This migration
went smoothly thanks to the according changes to the codebase. However,
the changes didn't cover customers upgrading from `7.x` stack version
and having something written to
`lastRun.outcomeMsg`.\n\nhttps://github.com//pull/251164
fixed the issue appearing in attempt to update prebuilt rules.\n\nThis
PR fixes the left issue blocking enabling and disabling non-migrated
security rules with `lastRun.outcomeMsg` type `string` field.\n\n##
Testing\n\n- Start Kibana\n- Log in under `system_indices_superuser` to
be able to write to the system indices\n- Create a rule by using the
command below\n- Enable/Disable the rule\n- Perform any other bulk and
non-bulk actions on the rule\n\nER: All actions should work without
errors.\n\nWithout this fix enable/disable action will result in
error.\n\n<details>\n <summary>ES command to put a non-migrated
rule</summary>\n \n```\nPUT
.kibana_alerting_cases/_doc/alert:d62167ce-1022-4b2c-915d-024fe3e6e557\n{\n
\"alert\": {\n \"name\": \"Test rule 1\",\n \"tags\": [],\n \"enabled\":
false,\n \"alertTypeId\": \"siem.queryRule\",\n \"consumer\":
\"siem\",\n \"legacyId\": null,\n \"schedule\": {\n \"interval\":
\"5m\"\n },\n \"actions\": [],\n \"params\": {\n \"author\": [],\n
\"description\": \"123\",\n \"falsePositives\": [],\n \"from\":
\"now-6m\",\n \"ruleId\": \"5ecfb16d-5af2-4a31-b880-319a4a2ca92b\",\n
\"immutable\": false,\n \"ruleSource\": {\n \"type\": \"internal\"\n
},\n \"license\": \"\",\n \"outputIndex\": \"\",\n \"meta\": {\n
\"kibana_siem_app_url\": \"http://localhost:5601/kbn/app/security\"\n
},\n \"maxSignals\": 100,\n \"riskScore\": 21,\n \"riskScoreMapping\":
[],\n \"severity\": \"low\",\n \"severityMapping\": [],\n \"threat\":
[],\n \"to\": \"now\",\n \"references\": [],\n \"version\": 1,\n
\"exceptionsList\": [],\n \"relatedIntegrations\": [],\n
\"requiredFields\": [],\n \"setup\": \"\",\n \"type\": \"query\",\n
\"language\": \"kuery\",\n \"index\": [\n \"apm-*-transaction*\",\n
\"auditbeat-*\",\n \"endgame-*\",\n \"filebeat-*\",\n \"logs-*\",\n
\"packetbeat-*\",\n \"traces-apm*\",\n \"winlogbeat-*\",\n
\"-*elastic-cloud-logs-*\"\n ],\n \"query\": \"*:*\",\n \"filters\":
[]\n },\n \"mapped_params\": {\n \"risk_score\": 21,\n \"severity\":
\"20-low\"\n },\n \"createdBy\": \"elastic\",\n \"updatedBy\":
\"elastic\",\n \"createdAt\": \"2026-03-17T10:52:28.688Z\",\n
\"updatedAt\": \"2026-03-17T10:52:28.688Z\",\n \"apiKey\": null,\n
\"apiKeyOwner\": null,\n \"apiKeyCreatedByUser\": null,\n \"throttle\":
null,\n \"notifyWhen\": null,\n \"muteAll\": false,\n
\"mutedInstanceIds\": [],\n \"executionStatus\": {\n \"status\":
\"pending\",\n \"lastExecutionDate\": \"2026-03-17T10:52:28.688Z\"\n
},\n \"monitoring\": {\n \"run\": {\n \"history\": [],\n
\"calculated_metrics\": {\n \"success_ratio\": 0\n },\n \"last_run\":
{\n \"timestamp\": \"2026-03-17T10:52:28.688Z\",\n \"metrics\": {\n
\"duration\": 0,\n \"total_search_duration_ms\": null,\n
\"total_indexing_duration_ms\": null,\n \"total_alerts_detected\":
null,\n \"total_alerts_created\": null,\n \"gap_duration_s\": null\n }\n
}\n }\n },\n \"lastRun\": {\n \"outcome\": \"failed\",\n \"outcomeMsg\":
\"security_exception: [security_exception] Reason: missing
authentication credentials for REST request
[/_security/user/_has_privileges], caused by: \\\"\\\"\",\n \"warning\":
\"read\",\n \"alertsCount\": {},\n \"outcomeOrder\": 20\n },\n
\"snoozeSchedule\": [],\n \"revision\": 0,\n \"running\": false,\n
\"artifacts\": {\n \"dashboards\": [],\n \"investigation_guide\": {\n
\"blob\": \"\"\n }\n },\n \"meta\": {\n \"versionApiKeyLastmodified\":
\"9.4.0\"\n }\n },\n \"type\": \"alert\",\n \"references\": [],\n
\"managed\": false,\n \"namespaces\": [\n \"default\"\n ],\n
\"coreMigrationVersion\": \"8.8.0\",\n \"typeMigrationVersion\":
\"10.10.0\",\n \"updated_at\": \"2026-03-17T10:52:28.688Z\",\n
\"created_at\": \"2026-03-17T10:52:28.688Z\"\n
}\n```\n</details>","sha":"b48ac09918bbd6e150c8b05b8ec963678458fee8"}},{"branch":"8.19","label":"v8.19.13","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.2","label":"v9.2.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.3","label":"v9.3.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/259592","number":259592,"state":"OPEN"}]}]
BACKPORT-->
maximpn added a commit to maximpn/kibana that referenced this pull request Mar 27, 2026
…kiness (elastic#259955)

**Resolves: elastic#259634
**Relates to:** elastic#258105

## Summary

This PR fixes rule's `lastRun.outcomeMsg` functional test flakiness. The flakiness was caused by race condition between rule execution and setting the legacy `outcomeMsg`'s value.

(cherry picked from commit 737848b)
maximpn added a commit to maximpn/kibana that referenced this pull request Mar 27, 2026
…kiness (elastic#259955)

**Resolves: elastic#259634
**Relates to:** elastic#258105

## Summary

This PR fixes rule's `lastRun.outcomeMsg` functional test flakiness. The flakiness was caused by race condition between rule execution and setting the legacy `outcomeMsg`'s value.

(cherry picked from commit 737848b)
SoniaSanzV pushed a commit to SoniaSanzV/kibana that referenced this pull request Mar 30, 2026
…kiness (elastic#259955)

**Resolves: elastic#259634
**Relates to:** elastic#258105

## Summary

This PR fixes rule's `lastRun.outcomeMsg` functional test flakiness. The flakiness was caused by race condition between rule execution and setting the legacy `outcomeMsg`'s value.
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Apr 1, 2026
…ated lastRun.outcomeMsg (elastic#258105)

**Resolves: elastic#177852
**Relates to: elastic#251164

## Summary

This PR fixes an issue blocking enabling and disabling security rules with non-migrated `lastRun.outcomeMsg` field.

## Details

Some time ago Alerting Framework migrated `lastRun.outcomeMsg` from `string` to `string[]`. At that moment usual migrations were deprecated due to Serverless and model version migration wasn't ready yet. This migration went smoothly thanks to the according changes to the codebase. However, the changes didn't cover customers upgrading from `7.x` stack version and having something written to `lastRun.outcomeMsg`.

elastic#251164 fixed the issue appearing in attempt to update prebuilt rules.

This PR fixes the left issue blocking enabling and disabling non-migrated security rules with `lastRun.outcomeMsg` type `string` field.

## Testing

- Start Kibana
- Log in under `system_indices_superuser` to be able to write to the system indices
- Create a rule by using the command below
- Enable/Disable the rule
- Perform any other bulk and non-bulk actions on the rule

ER: All actions should work without errors.

Without this fix enable/disable action will result in error.

<details>
  <summary>ES command to put a non-migrated rule</summary>
  
```
PUT .kibana_alerting_cases/_doc/alert:d62167ce-1022-4b2c-915d-024fe3e6e557
{
    "alert": {
      "name": "Test rule 1",
      "tags": [],
      "enabled": false,
      "alertTypeId": "siem.queryRule",
      "consumer": "siem",
      "legacyId": null,
      "schedule": {
        "interval": "5m"
      },
      "actions": [],
      "params": {
        "author": [],
        "description": "123",
        "falsePositives": [],
        "from": "now-6m",
        "ruleId": "5ecfb16d-5af2-4a31-b880-319a4a2ca92b",
        "immutable": false,
        "ruleSource": {
          "type": "internal"
        },
        "license": "",
        "outputIndex": "",
        "meta": {
          "kibana_siem_app_url": "http://localhost:5601/kbn/app/security"
        },
        "maxSignals": 100,
        "riskScore": 21,
        "riskScoreMapping": [],
        "severity": "low",
        "severityMapping": [],
        "threat": [],
        "to": "now",
        "references": [],
        "version": 1,
        "exceptionsList": [],
        "relatedIntegrations": [],
        "requiredFields": [],
        "setup": "",
        "type": "query",
        "language": "kuery",
        "index": [
          "apm-*-transaction*",
          "auditbeat-*",
          "endgame-*",
          "filebeat-*",
          "logs-*",
          "packetbeat-*",
          "traces-apm*",
          "winlogbeat-*",
          "-*elastic-cloud-logs-*"
        ],
        "query": "*:*",
        "filters": []
      },
      "mapped_params": {
        "risk_score": 21,
        "severity": "20-low"
      },
      "createdBy": "elastic",
      "updatedBy": "elastic",
      "createdAt": "2026-03-17T10:52:28.688Z",
      "updatedAt": "2026-03-17T10:52:28.688Z",
      "apiKey": null,
      "apiKeyOwner": null,
      "apiKeyCreatedByUser": null,
      "throttle": null,
      "notifyWhen": null,
      "muteAll": false,
      "mutedInstanceIds": [],
      "executionStatus": {
        "status": "pending",
        "lastExecutionDate": "2026-03-17T10:52:28.688Z"
      },
      "monitoring": {
        "run": {
          "history": [],
          "calculated_metrics": {
            "success_ratio": 0
          },
          "last_run": {
            "timestamp": "2026-03-17T10:52:28.688Z",
            "metrics": {
              "duration": 0,
              "total_search_duration_ms": null,
              "total_indexing_duration_ms": null,
              "total_alerts_detected": null,
              "total_alerts_created": null,
              "gap_duration_s": null
            }
          }
        }
      },
      "lastRun": {
        "outcome": "failed",
        "outcomeMsg": "security_exception: [security_exception] Reason: missing authentication credentials for REST request [/_security/user/_has_privileges], caused by: \"\"",
        "warning": "read",
        "alertsCount": {},
        "outcomeOrder": 20
    },
      "snoozeSchedule": [],
      "revision": 0,
      "running": false,
      "artifacts": {
        "dashboards": [],
        "investigation_guide": {
          "blob": ""
        }
      },
      "meta": {
        "versionApiKeyLastmodified": "9.4.0"
      }
    },
    "type": "alert",
    "references": [],
    "managed": false,
    "namespaces": [
      "default"
    ],
    "coreMigrationVersion": "8.8.0",
    "typeMigrationVersion": "10.10.0",
    "updated_at": "2026-03-17T10:52:28.688Z",
    "created_at": "2026-03-17T10:52:28.688Z"
  }
```
</details>
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Apr 1, 2026
…kiness (elastic#259955)

**Resolves: elastic#259634
**Relates to:** elastic#258105

## Summary

This PR fixes rule's `lastRun.outcomeMsg` functional test flakiness. The flakiness was caused by race condition between rule execution and setting the legacy `outcomeMsg`'s value.
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Apr 2, 2026
…ated lastRun.outcomeMsg (elastic#258105)

**Resolves: elastic#177852
**Relates to: elastic#251164

## Summary

This PR fixes an issue blocking enabling and disabling security rules with non-migrated `lastRun.outcomeMsg` field.

## Details

Some time ago Alerting Framework migrated `lastRun.outcomeMsg` from `string` to `string[]`. At that moment usual migrations were deprecated due to Serverless and model version migration wasn't ready yet. This migration went smoothly thanks to the according changes to the codebase. However, the changes didn't cover customers upgrading from `7.x` stack version and having something written to `lastRun.outcomeMsg`.

elastic#251164 fixed the issue appearing in attempt to update prebuilt rules.

This PR fixes the left issue blocking enabling and disabling non-migrated security rules with `lastRun.outcomeMsg` type `string` field.

## Testing

- Start Kibana
- Log in under `system_indices_superuser` to be able to write to the system indices
- Create a rule by using the command below
- Enable/Disable the rule
- Perform any other bulk and non-bulk actions on the rule

ER: All actions should work without errors.

Without this fix enable/disable action will result in error.

<details>
  <summary>ES command to put a non-migrated rule</summary>
  
```
PUT .kibana_alerting_cases/_doc/alert:d62167ce-1022-4b2c-915d-024fe3e6e557
{
    "alert": {
      "name": "Test rule 1",
      "tags": [],
      "enabled": false,
      "alertTypeId": "siem.queryRule",
      "consumer": "siem",
      "legacyId": null,
      "schedule": {
        "interval": "5m"
      },
      "actions": [],
      "params": {
        "author": [],
        "description": "123",
        "falsePositives": [],
        "from": "now-6m",
        "ruleId": "5ecfb16d-5af2-4a31-b880-319a4a2ca92b",
        "immutable": false,
        "ruleSource": {
          "type": "internal"
        },
        "license": "",
        "outputIndex": "",
        "meta": {
          "kibana_siem_app_url": "http://localhost:5601/kbn/app/security"
        },
        "maxSignals": 100,
        "riskScore": 21,
        "riskScoreMapping": [],
        "severity": "low",
        "severityMapping": [],
        "threat": [],
        "to": "now",
        "references": [],
        "version": 1,
        "exceptionsList": [],
        "relatedIntegrations": [],
        "requiredFields": [],
        "setup": "",
        "type": "query",
        "language": "kuery",
        "index": [
          "apm-*-transaction*",
          "auditbeat-*",
          "endgame-*",
          "filebeat-*",
          "logs-*",
          "packetbeat-*",
          "traces-apm*",
          "winlogbeat-*",
          "-*elastic-cloud-logs-*"
        ],
        "query": "*:*",
        "filters": []
      },
      "mapped_params": {
        "risk_score": 21,
        "severity": "20-low"
      },
      "createdBy": "elastic",
      "updatedBy": "elastic",
      "createdAt": "2026-03-17T10:52:28.688Z",
      "updatedAt": "2026-03-17T10:52:28.688Z",
      "apiKey": null,
      "apiKeyOwner": null,
      "apiKeyCreatedByUser": null,
      "throttle": null,
      "notifyWhen": null,
      "muteAll": false,
      "mutedInstanceIds": [],
      "executionStatus": {
        "status": "pending",
        "lastExecutionDate": "2026-03-17T10:52:28.688Z"
      },
      "monitoring": {
        "run": {
          "history": [],
          "calculated_metrics": {
            "success_ratio": 0
          },
          "last_run": {
            "timestamp": "2026-03-17T10:52:28.688Z",
            "metrics": {
              "duration": 0,
              "total_search_duration_ms": null,
              "total_indexing_duration_ms": null,
              "total_alerts_detected": null,
              "total_alerts_created": null,
              "gap_duration_s": null
            }
          }
        }
      },
      "lastRun": {
        "outcome": "failed",
        "outcomeMsg": "security_exception: [security_exception] Reason: missing authentication credentials for REST request [/_security/user/_has_privileges], caused by: \"\"",
        "warning": "read",
        "alertsCount": {},
        "outcomeOrder": 20
    },
      "snoozeSchedule": [],
      "revision": 0,
      "running": false,
      "artifacts": {
        "dashboards": [],
        "investigation_guide": {
          "blob": ""
        }
      },
      "meta": {
        "versionApiKeyLastmodified": "9.4.0"
      }
    },
    "type": "alert",
    "references": [],
    "managed": false,
    "namespaces": [
      "default"
    ],
    "coreMigrationVersion": "8.8.0",
    "typeMigrationVersion": "10.10.0",
    "updated_at": "2026-03-17T10:52:28.688Z",
    "created_at": "2026-03-17T10:52:28.688Z"
  }
```
</details>
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Apr 2, 2026
…kiness (elastic#259955)

**Resolves: elastic#259634
**Relates to:** elastic#258105

## Summary

This PR fixes rule's `lastRun.outcomeMsg` functional test flakiness. The flakiness was caused by race condition between rule execution and setting the legacy `outcomeMsg`'s value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels bug Fixes for quality problems that affect the customer experience Feature:Rule Management Security Solution Detection Rule Management area QA:Validated Issue has been validated by QA release_note:skip Skip the PR/issue when compiling release notes Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.19.13 v8.19.14 v9.2.7 v9.2.8 v9.3.2 v9.3.3 v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security Solution] Rule Update failure on 8.13 from 7.17.18

5 participants