Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oE3RR-0004a0-Rf for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Jul 2022 06:44:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oE3RQ-0008ND-8g for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Jul 2022 06:44:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oE3RP-0008K5-Sk for pgsql-bugs@lists.postgresql.org; Wed, 20 Jul 2022 06:44:15 +0000 Received: from ma1-aaemail-dr-lapp02.apple.com ([17.171.2.68]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oE3RK-0001c4-Rf for pgsql-bugs@lists.postgresql.org; Wed, 20 Jul 2022 06:44:15 +0000 Received: from pps.filterd (ma1-aaemail-dr-lapp02.apple.com [127.0.0.1]) by ma1-aaemail-dr-lapp02.apple.com (8.16.0.42/8.16.0.42) with SMTP id 26K6gDUI054953 for ; Tue, 19 Jul 2022 23:44:08 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=from : content-type : mime-version : subject : message-id : date : to; s=20180706; bh=Gtmq0p4W+i2o3ACUOddcn4pNWSPdVivv3CR6Yw3L2NM=; b=VMfQsuv71MG0NXT0SI9nGsOq72rNiEblT3oGECkb9W6uB/DAZJQaOqK0UMgrfnGRe1Tq yZUthDfsIJRoK+BKfIl+h5u8hxdUHzOtEtG7PR5NoAw3FK6xHyfKygnhr8zx836IJXMH TvrmEF9rGb5Q3kwWPgsmD3T4Sv3VugJ2SGsW+fgk9Wbd+6QvlomscRGcFN/z598iv2Sm 6tlHDPoCZrsEQrBnRG6rllvjO8DxLpVzCFIODzAoetVtJDFwzgmZ3ygxtDoT3xRjknUI 4nVrf09XuPaM95W6P3bZ8dp0u/0URoq+b+k1EzS+qD+j+cmj3ZRDm5GK1L/BEX2TaKhq hA== Received: from rn-mailsvcp-mta-lapp02.rno.apple.com (rn-mailsvcp-mta-lapp02.rno.apple.com [10.225.203.150]) by ma1-aaemail-dr-lapp02.apple.com with ESMTP id 3hbt0tr2ed-20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO) for ; Tue, 19 Jul 2022 23:44:08 -0700 Received: from rn-mailsvcp-mmp-lapp02.rno.apple.com (rn-mailsvcp-mmp-lapp02.rno.apple.com [17.179.253.15]) by rn-mailsvcp-mta-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.18.20220407 64bit (built Apr 7 2022)) with ESMTPS id <0RFB00EWG41IV4G0@rn-mailsvcp-mta-lapp02.rno.apple.com> for pgsql-bugs@lists.postgresql.org; Tue, 19 Jul 2022 23:44:06 -0700 (PDT) Received: from process_milters-daemon.rn-mailsvcp-mmp-lapp02.rno.apple.com by rn-mailsvcp-mmp-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.18.20220407 64bit (built Apr 7 2022)) id <0RFB001003O38300@rn-mailsvcp-mmp-lapp02.rno.apple.com> for pgsql-bugs@lists.postgresql.org; Tue, 19 Jul 2022 23:44:06 -0700 (PDT) X-Va-A: X-Va-T-CD: 14ab17208872ab85028767d83eab59a0 X-Va-E-CD: 376c72a210a565a02137857ea133fd17 X-Va-R-CD: 8d07658b61930c9f7661bbed7b42e5d4 X-Va-CD: 0 X-Va-ID: a20066bd-35c1-4e86-bbfe-760ebb4248d6 X-V-A: X-V-T-CD: 14ab17208872ab85028767d83eab59a0 X-V-E-CD: 376c72a210a565a02137857ea133fd17 X-V-R-CD: 8d07658b61930c9f7661bbed7b42e5d4 X-V-CD: 0 X-V-ID: bd6f137f-9760-44f2-b294-0920aaffc490 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517,18.0.883 definitions=2022-07-20_03:2022-07-19,2022-07-20 signatures=0 Received: from smtpclient.apple (unknown [17.234.59.186]) by rn-mailsvcp-mmp-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.18.20220407 64bit (built Apr 7 2022)) with ESMTPSA id <0RFB00MI441HC500@rn-mailsvcp-mmp-lapp02.rno.apple.com> for pgsql-bugs@lists.postgresql.org; Tue, 19 Jul 2022 23:44:06 -0700 (PDT) From: Harinath Kanchu Content-type: multipart/alternative; boundary="Apple-Mail=_86DE46FF-0561-4CDE-B995-A9B76AEB5B49" MIME-version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) Subject: Trusted extension cannot be dropped by the owner of the extension Message-id: Date: Tue, 19 Jul 2022 23:44:05 -0700 To: pgsql-bugs@lists.postgresql.org X-Mailer: Apple Mail (2.3696.100.31) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517,18.0.883 definitions=2022-07-20_03:2022-07-19,2022-07-20 signatures=0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_86DE46FF-0561-4CDE-B995-A9B76AEB5B49 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hello Postgres community, We recently encountered a bug regarding the install/uninstall of = extensions. Here are the details. Facts/Observations: Unable to drop TRUSTED extension. Postgres version: test_db=3D> SELECT version(); version = =20 = --------------------------------------------------------------------------= ----------------------------------------- PostgreSQL 13.2 on x86_64-apple-darwin20.3.0, compiled by Apple clang = version 11.0.0 (clang-1100.0.33.17), 64-bit (1 row) Steps to reproduce the bug: Compile and install postgres 13.2 ./configure --prefix=3D${INSTALL_PATH} --with-openssl --with-uuid=3De2fs = --with-perl --with-python --with-tcl make install-world Mark =E2=80=9Cbloom=E2=80=9D extension as trusted Add =E2=80=9Ctrusted =3D true=E2=80=9D to =E2=80=9Cbloom.control=E2=80=9D= file located in ${INSTALL_PATH}/share/extension/=20 Contents of bloom.control file after adding # bloom extension comment =3D 'bloom access method - signature file based index' default_version =3D '1.0' module_pathname =3D '$libdir/bloom' relocatable =3D true trusted =3D true Run the below commands in PSQL client (attaching the commands with = output) test_db=3D> create extension bloom; CREATE EXTENSION test_db=3D> drop extension bloom; ERROR: 42501: must be superuser to drop access methods LOCATION: RemoveAccessMethodById, amcmds.c:130 Expected: As the extension is marked as TRUSTED, if superuser privilege is not = necessary during the =E2=80=9Ccreate extension=E2=80=9D then superuser = privilege should not be required when the owner of the extension drops = it. Why this expectation: According to the documentation referred here https://www.postgresql.org/docs/current/sql-createextension.html = the = following is observed. =E2=80=9C=E2=80=9D=E2=80=9D The user who runs CREATE EXTENSION becomes the owner of the extension = for purposes of later privilege checks, and normally also becomes the = owner of any objects created by the extension's script. =E2=80=9C=E2=80=9D=E2=80=9D if the user is the owner of the extension then it is expected that the = access methods created during the extension installation should be under = the same user=E2=80=99s ownership and there should not be an error when = dropping the extension. Thank you, Best, Harinath --Apple-Mail=_86DE46FF-0561-4CDE-B995-A9B76AEB5B49 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hello= Postgres community,

We recently encountered a bug regarding the install/uninstall = of extensions. Here are the details.


Facts/Observations:

 Unable to drop TRUSTED = extension.


Postgres = version:

test_db=3D> SELECT version();
            =                     =                     =   version                 =                     =                  
-------------------------------------------------------------= ------------------------------------------------------
 PostgreSQL 13.2 on = x86_64-apple-darwin20.3.0, compiled by Apple clang version 11.0.0 = (clang-1100.0.33.17), 64-bit
(1 row)



Steps to reproduce the bug:

  1. Compile and install postgres 13.2
    1. ./configure --prefix=3D${INSTALL_PATH} --with-openssl = --with-uuid=3De2fs --with-perl --with-python --with-tcl
    2. make = install-world
  2. Mark =E2=80=9Cbloom=E2=80=9D extension as = trusted
    1. Add  =E2=80=9Ctrusted =3D = true=E2=80=9D  to =E2=80=9Cbloom.control=E2=80=9D file located = in  ${INSTALL_PATH}/share/extension/ 
    2. Contents = of bloom.control file after adding
      1. # bloom = extension
      2. comment =3D 'bloom access method - signature file based = index'
      3. default_version =3D '1.0'
      4. module_pathname =3D = '$libdir/bloom'
      5. relocatable =3D true
      6. trusted =3D= true
  3. Run the below commands in PSQL client = (attaching the commands with output)

test_db=3D> create = extension bloom;
CREATE EXTENSION
test_db=3D> drop extension bloom;
ERROR:  42501: must be superuser to = drop access methods
LOCATION:  RemoveAccessMethodById, = amcmds.c:130


Expected:

As the extension is marked as TRUSTED, if = superuser privilege is not necessary during the =E2=80=9Ccreate = extension=E2=80=9D then superuser privilege should not be required when = the owner of the extension drops it.

Why = this expectation:

According to the documentation referred = here
https://www.postgresql.org/docs/current/sql-createextension.html the following is observed.

=E2=80=9C=E2=80=9D=E2=80=9D
The user who runs = CREATE EXTENSION becomes the owner of the extension for purposes of = later privilege checks, and normally also becomes the owner of any = objects created by the extension's script.
=E2=80=9C=E2=80=9D=E2=80=9D

if the = user is the owner of the extension then it is expected that the access = methods created during the extension installation should be under the = same user=E2=80=99s ownership and there should not be an error when = dropping the extension.




Thank you,


Best,
Harinath

= --Apple-Mail=_86DE46FF-0561-4CDE-B995-A9B76AEB5B49--