SpongePowered / Ore

Repository software for Sponge plugins and Forge mods
https://ore.spongepowered.org/
MIT License
75 stars 25 forks source link

Project name regex #27

Closed windy1 closed 8 years ago

windy1 commented 8 years ago

We need to come up with a regular expression for allowed project / channel / version names. Currently anything is permitted.

kashike commented 8 years ago

Related: https://github.com/SpongePowered/Ore/issues/9

kashike commented 8 years ago

I don't think there should really be a limitation on project/channel/version names - just slugify them for use in urls if there are any weird characters.

windy1 commented 8 years ago

Ehh I honestly think we should disallow ~!@#$%^&*()/?.>,<'";:]}[{\|+= at the very least. They don't really belong in names and are generally unappealing. A min/max size needs to be decided on as well.

kashike commented 8 years ago

I don't see a reason to disallow all of those, it limits names quite a bit.

Tzky commented 8 years ago

I'd only allow A-Z, a-z and 0-9 and maybe some chars from above + whitespace. I can't think of any good reason to allow for ex. @, or other similar chars.

@@@@@ SuperAwesomePlugin@@@@@ or $$$ Economy $$$ <- no one wants those plugins or plugin names.

kashike commented 8 years ago

a-zA-Z0-9-:!?. | is what I'd suggest. It restricts things, but not too much.

A filter could be written to disallow things like:

ryantheleach commented 8 years ago

Or just remove things that are potentially malicious, and let the community sort it out?

If you are going to restrict it in addition to Kashikes suggestions Allow & + - @ # ( ) [ ] , { }

Would allow stuff like "Trouble & Turmoil" "Ban++" "Minecraft@home" "Fast-Shop" "F# Noteblock Songs" "GriefPrevention (MinecraftPortCentral)" "[FoxGuard] Heal Regions"

But ultimately I don't believe we should attempt to create validation rules for anything that doesn't directly cause conflict.

windy1 commented 8 years ago

For now I decided not to limit characters allowed in project names. Names must be <= 25 chars and automatically has extra white space removed

e.g.

"    My     Cool       Plugin     " -> "My Cool Plugin"