[MDEV-9691] Want REVOKE ALL ROLES Created: 2016-03-07 Updated: 2016-03-21 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Authentication and Privilege System |
| Fix Version/s: | None |
| Type: | Task | Priority: | Minor |
| Reporter: | Igor Pashev | Assignee: | Vicențiu Ciorbaru |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
I'm used to declarative granting to users:
Roles make it difficult. There seems to be no way to revoke all roles from a user or a role, without dropping the grantee and recreating it. Dropping, AFAIK, has unwanted effects, like clearing a password (for a user) or cascade revoke from other roles and users (see below). I tried to work around with a procedure and prepared statement (reading roles_mapping), but got ERROR 1295 (HY000): This command is not supported in the prepared statement protocol yet. REVOKE ALL PRIVILEGES, GRANT OPTION FROM foo; seems revoke roles, but also fails on non-existing grants (Inherited from the role, I think. Might be MDEV-5228.). So, I'm out of options. The last straw is that REVOKE role1 FROM role2 is not idempotent
|
| Comments |
| Comment by Igor Pashev [ 2016-03-07 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Seems I can use
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2016-03-07 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Roles were developed as close to SQL standard as possible, and from what I can see, there is no such thing as REVOKE ALL ROLES there: On the other hand, it would be definitely helpful if prepared statements could deal with roles, we have a task for that, Regarding the REVOKE statement not being idempotent, it's the same for regular privileges. I couldn't find SQL standard specifying it one way or another, but from safety reasons it seems to me it makes more sense to produce error – if you want to revoke a privilege/role and make a typo in the privilege/role name, it's better to get an error than stay under the impression that the statement did the job. serg, could you please see the request and decide if there is anything that needs to be done here? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2016-03-07 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This needs more careful analysis, but perhaps "cannot revoke role" should be a warning, not an error. At least it seems that the standard says that revoking a not-granted privilege is a warning, not an error. It doesn't seem like there is any standard way to revoke all roles, though. We can still implement it as a non-standard extension, but, I'd rather extend REVOKE ALL PRIVILEGES, GRANT OPTION to revoke all roles too. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Pashev [ 2016-03-20 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Actually (as I noted in the description and just discovered it again REVOKE ALL PRIVILEGES, GRANT OPTION FROM foo; does revoke roles, but fails on non-existing grants (MDEV-5228).
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Pashev [ 2016-03-20 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Finally, it turned out that REVOKE ALL PRIVILEGES, GRANT OPTION revokes all roles from users So the real issue is "REVOKE ALL PRIVILEGES, GRANT OPTION fails on roles".
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Vicențiu Ciorbaru [ 2016-03-21 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Will work on this as soon as the next 10.1 sprint starts. |