![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
It seems that GRANT ALL ON SCHEMA does not properly check for grantor rights. |
#3
| |||
| |||
|
|
I'm not Peter, but I have an answer anyway: the standard says it should be narrowed. |
#4
| |||
| |||
|
|
While browsing the Access Rules of <revoke statement>... it is unclear. |
#5
| |||
| |||
|
|
It seems that GRANT ALL ON SCHEMA does not properly check for grantor rights. What's happening is that pg_namespace_aclcheck() allows the operation if you have GRANT OPTION for *any* of the rights to be granted. The same problem exists for all object types. |
|
I am not sure whether we should refuse the operation or just narrow the set of privileges to those that are grantable per GRANT OPTION. Peter, any thoughts? |
#6
| |||
| |||
|
|
section 11.37 <revoke statement> says 8) For every combination of <grantee> and <action> on O specified in <privileges>, if there is no corresponding privilege de- scriptor in the set of identified privilege descriptors, then a completion condition is raised: warning-privilege not revoked. 9) If ALL PRIVILEGES was specified, then for each <grantee>, if no privilege descriptors were identified, then a completion condition is raised: warning-privilege not revoked. |
|
which seems parallel to the GRANT case: warning, but no error. |
#7
| |||
| |||
|
|
... Note that says WARNING, not ERROR. So I guess what we need to do is narrow the privilege set and issue a warning message. |
|
I think this also bears on the question that was raised before about whether REVOKE should raise an error if you don't have the right to revoke the privileges you're listing. We don't, and based on this I think we shouldn't --- but maybe we should issue a warning. |
#8
| |||
| |||
|
|
I do not understand it that way. (1) I think that the "General Rules" apply ONLY IF the "Access Rules" are already fulfilled, that is I MUST have the grant option of the rights before going there?! |
#9
| |||
| |||
|
|
After that, you get to the General Rules, which pretty clearly say that trying to grant privileges you don't have grant option for is just a warning and not an error condition. (Such privileges will not be in the set of "identified privilege descriptors".) AFAICS the specification for REVOKE is exactly parallel. So the existing code is still wrong, but not in quite the way we thought. I'd be the first to say that this aspect of the spec is a tad bizarre. Does anyone want to argue for ignoring the spec and implementing "saner" behavior? It's not like we are super close to spec compliance for privileges otherwise ... |
#10
| ||||||
| ||||||
|
|
I looked at this more carefully. In both SQL92 and SQL99, the only Access Rule for GRANT is 1) The applicable privileges shall include a privilege identifying O. Here "O" is the target object, and "applicable privileges" is all the privileges held by the current user. Now, that says "a privilege", not "the privilege to be granted", nor even "a privilege with grant option". |
|
As near as I can tell, what the spec wants is that GRANT should raise error if the issuing user has no privileges at all for the target object, but as long as he has at least one privilege bit, he gets past the Access Rule --- whether or not that bit has anything to do with the privilege bits to be granted. |
|
AFAICS the specification for REVOKE is exactly parallel. |
|
So the existing code is still wrong, but not in quite the way we thought. |
|
I'd be the first to say that this aspect of the spec is a tad bizarre. |
|
Does anyone want to argue for ignoring the spec and implementing "saner" behavior? It's not like we are super close to spec compliance for privileges otherwise ... |
![]() |
| Thread Tools | |
| Display Modes | |
| |