[MDEV-21928] ALTER USER doesn't remove excess authentication plugins from mysql.global_priv Created: 2020-03-12 Updated: 2020-08-02 Resolved: 2020-04-27 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Authentication and Privilege System |
| Affects Version/s: | 10.4.12 |
| Fix Version/s: | 10.4.13 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Geoff Montee (Inactive) | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
If you use ALTER USER to remove unix_socket authentication from root@localhost, it seems to come back after either the server is restarted or FLUSH PRIVILEGES is executed, because the authentication plugin is not removed from the user account's row in mysql.global_priv. To reproduce: Check that the user has unix_socket authentication:
Remove it:
Check again:
Restart the server:
Check again:
More in-depth analysis shows that the unix_socket entry is not actually removed from mysql.global_priv after the ALTER USER statement:
And the server restart isn't even necessary. The authentication method also comes back with a FLUSH PRIVILEGES:
|
| Comments |
| Comment by Geoff Montee (Inactive) [ 2020-03-12 ] | ||||||||||||||
|
Here's the workaround:
| ||||||||||||||
| Comment by Elena Stepanova [ 2020-03-12 ] | ||||||||||||||
|
It's not just unix_socket, it seems that ALTER USER doesn't remove alternative authentication methods which haven't been explicitly listed. I don't really know if it should, on one hand, it seems rather dangerous; on the other hand, the only other way to remove alternative authentication is through global_priv update, which is cumbersome. The KB article doesn't seem to have been updated to reflect multiple authentication methods, so it's unclear from there, either. But if it is not supposed to remove extra authentication methods, of course SHOW GRANTS should still list them, so the bug is valid either way. And documentation update is due. | ||||||||||||||
| Comment by Geoff Montee (Inactive) [ 2020-03-12 ] | ||||||||||||||
|
In my opinion, it would make the most sense to remove alternative authentication plugins that aren't listed in the ALTER USER statement. Faisal originally noticed this bug, so maybe he has an opinion on this too. | ||||||||||||||
| Comment by Elena Stepanova [ 2020-03-12 ] | ||||||||||||||
|
The scary part for me is that it would be very prone to user (admin) errors, and those errors will be difficult to fix. I suppose the most common reason for ALTER USER ... IDENTIFIED is adding a new authentication method. It's not an action which happens often, so admins won't remember all the details of how the command works; and it may seem most natural to many people to just provide the new method, especially if it's done for many users. What will happen then is that password authentication along with the passwords will be removed, and admin won't be able to restore it correctly, thus locking users out. | ||||||||||||||
| Comment by Geoff Montee (Inactive) [ 2020-03-12 ] | ||||||||||||||
|
Ideally, in the long term, it would probably make the most sense to provide syntax that support multiple types of operations, such as:
| ||||||||||||||
| Comment by Geoff Montee (Inactive) [ 2020-03-12 ] | ||||||||||||||
|
I created MDEV-21929 as a feature request to implement support for the more advanced operations, in case we want to do that. |