-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ES-11331 streams params restriction #132967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lukewhiting
merged 18 commits into
elastic:main
from
lukewhiting:es-11331-streams-params-restriction
Sep 1, 2025
Merged
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2f0dd61
Add support for passing down if restricted params are used
lukewhiting 2925412
Add restricted param check to single doc endpoint
lukewhiting 09a1372
Fixup YAML test
lukewhiting 33225ed
Add YAML tests for new function
lukewhiting e4fbe38
Switch to more descriptive catch check
lukewhiting 960097e
Additional tests and fixes for those tests
lukewhiting 2429ec0
Update docs/changelog/132967.yaml
lukewhiting 1aed1f6
Apply suggestions from code review
lukewhiting 6aecacc
Move check lower down the stack and preserve param names for better e…
lukewhiting 44b1a67
Merge remote-tracking branch 'origin/es-11331-streams-params-restrict…
lukewhiting 01ffed6
Fix NPE due to missing params set during serialization
lukewhiting 6d5fa51
Merge branch 'main' of github.com:elastic/elasticsearch into es-11331…
lukewhiting cdc4829
Add additional allowed params following product feedback
lukewhiting 2642075
Merge branch 'main' of github.com:elastic/elasticsearch into es-11331…
lukewhiting a98f1ea
Merge branch 'main' of github.com:elastic/elasticsearch into es-11331…
lukewhiting 1174387
Merge branch 'main' into es-11331-streams-params-restriction
masseyke 1803656
Merge branch 'main' of github.com:elastic/elasticsearch into es-11331…
lukewhiting 08b088a
Merge branch 'main' of github.com:elastic/elasticsearch into es-11331…
lukewhiting File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pr: 132967 | ||
| summary: ES-11331 streams params restriction | ||
| area: Data streams | ||
| type: enhancement | ||
| issues: [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
175 changes: 175 additions & 0 deletions
175
...eams/src/yamlRestTest/resources/rest-api-spec/test/streams/logs/30_param_restrictions.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,175 @@ | ||
| --- | ||
| teardown: | ||
| - do: | ||
| streams.logs_disable: { } | ||
|
|
||
| --- | ||
| "Check User Can't Use Restricted Params On Logs Endpoint": | ||
| - do: | ||
| streams.logs_enable: { } | ||
| - is_true: acknowledged | ||
|
|
||
| - do: | ||
| streams.status: { } | ||
| - is_true: logs.enabled | ||
|
|
||
| - do: | ||
| bulk: | ||
| refresh: true | ||
| body: | | ||
| { "index": { "_index": "logs"} } | ||
| { "foo": "bar" } | ||
| { "index": { "_index": "not-logs" } } | ||
| { "foo": "bar" } | ||
| - match: { errors: true } | ||
| - match: { items.0.index.status: 400 } | ||
| - match: { items.0.index.error.type: "illegal_argument_exception" } | ||
| - match: { items.0.index.error.reason: "When writing to a stream, only the following parameters are allowed: [index,op_type,error_trace,timeout]" } | ||
| - match: { items.1.index.status: 201 } | ||
|
|
||
| --- | ||
| "Check User Can't Use Restricted Params On Logs Endpoint - Single Doc": | ||
| - do: | ||
| streams.logs_enable: { } | ||
| - is_true: acknowledged | ||
|
|
||
| - do: | ||
| streams.status: { } | ||
| - is_true: logs.enabled | ||
|
|
||
| - do: | ||
| index: | ||
| refresh: true | ||
| index: logs | ||
| body: { "foo": "bar" } | ||
| catch: '/When writing to a stream, only the following parameters are allowed: \[index,op_type,error_trace,timeout\]/' | ||
|
|
||
| --- | ||
| "Allowed Params Only - Bulk Should Succeed": | ||
| - do: | ||
| streams.logs_enable: { } | ||
| - is_true: acknowledged | ||
|
|
||
| - do: | ||
| bulk: | ||
| error_trace: true | ||
| timeout: "1m" | ||
| body: | | ||
| { "index": { "_index": "logs"} } | ||
| { "foo": "bar" } | ||
| - match: { errors: false } | ||
| - match: { items.0.index.status: 201 } | ||
|
|
||
| --- | ||
| "Allowed Params Only - Single Doc Should Succeed": | ||
| - do: | ||
| streams.logs_enable: { } | ||
| - is_true: acknowledged | ||
|
|
||
| - do: | ||
| index: | ||
| index: logs | ||
| error_trace: true | ||
| timeout: "1m" | ||
| body: | | ||
| { "foo": "bar" } | ||
| - match: { _index: "logs" } | ||
| - match: { result: "created" } | ||
|
|
||
| --- | ||
| "No Params - Bulk Should Succeed": | ||
| - do: | ||
| streams.logs_enable: { } | ||
| - is_true: acknowledged | ||
|
|
||
| - do: | ||
| bulk: | ||
| body: | | ||
| { "index": { "_index": "logs"} } | ||
| { "foo": "bar" } | ||
| - match: { errors: false } | ||
| - match: { items.0.index.status: 201 } | ||
|
|
||
| --- | ||
| "No Params - Single Doc Should Succeed": | ||
| - do: | ||
| streams.logs_enable: { } | ||
| - is_true: acknowledged | ||
| - | ||
| do: | ||
| index: | ||
| index: logs | ||
| body: { "foo": "bar" } | ||
| - match: { _index: "logs" } | ||
| - match: { result: "created" } | ||
|
|
||
| --- | ||
| "Mixed Allowed and Disallowed Params - Bulk Should Fail": | ||
| - do: | ||
| streams.logs_enable: { } | ||
| - is_true: acknowledged | ||
|
|
||
| - do: | ||
| bulk: | ||
| error_trace: true | ||
| timeout: "1m" | ||
| routing: "custom-routing" | ||
| refresh: true | ||
| body: | | ||
| { "index": { "_index": "logs"} } | ||
| { "foo": "bar" } | ||
| - match: { errors: true } | ||
| - match: { items.0.index.status: 400 } | ||
| - match: { items.0.index.error.type: "illegal_argument_exception" } | ||
| - match: { items.0.index.error.reason: "When writing to a stream, only the following parameters are allowed: [index,op_type,error_trace,timeout]" } | ||
|
|
||
| --- | ||
| "Mixed Allowed and Disallowed Params - Single Doc Should Fail": | ||
| - do: | ||
| streams.logs_enable: { } | ||
| - is_true: acknowledged | ||
|
|
||
| - do: | ||
| index: | ||
| index: logs | ||
| error_trace: true | ||
| timeout: "1m" | ||
| routing: "custom-routing" | ||
| refresh: true | ||
| body: { "foo": "bar" } | ||
| catch: '/When writing to a stream, only the following parameters are allowed: \[index,op_type,error_trace,timeout\]/' | ||
|
|
||
| --- | ||
| "Multiple Disallowed Params - Bulk Should Fail": | ||
| - do: | ||
| streams.logs_enable: { } | ||
| - is_true: acknowledged | ||
|
|
||
| - do: | ||
| bulk: | ||
| routing: "custom-routing" | ||
| wait_for_active_shards: "2" | ||
| refresh: true | ||
| body: | | ||
| { "index": { "_index": "logs"} } | ||
| { "foo": "bar" } | ||
| - match: { errors: true } | ||
| - match: { items.0.index.status: 400 } | ||
| - match: { items.0.index.error.type: "illegal_argument_exception" } | ||
| - match: { items.0.index.error.reason: "When writing to a stream, only the following parameters are allowed: [index,op_type,error_trace,timeout]" } | ||
|
|
||
| --- | ||
| "Multiple Disallowed Params - Single Doc Should Fail": | ||
| - do: | ||
| streams.logs_enable: { } | ||
| - is_true: acknowledged | ||
|
|
||
| - do: | ||
| index: | ||
| index: logs | ||
| routing: "custom-routing" | ||
| pipeline: "my-pipeline" | ||
| wait_for_active_shards: "2" | ||
| refresh: true | ||
| body: { "foo": "bar" } | ||
| catch: '/When writing to a stream, only the following parameters are allowed: \[index,op_type,error_trace,timeout\]/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.