Repository navigation
metadata: SQL Server, MySQL and MariaDB read in either scope - #113
Merged
Merged
Conversation
SQL Server shows a user only the metadata of what it owns or holds a right on; a connection reads in DATABASE where it holds VIEW DEFINITION on the database. In USER the schemas are those that hold an object the user sees. Grants on routines and sequences are read as object privileges, no longer as grants on tables. MySQL and MariaDB read in DATABASE where the session holds, on every object, the rights with which information_schema shows the whole structure: SELECT, SHOW VIEW and TRIGGER, on MariaDB EXECUTE besides, as it opens a view to find its columns. SHOW GRANTS of the session decides, granted to the account or to an active role; the grant tables of the schema mysql must be readable too. DATABASE reads every grant on a table, a column and a routine from those grant tables. USER reads the user and its roles from APPLICABLE_ROLES, its grants from information_schema and SHOW GRANTS of its own account, and the grants of its active roles as each database shows them. Grantees and grantors are named without their host. MariaDB reads the keys of a table from KEY_COLUMN_USAGE, which shows them to a reader that may only select. H2 and DuckDB read their catalog one way only, the same in both scopes, and every connection may read in the scope it asks for. They keep the scope they are made for, so a snapshot names the scope asked for. The contract runs on SQL Server, MySQL and MariaDB in a container too, and the tests of each database add what it shows differently; on MySQL and MariaDB a reader holding exactly the requirement, directly or through an active role, reads what the administrator reads, and a reader of the grant tables alone falls back. Unit tests cover the lines of SHOW GRANTS and the scope of the provider of each product, and a snapshot read with the provider of H2 names the scope asked for. The README of the metadata providers says which provider serves which product, how a scope is asked for, and for each database what each scope reads, the right DATABASE needs, and where a database shows a user less or more than one might expect. Signed-off-by: Stefan Bischof <stbischof@bipolis.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #112, which brought the scopes
DATABASEandUSERwith Oracle and PostgreSQL: the providers of the other databases read in either scope too.SQL Server
DATABASEneedsVIEW DEFINITIONon the database; without it SQL Server shows a user only what it owns or holds a right on.USERthe schemas are those that hold an object the user sees.MySQL and MariaDB
DATABASEneeds, on every object, the rights with whichinformation_schemashows the whole structure:SELECT,SHOW VIEWandTRIGGER, on MariaDBEXECUTEbesides, and the grant tables of the schemamysqlmust be readable.SHOW GRANTSof the session decides, granted to the account or to an active role. These rights also let their holder read every row.DATABASEreads every grant from the grant tables;USERreads the user and its roles fromAPPLICABLE_ROLES, its grants frominformation_schemaandSHOW GRANTS, and the grants of its active roles as each database shows them.KEY_COLUMN_USAGE, which shows them to a reader that may only select.H2 and DuckDB
They read their catalog one way only; every connection may read in the scope it asks for, and a snapshot names that scope.
Tests and README
The contract of #112 runs on SQL Server, MySQL and MariaDB in a container too; the tests of each database add what it shows differently. The README of the metadata providers says, for each database, what each scope reads, the right
DATABASEneeds, and where a database shows a user less or more than one might expect.