Skip to content

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

Merged
Naisila Puka (naisila) merged 1 commit into
mainfrom
naisila/error_grant
Sep 12, 2023
Merged

PG16 - Don't propagate GRANT ROLE with INHERIT/SET option#7190
Naisila Puka (naisila) merged 1 commit into
mainfrom
naisila/error_grant

Conversation

@naisila

@naisila Naisila Puka (naisila) commented Sep 11, 2023

Copy link
Copy Markdown
Contributor

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 Puka (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 Puka (naisila) marked this pull request as ready for review September 11, 2023 12:02
Comment thread src/test/regress/pg_regress_multi.pl Outdated
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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
Contributor 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
Copy Markdown
Contributor 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
Copy Markdown
Contributor

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
Copy Markdown
Contributor 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

codecov Bot commented Sep 11, 2023

Copy link
Copy Markdown

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 Puka (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 Puka (naisila) merged commit 1da99f8 into main Sep 12, 2023
@naisila
Naisila Puka (naisila) deleted the naisila/error_grant branch September 12, 2023 09:47
Jodi-Ann Francis (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