Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uHGeJ-00GaSk-FU for pgsql-bugs@arkaria.postgresql.org; Tue, 20 May 2025 06:40:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uHGeI-004xD5-Gq for pgsql-bugs@arkaria.postgresql.org; Tue, 20 May 2025 06:40:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uHGeI-004xCx-6g for pgsql-bugs@lists.postgresql.org; Tue, 20 May 2025 06:40:26 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uHGeF-002u9O-1i for pgsql-bugs@lists.postgresql.org; Tue, 20 May 2025 06:40:25 +0000 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-6019b564d0bso5560251a12.2 for ; Mon, 19 May 2025 23:40:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1747723223; x=1748328023; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=K4N4GVVHGu8KiusFuOF5/zNOyxU/BKGJdymq9Pwzu1g=; b=CQSZ4nBCMWjFUwwlunH5JEngy88iQM8CiM8sZBQ+bEoznyou6BaablFXOeahX0ZfaS es7SfLrOWoND9EViQxks9QhiaVQc9AZPNLcNXYo2iBZZYD6WFVlZBpaTyH9sYFBlatyg y3Zd6j89HWBVRI9ql0erXd9mBH2XQ7ZCHAh4m7ltdw8wXf6nSoB4JNz1IkXbv1MAfEF9 ttB3pm7Xl47yAWKVkSRyd6Q197a22rFjdvdLZ7/Y+Aj37CsEMr52MonlPE3ybPAHslBy bln1pfJZoorv6FfdR9nIR9WSD4yVavpPqom3Jx3fPTTNcU0fv+EBhNaAdXwMuYGAqJ2d cc+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747723223; x=1748328023; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=K4N4GVVHGu8KiusFuOF5/zNOyxU/BKGJdymq9Pwzu1g=; b=BzjkN/wqPELehs+SmBhNGQPiuwSQ023l0EaDfuW8CEuYbttYtYMl8PVU67kpAUHapP lydoXjNaDpmR26XVCDbMxuITQmsYM03lmL0KHYBzh8UpOR9oY4mI6jKoNrRishDVzgv4 1XfXPXwKhmQObIyw1itABSaKTI0PwzOBb8LRKugtvhgSSHn2r4cdHu5aZkLimzOU/+z/ 6VztrkIr0Ja/G9Ct0L0V3h25v9gjaULVJWwmzf6DXD1R8YEKoC9VKDi93s1BaTwtUPe6 vnjdiiN7MGwtfwi4p9XABb92m5EcNaujgrq9+NYL+fP5SrXoY1kZ57vNc8OdACzk//Kj mZOw== X-Forwarded-Encrypted: i=1; AJvYcCVgyAB8gbgaUZ1lBtI8aUzYh15uRZ5BR6BJcZiZc/2PCFExQOOyUfI/A3d1vJdxU4KbtI6sB9x73LCc@lists.postgresql.org X-Gm-Message-State: AOJu0YzCt6DNsbqE07FILsbw75sbgCmGp8orMYx0mSjHoKKHpDomkheV bTE8dVKQ7KjEaFBczelzbc+bLqUDWPRGESKYMZKYuoOTT/5dodog+CAkezChjVqJB9eum+gqtZy xp4/Y X-Gm-Gg: ASbGncshx4g8Z/onLeGZxrzulT5RSz/yFVJqHsIeoxbngN2HjURKXuaYEsU1/d3b8d8 YkWRe8Y4WM8giWvIQZtfm3wncjkrvTlkrXCaiiYRtLSSqASoJoggWQiCT+VYzSOtT6AGrPK/vXX K984DgI0bleERkVbD3M55oluB26kpzwazy7edGHv3DtRivv9x6QjAgOFI3ySIchgvB0HpCoTgiS 5mpSZG3mpEwRCue/Ayrm/RIovtEgkoc6p+PCx3yUe2b/mCsDnd6yI+lHUUUdjBeeCsG4LFmPmnI 3eUzH1BWVc/2Zw9X+2FcV89URg1cWcM+/Jqo9/PJfCKKa5Bj8ne4DTOL9Nxec5kAjdZsgIv6GUG J6qUUBS2lI/M= X-Google-Smtp-Source: AGHT+IG81HPduk3RsrVmZ4CV4SbzH4gAeLj2bRO/4rz0RoTdvb6gwPmDdK8LPAiaTC273sT6v7JL8Q== X-Received: by 2002:a17:907:1c91:b0:ad5:5857:ece2 with SMTP id a640c23a62f3a-ad55857f064mr881361966b.37.1747723222709; Mon, 19 May 2025 23:40:22 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([41.66.98.43]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad52d278247sm679644266b.76.2025.05.19.23.40.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 May 2025 23:40:22 -0700 (PDT) Message-ID: <382be150738e46811e2bd0b6dcda1dbffe096272.camel@cybertec.at> Subject: Re: BUG #18934: Even with WITH ADMIN OPTION, I Cannot Manage Role Memberships From: Laurenz Albe To: snaperling@gmail.com, pgsql-bugs@lists.postgresql.org Date: Tue, 20 May 2025 08:40:15 +0200 In-Reply-To: <18934-67d2e90068801d2b@postgresql.org> References: <18934-67d2e90068801d2b@postgresql.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.1 (3.56.1-1.fc42) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2025-05-19 at 08:44 +0000, PG Bug reporting form wrote: > PostgreSQL version: 16.8 > Operating system: Windows 10 >=20 > In PostgreSQL, I have a role hierarchy involving a user and two group rol= es: > Roles: > tester1@something =E2=80=94 a user role (not superuser) > user_manager =E2=80=94 an intermediate group role > user_group =E2=80=94 the target group role whose membership I want to= manage > > Role | Member Of | `WITH ADMIN OPTION` | > > `tester1@something` | `user_manager` | YES > > `user_manager` | `user_group` | YES > >=20 > In this configuration: > tester1@something should be able to add/remove members from user_grou= p. > But it cannot =E2=80=94 GRANT or REVOKE on user_group fails. > Even though tester1@something has full admin rights on user_manager, = and > user_manager has admin rights on user_group. > Role Setup (After Manual Fix) > When I run: > REVOKE ADMIN OPTION FOR user_group FROM user_manager; > So that now: > Role Member Of WITH ADMIN OPTION > tester1@something user_manager YES > user_manager user_group NO > Now, unexpectedly: > tester1@something can add and remove members from user_group. > Even though no role in the chain has WITH ADMIN OPTION on user_group. I cannot reproduce that: \c - postgres You are now connected to database "postgres" as user "postgres". CREATE ROLE a LOGIN; CREATE ROLE b ADMIN a; CREATE ROLE c ADMIN b; \drg List of role grants Role name =E2=94=82 Member of =E2=94=82 Options = =E2=94=82 Grantor =20 =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90 a =E2=94=82 b =E2=94=82 ADMIN, INHERIT, = SET =E2=94=82 postgres b =E2=94=82 c =E2=94=82 ADMIN, INHERIT, = SET =E2=94=82 postgres [...] \c - a You are now connected to database "postgres" as user "a". GRANT c TO laurenz; Works without a hitch! Let's undo the grant and remove the ADMIN option as user "postgres": REVOKE c FROM laurenz; \c - postgres You are now connected to database "postgres" as user "postgres". GRANT c TO b WITH ADMIN FALSE; \drg List of role grants Role name =E2=94=82 Member of =E2=94=82 Options = =E2=94=82 Grantor =20 =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90 a =E2=94=82 b =E2=94=82 ADMIN, INHERIT, = SET =E2=94=82 postgres b =E2=94=82 c =E2=94=82 INHERIT, SET = =E2=94=82 postgres [...] Now let's try again as user "a": \c - a You are now connected to database "postgres" as user "a". GRANT c TO laurenz; ERROR: permission denied to grant role "c" DETAIL: Only roles with the ADMIN option on role "c" may grant this role= . So please explain in detail what doesn't work for you. Yours, Laurenz Albe