Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hSQKu-0005MX-2Z for pgsql-hackers@arkaria.postgresql.org; Sun, 19 May 2019 18:15:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hSQKs-0000og-Rs for pgsql-hackers@arkaria.postgresql.org; Sun, 19 May 2019 18:15:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hSQKs-0000oY-JP for pgsql-hackers@lists.postgresql.org; Sun, 19 May 2019 18:15:02 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hSQKq-0006Pk-H9 for pgsql-hackers@postgresql.org; Sun, 19 May 2019 18:15:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x4JIEstj002510; Sun, 19 May 2019 14:14:54 -0400 From: Tom Lane To: Tomas Vondra cc: Dean Rasheed , Stephen Frost , Andres Freund , PostgreSQL Hackers Subject: Re: Multivariate MCV stats can leak data to unprivileged users In-reply-to: <20190519173845.tgf7ku3vigwgndn5@development> References: <4E0E0C14-C476-446A-835F-CC3558709DA9@anarazel.de> <20190518190042.2y33h4toxk4fxv5t@development> <568.1558208711@sss.pgh.pa.us> <20190518232812.qpnjmydlx3uzzsj7@development> <20866.1558223060@sss.pgh.pa.us> <20190518234841.GE6197@tamriel.snowman.net> <23229.1558275148@sss.pgh.pa.us> <23772.1558276123@sss.pgh.pa.us> <20190519173845.tgf7ku3vigwgndn5@development> Comments: In-reply-to Tomas Vondra message dated "Sun, 19 May 2019 19:38:45 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2508.1558289694.1@sss.pgh.pa.us> Date: Sun, 19 May 2019 14:14:54 -0400 Message-ID: <2509.1558289694@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tomas Vondra writes: > On Sun, May 19, 2019 at 10:28:43AM -0400, Tom Lane wrote: >> No, wait, scratch that. We could fold the three existing types >> pg_ndistinct, pg_dependencies, pg_mcv_list into one new type, say >> "pg_stats_ext_data", where the actual storage would need to have an >> ID field (so we'd waste a byte or two duplicating the externally >> visible stxkind field inside stxdata). The output function for this >> type is just a switch over the existing code. The big advantage of >> this way compared to the current approach is that adding a new >> ext-stats type requires *zero* work with adding new catalog entries. >> Just add another switch case in pg_stats_ext_data_out() and you're >> done. > The annoying thing is that this undoes the protections provided by special > data types generated only in internally. It's not possible to generate > e.g. pg_mcv_list values in user code (except for C code, at which points > all bets are off anyway). By abandoning this and reverting to bytea anyone > could craft a bytea and claim it's a statistic value. That would have been true of the original proposal, but not of this modified one. regards, tom lane