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

Consider regex validation of plugin names #789

Closed
jthegedus opened this issue Aug 24, 2020 · 4 comments · Fixed by #1010
Closed

Consider regex validation of plugin names #789

jthegedus opened this issue Aug 24, 2020 · 4 comments · Fixed by #1010
Milestone

Comments

@jthegedus
Copy link
Contributor

jthegedus commented Aug 24, 2020

Is your feature request related to a problem? Please describe.
Currently we allow users to specify anything as a plugin name. We should probably validate plugin names against an allowed list of characters, as in the future with tabular output the parsing may be effected by POSIX character classes appearing within plugin names.

  • asdf plugin add nodejs : is valid
  • asdf plugin add 🚀🍾🎉 : is invalid

Describe the solution you'd like
Simple regex validation of plugin name in lib/commands/command-plugin-add.bash

Additional context
[:space:] is probably already one character we should not allow

@danhper
Copy link
Member

danhper commented Aug 26, 2020

I agree this would be a good idea. I think pretty much any printable character except from spaces should be ok. Or should we stick with ascii?

@jthegedus
Copy link
Contributor Author

I think pretty much any printable character except from spaces should be ok. Or should we stick with ascii?

I had the same thoughts. People will try using unicode and emojis 😆

ASCII is the safe bet IMO, especially when considering the environments asdf would be run in

@danhper
Copy link
Member

danhper commented Aug 28, 2020

Agreed, as much as I like emojis, asdf-:rocket::champagne::tada: is probably not a great plugin name :joy:
So I guess the regexp would be something along the lines of asdf-[a-zA-Z0-9-] ?
Do we want to allow ., _, $ or other symbols. I kind of feel dashes are enough and we currently don't have any plugin using such symbols.

@jthegedus
Copy link
Contributor Author

jthegedus commented Aug 28, 2020

I've no idea of what downstream effects specific chars like $ or . could have in the codebase, but [a-zA-Z0-9-] is plenty IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants