Repository navigation
Conversation
|
This is an automated comment for commit 3f1f507 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page Successful checks
|
ae9ea98 to
9f095db
Compare
0cd752f to
02a221a
Compare
11b3355 to
579af30
Compare
0d172a5 to
d178b11
Compare
|
Also related to #55911. |
| <create_generaterandom_requires_grant>false</create_generaterandom_requires_grant> | ||
| <create_executable_requires_grant>false</create_executable_requires_grant> | ||
| <create_executablepool_requires_grant>false</create_executablepool_requires_grant> | ||
| <create_fuzzjson_requires_grant>false</create_fuzzjson_requires_grant> |
There was a problem hiding this comment.
That seems like too many new settings. Just one new setting like table_engines_require_grant should be enough.
There was a problem hiding this comment.
I think there are some tradeoffs here:
- If using
table_engines_require_grant, for example, in order to be grantable to a specific table engine, admins haves to set other old engines as well, means losing control of granularity. - the settings in the config file are actually not so necessary. By default would be false according to the code, meaning engine doesn't require grant at all. I list all the setting in the config files just for completeness and illustration purpose. Probably I should just list one, and add some comment for users to reference similar settings, so it won'd be so daunting. What do you think?
There was a problem hiding this comment.
No, I think having a config setting for each table engine means too much granularity. And if people are happy with this PR then the feature will be enabled by default at some point in the future (like it happened for other features in #58584)
There was a problem hiding this comment.
I agree with you. So currently I would set it to false, and add some comment to warn admins once this feature is enabled (set to true), they have to grant every table engine, otherwise it is by default not granted, what do you think? It seems lengthy for admins. BTW, should some table engines always granted?
There was a problem hiding this comment.
BTW, should some table engines always granted?
No, CREATE USER should create a user without privileges. This is difficult to change and it's kind of an invariant.
So yes, after this setting will be set to true by default (but it shouldn't happen very soon) it will require some work from admin. But it's not really difficult to grant
GRANT TABLE_ENGINE ON * TO username
And if some admin doesn't really like it they will be able to just disable the feature back.
| M(demangle, "", GLOBAL, INTROSPECTION) /* allows to execute function demangle() */\ | ||
| M(INTROSPECTION, "INTROSPECTION FUNCTIONS", GROUP, ALL) /* allows to execute functions addressToLine(), addressToSymbol(), demangle()*/\ | ||
| \ | ||
| M(MergeTree, "", GLOBAL, SOURCES) \ |
There was a problem hiding this comment.
That doesn't look completely correct. I mean URL or AZURE are sources, but for example CollapsingMergeTree is not a source, it's a table engine.
Perhaps it's better to invent another privilege group ALL_TABLE_ENGINES and make SOURCES a subset of it. Also it would be nice to group similar table engines into groups according to the engine families like MERGE_TREE_TABLE_ENGINES and LOG_TABLE_ENGINES, i.e.
M(MergeTree, "", GLOBAL, MERGE_TREE_TABLE_ENGINES) \
M(CollapsingMergeTree, "", GLOBAL, MERGE_TREE_TABLE_ENGINES) \
...
M(Log, "", GLOBAL, LOG_TABLE_ENGINES) \
M(TinyLog, "", GLOBAL, LOG_TABLE_ENGINES) \
M(StripeLog, "", GLOBAL, LOG_TABLE_ENGINES) \
...
M(Buffer, GLOBAL, SPECIAL_TABLE_ENGINES) \
...
M(S3, "", GLOBAL, INTEGRATION_TABLE_ENGINES) \
...
M(MERGE_TREE_TABLE_ENGINES, "", GROUP, ALL_TABLE_ENGINES) \
M(LOG_TABLE_ENGINES, "", GROUP, ALL_TABLE_ENGINES) \
M(SPECIAL_TABLE_ENGINES, "", GROUP, ALL_TABLE_ENGINES) \
M(INTEGRATION_TABLE_ENGINES, "SOURCES", GROUP, ALL_TABLE_ENGINES) \
M(ALL_TABLE_ENGINES, "", GROUP, ALL) \
We can turn SOURCES into an alias of INTEGRATION_TABLE_ENGINES, that seems quite right.
There was a problem hiding this comment.
cannot agree more, would do that.
|
|
||
| <!-- By default, for backward compatibility create table with a specific table engine ignores grant, | ||
| however you can change this behaviour by setting this to true --> | ||
| <create_mergetree_requires_grant>false</create_mergetree_requires_grant> |
There was a problem hiding this comment.
Could you please add one test where such setting is true?
There was a problem hiding this comment.
yes, would add one.
|
@jsc0218, it is strange to have every table engine as a separate grant. |
99% of this piece of code is just for backward compatibility, that means for users with existing CH installation, no behavior change to them. If a new table engine is later added, and requires no grant ability, nothing else to do with this code. If it requires grant ability, add the name of table engine in AccessType.h, that's it. |
We can try implementing a syntax like the following This way we will only need one new privilege We could also support advanced syntax with a wildcard like this: Maybe it's a bit better than the current approach of this PR. So the idea is to make the @jsc0218 @alexey-milovidov What do you think? |
wildcard would be an advantage, but I have some concerns with it:
|
No, this is not allowed even in the current approach. And that seems ok, because there is also
That's a good point. Too many privileges just to give the ability to create a table is not good. For example, in order to give the ability to create a table with It would look strange if now we will add |
|
Ok, probably it's better to keep the current approach. But we need a unit test checking that for each table engine there is a corresponding access type (so we're not going to forget adding an access type when we will possibly add a new table engine in the future). |
yes, definitely need to add test. Also I think for the configuration improvement part, probably better to add comments and just list one for illustration purpose, otherwise the set is too daunting (Please see the first above discussion.) |
|
I have one more idea. Can we support both ways? I mean or don't look very clear, and looks even confusing. Though for MergeTree it looks better. So I thought maybe we could support both and but treat them the same (i.e. check that the current user has any of those access types). This is only for sources, for simple table engines we can support only syntax This behavior can be implemented by modifying the |
|
@vitlibar, let's make it generic, so it supports specifying any table engine by their name, and we don't have to repeat them in the code. |
Ok, I suggested this syntax: This way we don't have to repeat them in the code and worry that we can forget to add the corresponding privilege for a new table engine in the future. |
Yes, I think this is the best approach as long as there are not many sources, also considering extensibility and |
related to #38316
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
table engine is grantable now, and it won't affect existing users behavior
Documentation entry for user-facing changes
It follows the GRANT syntax, for example,