From 9e5ab0c3cab756ecf2b1ca7a22e48e03a7b6dbee Mon Sep 17 00:00:00 2001 From: Ignas <5737899+Hoffs@users.noreply.github.com> Date: Wed, 2 Dec 2026 04:35:07 +0200 Subject: [PATCH] fix(rds): give the PostgreSQL master user rds_superuser with ADMIN OPTION (#9953) The master user joined rds_superuser without ADMIN OPTION. From PostgreSQL 16, CREATEROLE no longer lets a role add members to a role it holds no ADMIN OPTION on, so the master could not GRANT rds_superuser to another role, which RDS documents a member of rds_superuser can do. The master now joins rds_superuser WITH ADMIN OPTION, on initialization and again after a snapshot restore. Closes #9952 --- docs/services/rds.md | 1 + .../aws/services/rds/container/RdsContainerManager.java | 7 ++++--- .../services/rds/container/RdsContainerManagerTest.java | 2 +- .../rds/proxy/RdsPostgresMasterRoleIntegrationTest.java | 3 +++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/services/rds.md b/docs/services/rds.md index 80f1bf655f..4534a35992 100644 --- a/docs/services/rds.md +++ b/docs/services/rds.md @@ -1444,6 +1444,7 @@ FLOCI_STORAGE_HOST_PERSISTENT_PATH=/absolute/host/path/data A PostgreSQL instance or cluster is initialized as RDS initializes one. The bootstrap superuser is `rdsadmin`, the role RDS keeps for its own management tasks, and the master user is an ordinary role created as RDS creates it: `LOGIN NOSUPERUSER INHERIT CREATEDB CREATEROLE NOREPLICATION VALID UNTIL 'infinity'`, a member of `rds_superuser` +with ADMIN OPTION, so it can grant `rds_superuser` to other roles (RDS User Guide, [Understanding the rds_superuser role](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.Roles.rds_superuser.html)). The master owns the `postgres` and `template1` databases and the instance's own database, so the objects it owns can be handed to another role with `REASSIGN OWNED BY TO ` once the master is a member of diff --git a/src/main/java/io/floci/aws/services/rds/container/RdsContainerManager.java b/src/main/java/io/floci/aws/services/rds/container/RdsContainerManager.java index 08c0fc76dd..8dce7894e8 100644 --- a/src/main/java/io/floci/aws/services/rds/container/RdsContainerManager.java +++ b/src/main/java/io/floci/aws/services/rds/container/RdsContainerManager.java @@ -959,8 +959,9 @@ public class RdsContainerManager implements RdsBackendGate, RdsBackendEndpointRe * *