[MDEV-13398] Can't distinguish between DROP DATABASE and DROP TABLE permissions on a database Created: 2017-07-28 Updated: 2023-04-27 |
|
| Status: | Confirmed |
| Project: | MariaDB Server |
| Component/s: | Authentication and Privilege System |
| Affects Version/s: | 5.5, 10.0, 10.1.25, 10.2.6, 10.3 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Trivial |
| Reporter: | Hartmut Holzgraefe | Assignee: | Sergei Golubchik |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | upstream | ||
| Issue Links: |
|
||||||||
| Description |
|
Feature request: GRANT DROP ON TABLE db_name.* does not only give a user the privilege to drop any table within the database db_name, but also the database itself. There is no way to just give permission to drop any table, but not the database itself. Not sure how to actually solve this in a backwards compatible way, adding an extra ON DATABASE object_type wouldn't really work out as this would require to change the current behavior of ON TABLE. Maybe an extra DROP_TABLE privilege would work out best. So GRANT DROP ON TABLE db_name.* would give DROP permissions on both tables within the database and the database itself, while GRANT DROP_TABLE ON TABLE db_name.* would only allow to drop tables, but not the database itself. When specifying an explicit table level grant GRANT DROP_TABLE ON TABLE db_name.tab_name on the other hand DROP and DROP_TABLE would be synonyms for the same privilege. |
| Comments |
| Comment by Elena Stepanova [ 2017-08-09 ] | |||||||||||||||||
|
I think the fact that GRANT DROP ON TABLE db_name.* is accepted at all is actually an upstream bug. It's not documented (in MySQL manual), and it's not consistent with other GRANT commands where object_type clause is present. The manual says:
So, it does not assume wild cards. Other variants of such GRANTs, indeed, don't allow wild cards:
For DROP ON TABLE, while it is accepted, the TABLE clause is simply ignored.
So, since it has never really been a documented behavior, maybe it's not such a disaster to break compatibility and fix it any way we want. I'll leave it to serg to decide what's best here, and change the fix version accordingly. | |||||||||||||||||
| Comment by Nick Bolton [ 2017-09-07 ] | |||||||||||||||||
|
Note: DROP Drop_priv Also - why would a user not be given a DROP grant on a new table or view they create? Drop sequence / function / procedure / table / index etc. all seem to work in inconsistent ways from each other r.e. what permissiodn gives the DROP right. | |||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2017-09-07 ] | |||||||||||||||||
|
"Also - why would a user not be given a DROP grant on a new table or view they create?" We don't know the creator / owner of a table ... but that's a completely different story | |||||||||||||||||
| Comment by Nick Bolton [ 2017-09-07 ] | |||||||||||||||||
|
Rather than creator - I should have said "schema owner"... |