[MDEV-18554] User with SELECT privilege on mysql.proc can see a body of the procedure/function it does not have any grant on Created: 2019-02-12 Updated: 2020-08-25 Resolved: 2019-05-13 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Authentication and Privilege System, Documentation, Information Schema |
| Affects Version/s: | 10.3.7, 10.3.13 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Valerii Kravchuk | Assignee: | Kenneth Dyer (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
This KB article, https://mariadb.com/kb/en/library/show-create-procedure/, says: "Both statements require that you be the owner of the routine or have SELECT access to the mysql.proc table. If you do not have privileges for the routine itself, the value displayed for the Create Procedure or Create Function field will be NULL." It seems a user with just USAGE on . and SELECT ON `mysql`.`proc` privileges can perfectly see the body of any stored procedure or function, to the contrary of what that documentation says. Consider the following simple test:
When we connect as u1@localhost we obviously can not execute and can now SHOW the procedure prc1() we've just created (as root) in the new db2 database:
But if we GRANT SELECT on mysql.proc we can see the body, even though we have no privilege to execute the procedure and no privilege at all on anything db2.*:
This is against the statement in our KB (or MySQL manual for that matter). As a side note, Percona Server 5.7.25-28 is affected in the same way. |
| Comments |
| Comment by Kenneth Dyer (Inactive) [ 2019-03-08 ] | ||||||||||||||||||||||||
|
Reworked the cited text to include the SELECT privilege. Also added to the examples cases where the user doesn't have the relevant privileges. | ||||||||||||||||||||||||
| Comment by Kenneth Dyer (Inactive) [ 2019-04-23 ] | ||||||||||||||||||||||||
|
sanja Sending to you. Text updated, please assign to someone to review that it's correct. Also, Julien's note above. | ||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2019-04-23 ] | ||||||||||||||||||||||||
|
I think it was some misunderstanding during doc writing, because:
i.e. with select access you can get the same and even more. I meant that there is no sens to hide something from user with select right on `mysql`.`proc`. (I'd changed the docs) | ||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2019-04-23 ] | ||||||||||||||||||||||||
|
I checked the documentation, looks good (especially as a warning). | ||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2019-04-23 ] | ||||||||||||||||||||||||
|
I also checked source code, there is explicit allowance to see the text if user has SELECT access to the `mysql`.`proc`, so it is not a bug (which is logical because of my first comment):
|