Skip to content
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

Whitelist allowed chars in index template creation #25645

Closed
spinscale opened this issue Jul 11, 2017 · 4 comments
Closed

Whitelist allowed chars in index template creation #25645

spinscale opened this issue Jul 11, 2017 · 4 comments
Labels
:Data Management/Indices APIs APIs to create and manage indices and templates help wanted adoptme Team:Data Management Meta label for data/management team

Comments

@spinscale
Copy link
Contributor

Currently (on 5.5.0) one can create arbitrary index template names, also *.

PUT _template/*
{
  "template": "index*"
}

The problem however is, that by using Regex.simpleMatch when determining template names, we always assume, that * is a regex character and thus the above template can be deleted, but also deletes all other templates.

Might make sense to create a whitelist of allowed characters for index template names, i.e. [a-z0-9-_] or something.

@dakrone
Copy link
Member

dakrone commented Jul 11, 2017

I think we could just re-use this static method: https://github.com/elastic/elasticsearch/blob/master/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java#L161-L184

@ismael-hasan
Copy link
Contributor

Would it be possible (and would it make sense) to include a mechanism to delete templates that were already created containing *? Something like a ?useWildcard=false parameter to add to the delete requests

@danielmitterdorfer danielmitterdorfer added help wanted adoptme and removed discuss labels Aug 4, 2017
@danielmitterdorfer
Copy link
Member

We've discussed this in Fix-It Friday and agree that index, alias and index-template naming rules should be aligned.

We think it does not make sense to complicate the implementation with additional request parameters (like the suggested useWildcard). A workaround to remove such templates is to GET all existing ones, DELETE all of them and create all again with valid names.

@clintongormley clintongormley added :Data Management/Indices APIs APIs to create and manage indices and templates and removed :Index Templates labels Feb 13, 2018
@rjernst rjernst added the Team:Data Management Meta label for data/management team label May 4, 2020
@dakrone
Copy link
Member

dakrone commented Nov 6, 2020

Closing this as we have this validation, it was added in #56170

@dakrone dakrone closed this as completed Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Indices APIs APIs to create and manage indices and templates help wanted adoptme Team:Data Management Meta label for data/management team
Projects
None yet
Development

No branches or pull requests

6 participants