feat(postgresql): support WITH INHERIT FALSE on role membership grants (PostgreSQL 16+)#361
Open
matthewgreenwaldagility wants to merge 4 commits into
Conversation
Author
|
@Duologic @jdotw @jvrplmlmn @iainlane Can I get a review on this please? Or at least trigger CI? |
chlunde
reviewed
May 14, 2026
chlunde
reviewed
May 14, 2026
chlunde
reviewed
May 14, 2026
chlunde
reviewed
May 14, 2026
chlunde
reviewed
May 14, 2026
chlunde
requested changes
May 14, 2026
chlunde
left a comment
Collaborator
There was a problem hiding this comment.
@matthewgreenwaldagility thanks for your contribution, please take a look at the comments!
Collaborator
|
@matthewgreenwaldagility could you rebase or merge master into this? |
Collaborator
|
Also, can you wire this to the PG version? I mean, just to make sure this runs only for Postgres>16 as you mention |
Signed-off-by: Matthew Greenwald <matthew.greenwald@agilityrobotics.com>
Signed-off-by: Matthew Greenwald <matthew.greenwald@agilityrobotics.com>
Signed-off-by: Matthew Greenwald <matthew.greenwald@agilityrobotics.com>
0384a85 to
c1ea143
Compare
Author
|
@chlunde @fernandezcuesta Comments have been addressed and the changes have been rebased on master. Thanks! |
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.
Closes #359
What this does
Adds a
withInheritboolean field tospec.forProvideron the PostgreSQLGrantresource, enablingWITH INHERIT FALSEon role membership grants — a feature introduced in PostgreSQL 16.When
withInheritis omitted, behaviour is unchanged. When combined withwithOption: ADMIN, the emitted SQL isWITH ADMIN OPTION, INHERIT FALSE.The field is only valid on
memberOfgrants — setting it on a privilege grant (privilegesfield) returns a validation error.Motivation
The primary use case is RDS PostgreSQL with IAM database authentication. Without this field, granting a master user membership in an
adminrole that holdsrds_iamcreates a transitive chain (master_user → admin → rds_iam), which causes RDS to route all connections for that user through PAM/IAM token verification, breaking password authentication.WITH INHERIT FALSEgrants membership (satisfyingALTER DEFAULT PRIVILEGES FOR ROLE admin) without inheritingrds_iam.Changes
apis/cluster/postgresql/v1alpha1/grant_types.goWithInherit *boolfield toGrantParametersapis/cluster/postgresql/v1alpha1/zz_generated.deepcopy.gopackage/crds/postgresql.sql.crossplane.io_grants.yamlpkg/controller/cluster/postgresql/grant/reconciler.gomembershipWithClauseshelper;selectGrantQueryfilterspg_auth_members.inherit_optionwhen set;createGrantQueriesuses new helper; validation rejectswithInheriton privilege grantspkg/controller/cluster/postgresql/grant/reconciler_test.goWithInheritnil/true/false for bothObserveandCreateexamples/cluster/postgresql/grant-with-inherit-false.yamlMakefileGOLANGCILINT_VERSIONfrom2.1.2→2.10.1to match CI and support Go 1.26README.mdSchemato PostgreSQL resource list, fix example pathsTesting
make reviewablepasses (generate + lint + all 26 test packages).The
inherit_optioncolumn onpg_auth_memberswas added in PostgreSQL 16. SettingwithInheriton an older cluster will result in a SQL error, which is the expected and documented behaviour.