-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
SELECT from the system database requires grant now #38970
SELECT from the system database requires grant now #38970
Conversation
2fa9206
to
6e900e1
Compare
2c24e75
to
980964f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
catch (Exception & e) | ||
{ | ||
if (e.code() == ErrorCodes::ACCESS_DENIED) | ||
return {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe just false
?
return access_granted(); | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this right? looks inconsistent, and the same couple lines below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those two lines are not the same, here we return true if this is the global context and below we return true if access flags don't contain any flags (so nothing to check).
980964f
to
1ea8db5
Compare
…rivilege anymore.
… and "GRANT SELECT ON system.users"
1ea8db5
to
3eb847f
Compare
The issue with test |
@@ -106,7 +106,9 @@ void Client::processError(const String & query) const | |||
std::vector<String> Client::loadWarningMessages() | |||
{ | |||
std::vector<String> messages; | |||
connection->sendQuery(connection_parameters.timeouts, "SELECT message FROM system.warnings", "" /* query_id */, | |||
connection->sendQuery(connection_parameters.timeouts, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vitlibar Maybe client should check server version/revision to see if function is supported, to make new client compatible with older servers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changelog category:
Changelog entry:
Add option enabling that SELECT from the system database requires grant. Details:
1. Add options
access_control_improvements.select_from_system_db_requires_grant
to the main config.If it's set to false a SELECT from any table in the system database can be executed without any grants.
If it's set to true then such SELECTs require
GRANT SELECT ON system.<table>
just like for ordinary databases.Exceptions: a few system tables (
tables
,columns
,databases
, and some constant tables likeone
,contributors
) are still accessible for everyone; and if there is a SHOW privilege (e.g.SHOW USERS
) granted the corresponding system table (i.e.system.users
) will be accessible.2. Add option
access_control_improvements.select_from_information_schema_requires_grant
to the main config.If it's set to false a SELECT from any table in the
information_schema
database can be executed without any grants.If it's set to true then such SELECTs require
GRANT SELECT ON information_schema.<table>
just like for ordinary databases.3. Add new table function
viewIfPermitted
:works as
view(query)
if the current user has permission to executequery
, otherwise it works asnull(structure)