Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions docs/changelog/137992.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 137992
summary: Prevent passing a pipeline to a logs stream bulk index request body
area: Data streams
type: bug
issues: []
Original file line number Diff line number Diff line change
@@ -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" }
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,16 @@ private void doStreamsChecks(
+ "] stream instead"
);
}

if (e == null && streamType.getStreamName().equals(ir.index()) && ir.getPipeline() != null) {
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

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

The condition streamType.getStreamName().equals(ir.index()) is redundant here. At line 479, we already know that req.index().equals(streamType.getStreamName()) from earlier context, and ir.index() should match req.index() for the same request. Consider simplifying the condition to just check ir.getPipeline() != null.

Suggested change
if (e == null && streamType.getStreamName().equals(ir.index()) && ir.getPipeline() != null) {
if (e == null && ir.getPipeline() != null) {

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

I mean technically yes... You could combine it with the check above I guess to save a couple of cycles but it's also absolutely fine as it is. Your call.

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: ["
Expand Down