-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Properly handle wildcards in data stream deletion requests #78463
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
Properly handle wildcards in data stream deletion requests #78463
Conversation
| } | ||
| request.indices(names.toArray(Strings.EMPTY_ARRAY)); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that it's useful to duplicate the name resolution and system index validation logic in masterOperation and below in removeDataStream but the overwriting of the request's indices is the most narrow root cause of this bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine to double-check the validation so that we avoid the cluster state task if possible, so this seems reasonable to me.
|
Manually pinging @elastic/es-data-management (Team:Data Management) since GH's webhooks are 🤷 |
dakrone
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, though could you please fill out the PR body with an explanation of what happened and how this fixes it for the sake of future Github searchability?
| } | ||
| request.indices(names.toArray(Strings.EMPTY_ARRAY)); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine to double-check the validation so that we avoid the cluster state task if possible, so this seems reasonable to me.
|
Thanks, @dakrone. |
The root cause of this bug was the replacement of the wildcard expression in the request's
indicesmember with the actual data streams that expression matched. In the case that the authz code had already replaced it with the*,-*token that means "no authorized data streams", the expression would be evaluated again, would match no data streams, and would set theindicesmember to an empty array. An empty array is equivalent to*, so all data streams would then be deleted.Fixes #78422