Prevent passing a pipeline to a logs stream index request#137992
Prevent passing a pipeline to a logs stream index request#137992masseyke merged 3 commits intoelastic:mainfrom
Conversation
|
Hi @masseyke, I've created a changelog YAML for you. |
|
Pinging @elastic/es-data-management (Team:Data Management) |
There was a problem hiding this comment.
Pull Request Overview
This PR prevents users from accidentally providing a pipeline parameter when indexing documents to a logs stream, as pipelines should not be specified in this context.
Key Changes:
- Adds validation to reject index requests with pipelines when writing to log streams
- Includes test coverage to verify the new validation behavior
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
server/src/main/java/org/elasticsearch/action/bulk/TransportAbstractBulkAction.java |
Adds validation logic to reject pipeline parameters in log stream index requests |
modules/streams/src/yamlRestTest/resources/rest-api-spec/test/streams/logs/40_index_request_restrictions.yml |
Adds test case verifying pipeline rejection behavior |
docs/changelog/137992.yaml |
Documents the bug fix in the changelog |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ); | ||
| } | ||
|
|
||
| if (e == null && streamType.getStreamName().equals(ir.index()) && ir.getPipeline() != null) { |
There was a problem hiding this comment.
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.
| if (e == null && streamType.getStreamName().equals(ir.index()) && ir.getPipeline() != null) { | |
| if (e == null && ir.getPipeline() != null) { |
There was a problem hiding this comment.
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.
lukewhiting
left a comment
There was a problem hiding this comment.
One absolutely microscopic wording change suggestion to the change log but not going to block for that. It all looks solid to me! 👍🏻
Co-authored-by: Luke Whiting <luke.whiting@elastic.co>
💚 Backport successful
|
Fixes #242994 With elastic/elasticsearch#137992, the approach we used to do field simulation for wired streams doesn't work anymore. This PR fixes this by switching to a similar strategy we use for the processing simulation: Overwrite the root logs pipeline to reroute the doc, then overwrite the current stream pipeline with a noop. For classic streams we keep the existing behavior.
Fixes elastic#242994 With elastic/elasticsearch#137992, the approach we used to do field simulation for wired streams doesn't work anymore. This PR fixes this by switching to a similar strategy we use for the processing simulation: Overwrite the root logs pipeline to reroute the doc, then overwrite the current stream pipeline with a noop. For classic streams we keep the existing behavior. (cherry picked from commit 1555156)
Fixes elastic#242994 With elastic/elasticsearch#137992, the approach we used to do field simulation for wired streams doesn't work anymore. This PR fixes this by switching to a similar strategy we use for the processing simulation: Overwrite the root logs pipeline to reroute the doc, then overwrite the current stream pipeline with a noop. For classic streams we keep the existing behavior. (cherry picked from commit 1555156)
# Backport This will backport the following commits from `main` to `9.2`: - [🌊 Streams: Fix field simulation (#243065)](#243065) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Joe Reuter","email":"johannes.reuter@elastic.co"},"sourceCommit":{"committedDate":"2025-11-14T16:59:47Z","message":"🌊 Streams: Fix field simulation (#243065)\n\nFixes https://github.com/elastic/kibana/issues/242994\n\nWith elastic/elasticsearch#137992, the approach\nwe used to do field simulation for wired streams doesn't work anymore.\nThis PR fixes this by switching to a similar strategy we use for the\nprocessing simulation: Overwrite the root logs pipeline to reroute the\ndoc, then overwrite the current stream pipeline with a noop.\n\nFor classic streams we keep the existing behavior.","sha":"155515607bdfb2cfb4168b07d26d01a3371acada","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:obs-onboarding","backport:version","Feature:Streams","v9.3.0","v9.2.2"],"title":"🌊 Streams: Fix field simulation","number":243065,"url":"https://github.com/elastic/kibana/pull/243065","mergeCommit":{"message":"🌊 Streams: Fix field simulation (#243065)\n\nFixes https://github.com/elastic/kibana/issues/242994\n\nWith elastic/elasticsearch#137992, the approach\nwe used to do field simulation for wired streams doesn't work anymore.\nThis PR fixes this by switching to a similar strategy we use for the\nprocessing simulation: Overwrite the root logs pipeline to reroute the\ndoc, then overwrite the current stream pipeline with a noop.\n\nFor classic streams we keep the existing behavior.","sha":"155515607bdfb2cfb4168b07d26d01a3371acada"}},"sourceBranch":"main","suggestedTargetBranches":["9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/243065","number":243065,"mergeCommit":{"message":"🌊 Streams: Fix field simulation (#243065)\n\nFixes https://github.com/elastic/kibana/issues/242994\n\nWith elastic/elasticsearch#137992, the approach\nwe used to do field simulation for wired streams doesn't work anymore.\nThis PR fixes this by switching to a similar strategy we use for the\nprocessing simulation: Overwrite the root logs pipeline to reroute the\ndoc, then overwrite the current stream pipeline with a noop.\n\nFor classic streams we keep the existing behavior.","sha":"155515607bdfb2cfb4168b07d26d01a3371acada"}},{"branch":"9.2","label":"v9.2.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Joe Reuter <johannes.reuter@elastic.co>
Fixes elastic#242994 With elastic/elasticsearch#137992, the approach we used to do field simulation for wired streams doesn't work anymore. This PR fixes this by switching to a similar strategy we use for the processing simulation: Overwrite the root logs pipeline to reroute the doc, then overwrite the current stream pipeline with a noop. For classic streams we keep the existing behavior.
This prevents a user from accidentally passing a pipeline in an index request item to the logs stream.