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

PG16 - Don't propagate GRANT ROLE with INHERIT/SET option #7190

Merged
merged 1 commit into from
Sep 12, 2023

Conversation

naisila
Copy link
Member

@naisila naisila commented Sep 11, 2023

We currently don't support propagating these options in Citus
Relevant PG commits:
postgres/postgres@e3ce2de
postgres/postgres@3d14e17

Limitation:
We also need to take care of generated GRANT statements by dependencies in attempt to distribute something else. Specifically, this part of the code in GenerateGrantRoleStmtsOfRole:

grantRoleStmt->admin_opt = membership->admin_option;

In PG16, membership also has inherit_option and set_option which need to properly be part of the grantRoleStmt. We can skip for now since #7164 will take care of this soon, and also this is not an expected use-case.

#7138

@naisila naisila changed the title PG16 - Error out for GRANT ROLE with iherit/set option used PG16 - Error out for GRANT ROLE with inherit/set option used Sep 11, 2023
@naisila naisila marked this pull request as ready for review September 11, 2023 12:02
@@ -509,6 +509,9 @@ sub generate_hba

# we disable some restrictions for local objects like local views to not break postgres vanilla test behaviour.
push(@pgOptions, "citus.enforce_object_restrictions_for_local_objects=false");

# we disable propagating create role statements to not have roles as distributed objects during vanilla tests.
push(@pgOptions, "citus.enable_create_role_propagation=false");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels unexpected given ErrorIfGrantRoleWithInheritOrSetOption is called after FilterDistributedRoles ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, ok vanilla tests runs with distributed roles, let me think a bit

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using enable_create_role_propagation = false might hide some actual bugs, so I'm really not sure if we should pass it.

Instead, I'd rather change ErrorIfGrantRoleWithInheritOrSetOption to WarnfGrantRoleWithInheritOrSetOption and rely on EnableUnsupportedFeatureMessages.

And, make sure to add HINT to WarnfGrantRoleWithInheritOrSetOption such that remind the user should run the same command on the workers

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, sounds good, let me do that.
I will also extend the PR with some REVOKE tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out that we cannot run GRANT ROLE statements from the worker nodes. So, I will leave it as erroring out for now unless you have a different idea on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you cannot run any DDL from the workers unless you set citus.enable_ddl_propagation to off ? So, that sounds expected to me

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, sorry about that. I confused the logic for a moment there. Let me change the PR

@codecov
Copy link

codecov bot commented Sep 11, 2023

Codecov Report

Merging #7190 (65e4a4f) into main (c1dc378) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #7190      +/-   ##
==========================================
- Coverage   93.22%   93.21%   -0.01%     
==========================================
  Files         274      274              
  Lines       59376    59386      +10     
==========================================
+ Hits        55352    55359       +7     
- Misses       4024     4027       +3     

We currently don't support propagating these options in Citus

Relevant PG commits:
postgres/postgres@e3ce2de
postgres/postgres@3d14e17
@naisila naisila changed the title PG16 - Error out for GRANT ROLE with inherit/set option used PG16 - Don't propagate GRANT ROLE with INHERIT/SET option Sep 12, 2023
@naisila naisila merged commit 1da99f8 into main Sep 12, 2023
107 of 110 checks passed
@naisila naisila deleted the naisila/error_grant branch September 12, 2023 09:47
francisjodi pushed a commit that referenced this pull request Nov 13, 2023
We currently don't support propagating these options in Citus
Relevant PG commits:
postgres/postgres@e3ce2de
postgres/postgres@3d14e17

Limitation:
We also need to take care of generated GRANT statements by dependencies
in attempt to distribute something else. Specifically, this part of the
code in `GenerateGrantRoleStmtsOfRole`:
```
grantRoleStmt->admin_opt = membership->admin_option;
```
In PG16, membership also has `inherit_option` and `set_option` which
need to properly be part of the `grantRoleStmt`. We can skip for now
since #7164 will take care of this soon, and also this is not an
expected use-case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants