Bug #76622 | "create procedure" implicitly does "create user" if DNS is incomplete | ||
---|---|---|---|
Submitted: | 8 Apr 2015 16:21 | Modified: | 8 Jun 2015 11:12 |
Reporter: | Jörg Brühe (OCA) | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Stored Routines | Severity: | S2 (Serious) |
Version: | 5.5.41, 5.6.22 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[8 Apr 2015 16:21]
Jörg Brühe
[8 Apr 2015 16:31]
Jörg Brühe
Re the DNS: It is sufficient to use a VM for the reproduction, for which there is no DNS server at all. The machine will have a hostname from its setup, and an IP adrdress (probably via DHCP), that will be enough to reproduce the bug.
[9 Apr 2015 11:27]
MySQL Verification Team
Hello Jörg Brühe, Thank you for the report. Imho this is known and documented behavior, quoting from manual "By default, MySQL automatically grants the ALTER ROUTINE and EXECUTE privileges to the routine creator. This behavior can be changed by disabling the automatic_sp_privileges system variable" - https://dev.mysql.com/doc/refman/5.6/en/create-procedure.html https://dev.mysql.com/doc/refman/5.6/en/stored-routines-privileges.html Also - https://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_automatic_sp_p... Thanks, Umesh
[9 Apr 2015 14:16]
Jörg Brühe
I must admit that note had escaped me - I am sorry. However, this behavior is not really helpful, because the privileges are given to the wrong account: They are given to the result of "user()", while the check whether "execute" and "alter" are granted refers to "current_user()". This is inconsistent. In effect this means a new user account is created, which IMNSHO should not happen as a side effect of "create procedure". So the subject line is still correct: "create procedure" implicitly does "create user" ... What is wrong in my submission is the suggested fix - it should read "Consider the value of "current_user()" to be the creator of the routine." When you consider the "proxy user" whose importance will rise with MySQL 5.7, it is obvious that this difference is very relevant.
[9 Apr 2015 14:27]
Jörg Brühe
What I forgot: The code already uses the "current_user()" account, because it takes the password from that account and sets it for the new "user()" account. Even more inconsistent ...
[8 Jun 2015 11:12]
MySQL Verification Team
Thank you for the feedback. For now marking this as duplicate of Bug #77186, please follow up Bug #77186 for any updates.