stefanpejcic / OpenPanel

A highly customizable web hosting control panel built with Docker 🐳
https://openpanel.com
216 stars 33 forks source link

Restrict creating databases with dot in the name #267

Closed caesarmind closed 1 week ago

caesarmind commented 2 weeks ago

OpenPanel version(s) affected

0.3.4

What OS are you using?

Ubuntu

Description

just create database with "." in the name

How to reproduce

..............

Possible Solution

No response

Additional Context

No response

stefanpejcic commented 2 weeks ago

Nice suggestion!

Good practice is to use underscores instead of dots.

I've personally never used dots in MySQL database names, but logically, I think it would only create issues with bad 3rd party code as the names will have to be escaped, because mysql operations use . for colums (e.g., somedb.tablename).

So for me this seems like a lot of unnecessary work for something that's purely decorative. 🤷


But since we already have plans to add an option next year allowing admins to set whether the username_ prefix is required for user databases and usernames, this can easily be fitted then. I'll add it to the to-do list for some 0.5+ update. 👍

caesarmind commented 2 weeks ago

@stefanpejcic my team member wasted whole night because of that. He used . in database name which was causing issue of SHOPWARE CMS.

so, yeah... that's why this is here..

stefanpejcic commented 2 weeks ago

you have a database with a . in the name, and it's causing issues with that specific CMS?

If that's the case, I'm not sure how it's related to the panel. Better report it to the CMS developers so they can escape the database name in the queries.

caesarmind commented 2 weeks ago

well, it didn't have any issues when it was working on cPanel, but somewhy it had issues on openapanel.

stefanpejcic commented 2 weeks ago

If the account was imported from a cPanel backup, its name may contain a .. However, all actions related to that database, such as assigning/removing users through the interface and accessing phpMyAdmin, will continue to work without any issues even when dot is in db name.

Since the UI already restricts creating databases with dot in the name, could you clarify what you're exactly looking to achieve? Are you actually asking to permit a . in the name when creating database through the GUI?

caesarmind commented 2 weeks ago

I had site on cPanel worked fine. Migrated on OP manually and didn't work.

cPanel had database name with dot in it. till I didn't remove dot in database name on Openpanel it didn't start workin.

UI doesn't restricts creating database with dot btw... if it was restricting it, we wouldn't have suffered ...

stefanpejcic commented 1 week ago

I dont understand what is not working? What do you want achieved?

The info you gave is:

just create database with "." in the name

I did that.

It works from the database_wzard, and is not permitted in create_db modal.

No errors in either of those steps, and all later actions from the panel are working regardles of dot in DB name: assign/remove user, use phpmyadmin, delete database.