Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5d8ae27
fix(security-solution): accept runtime_mappings verbatim on bulk-clos…
jonwalstedt Sep 7, 2026
4bf2121
fix(security-solution): send data view runtime mappings verbatim on s…
jonwalstedt Sep 7, 2026
f3b5276
fix(security-solution): wire runtime mappings through group take-acti…
jonwalstedt Sep 7, 2026
95a2e2e
test(security-solution): add integration tests for runtime_mappings o…
jonwalstedt Sep 7, 2026
861da98
fix(security-solution): count unique field names for runtime cap, not…
jonwalstedt Sep 7, 2026
f3a3ebd
test(security-solution): strengthen scriptless runtime_mappings integ…
jonwalstedt Sep 7, 2026
00d24b2
docs(security-solution): clarify runtime_mappings API constraints in …
jonwalstedt Sep 7, 2026
60a39a8
test(security-solution): fix _source path traversal in runtime_mappin…
jonwalstedt Sep 7, 2026
bc9935c
fix(security-solution): drop entries with non-inline scripts instead …
jonwalstedt Sep 7, 2026
91ce988
test(security-solution): rename misleading test description for unkno…
jonwalstedt Sep 7, 2026
c3192dc
fix(security-solution): drop runtime_mappings entries with inline scr…
jonwalstedt Sep 7, 2026
adaab4d
fix(security-solution): reject script.params and lang on runtime_mapp…
jonwalstedt Sep 7, 2026
c4db960
fix(security-solution): address review findings for bulk-close runtim…
jonwalstedt Sep 7, 2026
493f8ce
refactor(security-solution): simplify toBulkCloseRuntimeMappings with…
jonwalstedt Sep 8, 2026
3c4f0fb
refactor(security-solution): replace type casts with type predicate a…
jonwalstedt Sep 8, 2026
2a1c4e4
fix(security-solution): fix TS2322 in alerts_sub_grouping — use RunTi…
jonwalstedt Sep 8, 2026
cbc8b3a
Changes from yarn openapi:generate
kibanamachine Sep 9, 2026
0c9fd6f
Changes from node scripts/lint_ts_projects --fix
kibanamachine Sep 9, 2026
1364d06
Changes from node scripts/regenerate_moon_projects.js --update
kibanamachine Sep 9, 2026
9d9815d
Changes from make api-docs
kibanamachine Sep 9, 2026
52b062f
Merge branch 'main' into 19185-unable-to-bulk-close-alerts-followup
elasticmachine Sep 11, 2026
e34d246
Update docs
jonwalstedt Sep 12, 2026
a237a9e
Update docs
jonwalstedt Sep 12, 2026
e434c5b
Update docs
jonwalstedt Sep 12, 2026
3833b6a
Update docs
jonwalstedt Sep 12, 2026
f6b6e6a
Update docs
jonwalstedt Sep 12, 2026
1a43fd5
Changes from yarn openapi:generate
kibanamachine Sep 12, 2026
9853a0d
Changes from yarn openapi:bundle
kibanamachine Sep 12, 2026
5075a50
Changes from make api-docs
kibanamachine Sep 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions oas_docs/output/kibana.serverless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@
'200':
description: Returns the OAuth callback script
summary: ''
tags: []

Check warning on line 483 in oas_docs/output/kibana.serverless.yaml

View workflow job for this annotation

GitHub Actions / lint (oas_docs/output/kibana.serverless.yaml)

operation-tags

Operation must have non-empty "tags" array.
x-state: ''
x-metaTags:
- content: Kibana, Elastic Cloud Serverless
Expand Down Expand Up @@ -128134,6 +128134,16 @@
description: Optional map of field name to runtime field type. For each entry, the server defines a runtime field of the given type that reads its value from `_source[fieldName]` and attaches it to the underlying `_update_by_query` as `runtime_mappings`. Allows the `query` to reference non-ECS fields stored on the alert `_source` but not in the alerts index mapping — for example, runtime fields the rule's source index defined at the time the alerts were created. Limited to 100 entries per request; larger maps are rejected.
maxProperties: 100
type: object
runtime_mappings:
additionalProperties:
$ref: '#/components/schemas/Security_Detections_API_RuntimeFieldMapping'
description: |-
Use this when the query references fields that are not in the alerts index mapping, for example data view runtime fields with a Painless script.
Kibana sends `type`, `script.source`, and `format` to Elasticsearch as `runtime_mappings` on the status-update query. Unlike `runtime_fields`, Kibana keeps your script and runs it at query time. It does not replace the script with a `_source` reader.
When a script is present, Kibana sets `on_script_error` to `continue`. If the script fails on one alert, that field has no value for the alert and the update continues.
Unique field names across `runtime_fields` and `runtime_mappings` combined cannot exceed 100. Larger maps are rejected.
maxProperties: 100
type: object
status:
enum:
- closed
Expand Down Expand Up @@ -131694,6 +131704,29 @@
$ref: '#/components/schemas/Security_Detections_API_RunScriptOsConfigValues'
required:
- command
Security_Detections_API_RuntimeFieldMapping:
description: A runtime field included in the status-update query so the query can match fields that are not in the alerts index mapping, for example scripted fields on a data view. Elasticsearch evaluates the field at query time.
type: object
properties:
format:
description: Format string for date runtime fields, for example `strict_date_optional_time`.
maxLength: 100
type: string
script:
additionalProperties: false
description: Inline Painless script that Elasticsearch evaluates for each alert. Only `source` is accepted. Stored scripts, parameterized scripts (`params`), and non-default `lang` values are not supported. Extra properties are rejected with a 400 so the script is not run with different semantics.
type: object
properties:
source:
description: Painless script source to execute.
maxLength: 10000
type: string
required:
- source
type:
$ref: '#/components/schemas/Security_Detections_API_RuntimeFieldType'
required:
- type
Security_Detections_API_RuntimeFieldType:
description: The data type for the runtime field type. Determines how the field value is indexed and queried.
enum:
Expand Down Expand Up @@ -132269,6 +132302,16 @@
description: Optional map of field name to runtime field type. For each entry, a runtime field of the specified type is created reading its value from `_source[fieldName]` and included in the query as `runtime_mappings`. Use this to reference fields stored on the alert `_source` that are not part of the Elastic Common Schema (ECS) of the alerts index mapping, for example, custom fields that the rule's source index defined when the alerts were created.
maxProperties: 100
type: object
runtime_mappings:
additionalProperties:
$ref: '#/components/schemas/Security_Detections_API_RuntimeFieldMapping'
description: |-
Use this when the query references fields that are not in the alerts index mapping, for example data view runtime fields with a Painless script.
Kibana sends `type`, `script.source`, and `format` to Elasticsearch as `runtime_mappings` on the status-update query. Unlike `runtime_fields`, Kibana keeps your script and runs it at query time. It does not replace the script with a `_source` reader.
When a script is present, Kibana sets `on_script_error` to `continue`. If the script fails on one alert, that field has no value for the alert and the update continues.
Unique field names across `runtime_fields` and `runtime_mappings` combined cannot exceed 100. Larger maps are rejected.
maxProperties: 100
type: object
status:
$ref: '#/components/schemas/Security_Detections_API_AlertStatusExceptClosed'
required:
Expand Down
43 changes: 43 additions & 0 deletions oas_docs/output/kibana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@
'200':
description: Returns the OAuth callback script
summary: ''
tags: []

Check warning on line 547 in oas_docs/output/kibana.yaml

View workflow job for this annotation

GitHub Actions / lint (oas_docs/output/kibana.yaml)

operation-tags

Operation must have non-empty "tags" array.
x-state: Added in 9.4.0
x-metaTags:
- content: Kibana
Expand Down Expand Up @@ -135939,6 +135939,16 @@
description: Optional map of field name to runtime field type. For each entry, the server defines a runtime field of the given type that reads its value from `_source[fieldName]` and attaches it to the underlying `_update_by_query` as `runtime_mappings`. Allows the `query` to reference non-ECS fields stored on the alert `_source` but not in the alerts index mapping — for example, runtime fields the rule's source index defined at the time the alerts were created. Limited to 100 entries per request; larger maps are rejected.
maxProperties: 100
type: object
runtime_mappings:
additionalProperties:
$ref: '#/components/schemas/Security_Detections_API_RuntimeFieldMapping'
description: |-
Use this when the query references fields that are not in the alerts index mapping, for example data view runtime fields with a Painless script.
Kibana sends `type`, `script.source`, and `format` to Elasticsearch as `runtime_mappings` on the status-update query. Unlike `runtime_fields`, Kibana keeps your script and runs it at query time. It does not replace the script with a `_source` reader.
When a script is present, Kibana sets `on_script_error` to `continue`. If the script fails on one alert, that field has no value for the alert and the update continues.
Unique field names across `runtime_fields` and `runtime_mappings` combined cannot exceed 100. Larger maps are rejected.
maxProperties: 100
type: object
status:
enum:
- closed
Expand Down Expand Up @@ -139620,6 +139630,29 @@
$ref: '#/components/schemas/Security_Detections_API_RunScriptOsConfigValues'
required:
- command
Security_Detections_API_RuntimeFieldMapping:
description: A runtime field included in the status-update query so the query can match fields that are not in the alerts index mapping, for example scripted fields on a data view. Elasticsearch evaluates the field at query time.
type: object
properties:
format:
description: Format string for date runtime fields, for example `strict_date_optional_time`.
maxLength: 100
type: string
script:
additionalProperties: false
description: Inline Painless script that Elasticsearch evaluates for each alert. Only `source` is accepted. Stored scripts, parameterized scripts (`params`), and non-default `lang` values are not supported. Extra properties are rejected with a 400 so the script is not run with different semantics.
type: object
properties:
source:
description: Painless script source to execute.
maxLength: 10000
type: string
required:
- source
type:
$ref: '#/components/schemas/Security_Detections_API_RuntimeFieldType'
required:
- type
Security_Detections_API_RuntimeFieldType:
description: The data type for the runtime field type. Determines how the field value is indexed and queried.
enum:
Expand Down Expand Up @@ -140195,6 +140228,16 @@
description: Optional map of field name to runtime field type. For each entry, a runtime field of the specified type is created reading its value from `_source[fieldName]` and included in the query as `runtime_mappings`. Use this to reference fields stored on the alert `_source` that are not part of the Elastic Common Schema (ECS) of the alerts index mapping, for example, custom fields that the rule's source index defined when the alerts were created.
maxProperties: 100
type: object
runtime_mappings:
additionalProperties:
$ref: '#/components/schemas/Security_Detections_API_RuntimeFieldMapping'
description: |-
Use this when the query references fields that are not in the alerts index mapping, for example data view runtime fields with a Painless script.
Kibana sends `type`, `script.source`, and `format` to Elasticsearch as `runtime_mappings` on the status-update query. Unlike `runtime_fields`, Kibana keeps your script and runs it at query time. It does not replace the script with a `_source` reader.
When a script is present, Kibana sets `on_script_error` to `continue`. If the script fails on one alert, that field has no value for the alert and the update continues.
Unique field names across `runtime_fields` and `runtime_mappings` combined cannot exceed 100. Larger maps are rejected.
maxProperties: 100
type: object
status:
$ref: '#/components/schemas/Security_Detections_API_AlertStatusExceptClosed'
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,39 @@ export type RuntimeFieldType = z.infer<typeof RuntimeFieldType>;
export type RuntimeFieldTypeEnum = typeof RuntimeFieldType.enum;
export const RuntimeFieldTypeEnum = RuntimeFieldType.enum;

/**
* A runtime field included in the status-update query so the query can match fields that are not in the alerts index mapping, for example scripted fields on a data view. Elasticsearch evaluates the field at query time.
*/
export const RuntimeFieldMapping = lazySchema(() =>
z.object({
type: RuntimeFieldType,
/**
* Inline Painless script that Elasticsearch evaluates for each alert. Only `source` is accepted. Stored scripts, parameterized scripts (`params`), and non-default `lang` values are not supported. Extra properties are rejected with a 400 so the script is not run with different semantics.
*/
script: z
.object({
/**
* Painless script source to execute.
*/
source: z.string().max(10000).describe('Painless script source to execute.'),
})
.strict()
.optional()
.describe(
'Inline Painless script that Elasticsearch evaluates for each alert. Only `source` is accepted. Stored scripts, parameterized scripts (`params`), and non-default `lang` values are not supported. Extra properties are rejected with a 400 so the script is not run with different semantics.'
),
/**
* Format string for date runtime fields, for example `strict_date_optional_time`.
*/
format: z
.string()
.max(100)
.optional()
.describe('Format string for date runtime fields, for example `strict_date_optional_time`.'),
})
);
export type RuntimeFieldMapping = z.infer<typeof RuntimeFieldMapping>;

export const SetAlertsStatusByIdsBase = lazySchema(() =>
z.object({
/**
Expand Down Expand Up @@ -82,6 +115,19 @@ export const SetAlertsStatusByQueryBase = lazySchema(() =>
.describe(
"Optional map of field name to runtime field type. For each entry, a runtime field of the specified type is created reading its value from `_source[fieldName]` and included in the query as `runtime_mappings`. Use this to reference fields stored on the alert `_source` that are not part of the Elastic Common Schema (ECS) of the alerts index mapping, for example, custom fields that the rule's source index defined when the alerts were created."
),
/**
* Use this when the query references fields that are not in the alerts index mapping, for example data view runtime fields with a Painless script.
Kibana sends `type`, `script.source`, and `format` to Elasticsearch as `runtime_mappings` on the status-update query. Unlike `runtime_fields`, Kibana keeps your script and runs it at query time. It does not replace the script with a `_source` reader.
When a script is present, Kibana sets `on_script_error` to `continue`. If the script fails on one alert, that field has no value for the alert and the update continues.
Unique field names across `runtime_fields` and `runtime_mappings` combined cannot exceed 100. Larger maps are rejected.
*/
runtime_mappings: z
.object({})
.catchall(RuntimeFieldMapping)
.optional()
.describe(
'Use this when the query references fields that are not in the alerts index mapping, for example data view runtime fields with a Painless script.\nKibana sends `type`, `script.source`, and `format` to Elasticsearch as `runtime_mappings` on the status-update query. Unlike `runtime_fields`, Kibana keeps your script and runs it at query time. It does not replace the script with a `_source` reader.\nWhen a script is present, Kibana sets `on_script_error` to `continue`. If the script fails on one alert, that field has no value for the alert and the update continues.\nUnique field names across `runtime_fields` and `runtime_mappings` combined cannot exceed 100. Larger maps are rejected.'
),
})
);
export type SetAlertsStatusByQueryBase = z.infer<typeof SetAlertsStatusByQueryBase>;
Expand All @@ -102,6 +148,19 @@ export const CloseAlertsByQuery = lazySchema(() =>
.describe(
"Optional map of field name to runtime field type. For each entry, the server defines a runtime field of the given type that reads its value from `_source[fieldName]` and attaches it to the underlying `_update_by_query` as `runtime_mappings`. Allows the `query` to reference non-ECS fields stored on the alert `_source` but not in the alerts index mapping — for example, runtime fields the rule's source index defined at the time the alerts were created. Limited to 100 entries per request; larger maps are rejected."
),
/**
* Use this when the query references fields that are not in the alerts index mapping, for example data view runtime fields with a Painless script.
Kibana sends `type`, `script.source`, and `format` to Elasticsearch as `runtime_mappings` on the status-update query. Unlike `runtime_fields`, Kibana keeps your script and runs it at query time. It does not replace the script with a `_source` reader.
When a script is present, Kibana sets `on_script_error` to `continue`. If the script fails on one alert, that field has no value for the alert and the update continues.
Unique field names across `runtime_fields` and `runtime_mappings` combined cannot exceed 100. Larger maps are rejected.
*/
runtime_mappings: z
.object({})
.catchall(RuntimeFieldMapping)
.optional()
.describe(
'Use this when the query references fields that are not in the alerts index mapping, for example data view runtime fields with a Painless script.\nKibana sends `type`, `script.source`, and `format` to Elasticsearch as `runtime_mappings` on the status-update query. Unlike `runtime_fields`, Kibana keeps your script and runs it at query time. It does not replace the script with a `_source` reader.\nWhen a script is present, Kibana sets `on_script_error` to `continue`. If the script fails on one alert, that field has no value for the alert and the update continues.\nUnique field names across `runtime_fields` and `runtime_mappings` combined cannot exceed 100. Larger maps are rejected.'
),
})
);
export type CloseAlertsByQuery = z.infer<typeof CloseAlertsByQuery>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,39 @@ components:
- geo_point
description: >-
The data type for the runtime field type. Determines how the field value is indexed and queried.

RuntimeFieldMapping:
type: object
description: >-
A runtime field included in the status-update query so the query
can match fields that are not in the alerts index mapping, for
example scripted fields on a data view. Elasticsearch evaluates
the field at query time.
required: [type]
properties:
type:
$ref: '#/components/schemas/RuntimeFieldType'
script:
type: object
additionalProperties: false
description: >-
Inline Painless script that Elasticsearch evaluates for each alert.
Only `source` is accepted. Stored scripts, parameterized scripts
(`params`), and non-default `lang` values are not supported. Extra
properties are rejected with a 400 so the script is not run with
different semantics.
required: [source]
properties:
source:
type: string
description: Painless script source to execute.
maxLength: 10000
format:
type: string
description: >-
Format string for date runtime fields, for example
`strict_date_optional_time`.
maxLength: 100
SetAlertsStatusByIdsBase:
type: object
properties:
Expand Down Expand Up @@ -221,6 +254,27 @@ components:
the query as `runtime_mappings`. Use this to reference fields stored on the
alert `_source` that are not part of the Elastic Common Schema (ECS) of the alerts index mapping,
for example, custom fields that the rule's source index defined when the alerts were created.
runtime_mappings:
type: object
maxProperties: 100
additionalProperties:
$ref: '#/components/schemas/RuntimeFieldMapping'
description: >-
Use this when the query references fields that are not in the
alerts index mapping, for example data view runtime fields with
a Painless script.

Kibana sends `type`, `script.source`, and `format` to Elasticsearch
as `runtime_mappings` on the status-update query. Unlike
`runtime_fields`, Kibana keeps your script and runs it at query
time. It does not replace the script with a `_source` reader.

When a script is present, Kibana sets `on_script_error` to
`continue`. If the script fails on one alert, that field has no
value for the alert and the update continues.

Unique field names across `runtime_fields` and `runtime_mappings`
combined cannot exceed 100. Larger maps are rejected.
required: [query, status]

CloseAlertsByQuery:
Expand Down Expand Up @@ -255,6 +309,27 @@ components:
example, runtime fields the rule's source index defined at the
time the alerts were created. Limited to 100 entries per
request; larger maps are rejected.
runtime_mappings:
type: object
maxProperties: 100
additionalProperties:
$ref: '#/components/schemas/RuntimeFieldMapping'
description: >-
Use this when the query references fields that are not in the
alerts index mapping, for example data view runtime fields with
a Painless script.

Kibana sends `type`, `script.source`, and `format` to Elasticsearch
as `runtime_mappings` on the status-update query. Unlike
`runtime_fields`, Kibana keeps your script and runs it at query
time. It does not replace the script with a `_source` reader.

When a script is present, Kibana sets `on_script_error` to
`continue`. If the script fails on one alert, that field has no
value for the alert and the update continues.

Unique field names across `runtime_fields` and `runtime_mappings`
combined cannot exceed 100. Larger maps are rejected.
required: [query, status]

SetAlertsStatusByQuery:
Expand Down
Loading
Loading