[MDEV-5215] Granted to PUBLIC Created: 2013-10-30 Updated: 2023-08-07 Resolved: 2022-11-02 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Authentication and Privilege System |
| Fix Version/s: | 10.11.1 |
| Type: | Task | Priority: | Critical |
| Reporter: | Sergei Golubchik | Assignee: | Oleksandr Byelkin |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | Compatibility, Preview_10.11, gsoc21 | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||
| Description |
|
Implement the standard behavior for
Also, this statement is supposed to work:
And these should not
Note that
should not list roles and privileges granted to PUBLIC (unless granted to xxx too), but
should, arguably, list them. |
| Comments |
| Comment by Max Mether [ 2020-08-04 ] | |||||||||||||||||
|
What privileges would be needed to issue such a GRANT? | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2020-09-29 ] | |||||||||||||||||
|
It is how we match user to privileges (so: no new privileges). But probably new special user which will represent PUBLIC (need to find something impossible to create, on the other hand we shoud prohobit user "public" so maybe use it with impossible host name) | |||||||||||||||||
| Comment by Sergei Golubchik [ 2020-09-29 ] | |||||||||||||||||
|
PUBLIC is a special role-like name. No valid role can have a name PUBLIC or NONE. See is_invalid_role_name() So basically this can be implemented as a new entry in the mysql.global_priv table, a role with the name "PUBLIC". You'll know that no user could create it explicitly, you'll have to create it automatically on the first GRANT TO PUBLIC | |||||||||||||||||
| Comment by Max Mether [ 2020-09-29 ] | |||||||||||||||||
|
Wouldn't it then make sense to always have that role in the mysql.global_priv_table? It just wouldn't have any privileges until some are explicitly granted. Since you can't drop the role it seems weird that it only appears on the first GRANT and then can never be removed. | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2020-09-29 ] | |||||||||||||||||
|
I'd also had it permanently (updated during upgrade). I am not sure also if it will bother some clients which do not like something new in privileges (but it will not be present in mysql.user so probably it is OK | |||||||||||||||||
| Comment by Sergei Golubchik [ 2020-09-29 ] | |||||||||||||||||
|
I mean, one can always do DELETE and remove it manually. So if it does not exist, it should not be an error, but it should be automatically and transparently added. But DROP ROLE PUBLIC should be an error, because it is not a role. And any list of roles should not include it either, I_S.APPLICABLE_ROLES should not (I think, but better to check the standard), etc. | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2022-06-20 ] | |||||||||||||||||
|
bb-10.10-
sporadically repeatable in test suite run, can not repeat as single test. Repeating chain of calls of tests did not helped to repeat it. | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2022-08-16 ] | |||||||||||||||||
|
bb-10.11-
| |||||||||||||||||
| Comment by Daniel Black [ 2022-09-21 ] | |||||||||||||||||
|
Is a PUBLIC role meant to be sufficient so support anonymous users? I tried mariadb-install-db --skip-test-db, then: From
And non-existent user's still couldn't access:
| |||||||||||||||||
| Comment by Sergei Golubchik [ 2022-09-22 ] | |||||||||||||||||
|
No, PUBLIC role isn't sufficient. It can allow everyone to access test db, but it won't allow just anyone to connect. If you want an anonymous user, you need to it with CREATE USER ''@'%' | |||||||||||||||||
| Comment by Angelique Sklavounos (Inactive) [ 2022-10-25 ] | |||||||||||||||||
|
abc294fab44 on bb-10.11- | |||||||||||||||||
| Comment by Daniel Lenski [ 2023-02-09 ] | |||||||||||||||||
|
serg, we are very confused by the code changes linked to this JIRA (cc tingynia):
What is/was the goal of these changes? In the next release, do you actually intend to require that each individual test files does GRANT ALL ON test.*, or not? | |||||||||||||||||
| Comment by Sergei Golubchik [ 2023-02-10 ] | |||||||||||||||||
|
Correct, tests have to include GRANT ALL ON test.* as needed. For the majority of the tests it's not needed, as they're run under the root user anyway. Tests that create new users might need to grant all needed privileges explicitly to these new users. There were actually few bugs in tests because newly created users were automatically be able to do something. The second commit restores access to test and test_% (using the new PUBLIC feature) — the intention here is to restore the historical behavior for normal usage, in bintar and rpm installations of MariaDB, but not restore it for the test suite. | |||||||||||||||||
| Comment by Daniel Lenski [ 2023-02-10 ] | |||||||||||||||||
Ah, thank you very much for clarifying, serg. Now this totally makes sense! If we need to test the privilege environment of new users, then magically/automatically having certain privilege will get in the way of realistic testing of those privileges. Okay, so we can expect that GRANT ALL ON test.* will be needed for non-root users going forward. Thanks! |