Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve consistency in GRANT syntax between roles and privileges according to SQL standard [CORE5248] #5527

Closed
firebird-issue-importer opened this issue May 20, 2016 · 15 comments

Comments

@firebird-issue-importer

Submitted by: @mrotteveel

Attachments:
adminOption.sql

The current syntax of GRANT is inconsistent between privileges and roles. Specifically, for privileges there is the `WITH GRANT OPTION`, while for roles there is the `WITH ADMIN OPTION` which has a similar effect (looking at the langref).

I would propose that for roles the `WITH GRANT OPTION` is also added. The `WITH GRANT OPTION` means that the user can 1) grant this role to users and 2) revoke from users the role granted by this user, while `WITH ADMIN OPTION` means that 1) the user can grant privileges to this role and 2) grant this role to users and 3) revoke this role from all users irrespective of the grantee.

For privileges a `WITH ADMIN OPTION` could be added with the same meaning as `WITH GRANT OPTION` for consistency purposes.

Commits: 43579ac 7bf7455

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 20, 2016

Commented by: @dyemanov

We use the standard syntax. SQL spec declares WITH GRANT OPTION for privileges and WITH ADMIN OPTION for roles. I'm not sure they mean the same though, it needs checking.

Loading

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 20, 2016

Modified by: @mrotteveel

description: The current syntax of GRANT is inconsistent between privileges and roles. Specifically, for privileges there is the `WITH GRANT OPTION`, while for roles there is the `WITH ADMIN OPTION` which has a similar effect (looking at the langref).

I would propose that for roles the `WITH GRANT OPTION` is also added. The `WITH GRANT OPTION` means that the user can 1) grant this role to users and 2) revoke from users the role granted by this user, while `WITH ADMIN OPTION` means that 1) the user can grant privileges to this role and 2) grant this role to users and 3) revoke this role from all users irrespective of the grantee.

=>

The current syntax of GRANT is inconsistent between privileges and roles. Specifically, for privileges there is the `WITH GRANT OPTION`, while for roles there is the `WITH ADMIN OPTION` which has a similar effect (looking at the langref).

I would propose that for roles the `WITH GRANT OPTION` is also added. The `WITH GRANT OPTION` means that the user can 1) grant this role to users and 2) revoke from users the role granted by this user, while `WITH ADMIN OPTION` means that 1) the user can grant privileges to this role and 2) grant this role to users and 3) revoke this role from all users irrespective of the grantee.

For privileges a `WITH ADMIN OPTION` could be added with the same meaning as `WITH GRANT OPTION` for consistency purposes.

Loading

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 20, 2016

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

Loading

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 20, 2016

Commented by: @mrotteveel

I hadn't thought of that. This ticket was triggered by this SO question: http://stackoverflow.com/questions/37327616/in-firebird-database-how-do-i-grant-a-role-to-a-user-with-the-grant-option

If this is specified by the SQL standard, then maybe we should just leave this as is.

Loading

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 20, 2016

Commented by: @AlexPeshkoff

In our code ADMIN option behaves exactly like GRANT which violates standard. It should behave like Mark describes (up to ability to drop granted role) - reviewed standard not long ago.

What about extension of GRANT option for roles - that should IMHO be decided separately.

Loading

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 20, 2016

Modified by: @AlexPeshkoff

priority: Minor [ 4 ] => Major [ 3 ]

Loading

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 20, 2016

Commented by: @AlexPeshkoff

And I tend to treat it as a bug in our GRANT/REVOKE.

Loading

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 20, 2016

Modified by: @AlexPeshkoff

issuetype: Improvement [ 4 ] => Bug [ 1 ]

Loading

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Aug 24, 2016

Modified by: @AlexPeshkoff

summary: Improve consistency in GRANT syntax between roles and privileges => Improve consistency in GRANT syntax between roles and privileges according to SQL standard

Loading

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Aug 24, 2016

Commented by: @AlexPeshkoff

adminOption.sql contains a number of tests checking behavior of grant WITH ADMIN OPTION

Loading

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Aug 24, 2016

Modified by: @AlexPeshkoff

Attachment: adminOption.sql [ 13005 ]

Loading

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Aug 25, 2016

Commented by: @AlexPeshkoff

Fix in B3_0 is minimalistic - I do not want to change behavior in production version, just fixed obvious bug that any role can be dropped by any user. Full fix with SQL standard compliant ADMIN OPTION in role grants is in master branch, i.e. FB4.

Attention - to obtain new behavior in old databases roles should be recreated!

Loading

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Aug 25, 2016

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0.1 [ 10730 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

Loading

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Aug 30, 2016

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

Loading

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Aug 30, 2016

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants