From 3133e82b7e1c6ebf28f722b22b027656f8e89d22 Mon Sep 17 00:00:00 2001 From: Keith Massey Date: Wed, 12 Nov 2025 17:19:07 -0600 Subject: [PATCH 1/3] Prevent passing a pipeline to a logs stream index request --- .../logs/40_index_request_restrictions.yml | 25 +++++++++++++++++++ .../bulk/TransportAbstractBulkAction.java | 11 +++++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 modules/streams/src/yamlRestTest/resources/rest-api-spec/test/streams/logs/40_index_request_restrictions.yml diff --git a/modules/streams/src/yamlRestTest/resources/rest-api-spec/test/streams/logs/40_index_request_restrictions.yml b/modules/streams/src/yamlRestTest/resources/rest-api-spec/test/streams/logs/40_index_request_restrictions.yml new file mode 100644 index 0000000000000..2df4311c1b37b --- /dev/null +++ b/modules/streams/src/yamlRestTest/resources/rest-api-spec/test/streams/logs/40_index_request_restrictions.yml @@ -0,0 +1,25 @@ +--- +teardown: + - do: + streams.logs_disable: { } + +--- +"Check User Can't Provide Pipeline to Logs Stream": + - do: + streams.logs_enable: { } + - is_true: acknowledged + + - do: + streams.status: { } + - is_true: logs.enabled + + - do: + bulk: + index: logs + body: | + { "create": {"pipeline": "noop"}} + { "message": "hello streams!"} + - match: { errors: true } + - match: { items.0.create.status: 400 } + - match: { items.0.create.error.type: "illegal_argument_exception" } + - match: { items.0.create.error.reason: "Cannot provide a pipeline when writing to a stream however the [noop] pipeline was provided when writing to the [logs] stream" } diff --git a/server/src/main/java/org/elasticsearch/action/bulk/TransportAbstractBulkAction.java b/server/src/main/java/org/elasticsearch/action/bulk/TransportAbstractBulkAction.java index c1b1cbf01741a..41da0aec941b9 100644 --- a/server/src/main/java/org/elasticsearch/action/bulk/TransportAbstractBulkAction.java +++ b/server/src/main/java/org/elasticsearch/action/bulk/TransportAbstractBulkAction.java @@ -476,7 +476,16 @@ private void doStreamsChecks( + "] stream instead" ); } - + if (e == null && streamType.getStreamName().equals(ir.index()) && ir.getPipeline() != null) { + e = new IllegalArgumentException( + "Cannot provide a pipeline when writing to a stream " + + "however the [" + + ir.getPipeline() + + "] pipeline was provided when writing to the [" + + streamType.getStreamName() + + "] stream" + ); + } if (e == null && streamsRestrictedParamsUsed(bulkRequest) && req.index().equals(streamType.getStreamName())) { e = new IllegalArgumentException( "When writing to a stream, only the following parameters are allowed: [" From 3e083677727450c26b15bff793ed5a540286589c Mon Sep 17 00:00:00 2001 From: Keith Massey Date: Wed, 12 Nov 2025 17:21:47 -0600 Subject: [PATCH 2/3] Update docs/changelog/137992.yaml --- docs/changelog/137992.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docs/changelog/137992.yaml diff --git a/docs/changelog/137992.yaml b/docs/changelog/137992.yaml new file mode 100644 index 0000000000000..2e1d619bfd475 --- /dev/null +++ b/docs/changelog/137992.yaml @@ -0,0 +1,5 @@ +pr: 137992 +summary: Prevent passing a pipeline to a logs stream index request +area: Data streams +type: bug +issues: [] From 90a6c87cead71904de97ca2bf0ada364aa5ea94b Mon Sep 17 00:00:00 2001 From: Keith Massey Date: Thu, 13 Nov 2025 09:05:53 -0600 Subject: [PATCH 3/3] Update docs/changelog/137992.yaml Co-authored-by: Luke Whiting --- docs/changelog/137992.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog/137992.yaml b/docs/changelog/137992.yaml index 2e1d619bfd475..f23e7e9d1efe3 100644 --- a/docs/changelog/137992.yaml +++ b/docs/changelog/137992.yaml @@ -1,5 +1,5 @@ pr: 137992 -summary: Prevent passing a pipeline to a logs stream index request +summary: Prevent passing a pipeline to a logs stream bulk index request body area: Data streams type: bug issues: []