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 1hf8j3-00024G-7N for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Jun 2019 20:04:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hf8j2-0006Ls-2R for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Jun 2019 20:04:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hf8j1-0006Ll-JS for pgsql-hackers@lists.postgresql.org; Sun, 23 Jun 2019 20:04:31 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hf8ix-0004LI-Py for pgsql-hackers@postgresql.org; Sun, 23 Jun 2019 20:04:29 +0000 Received: by mail-wr1-x443.google.com with SMTP id n9so11660325wru.0 for ; Sun, 23 Jun 2019 13:04:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=6k7/soDf/zY7ea1u0x241bCd1LspOeCsGfHxhgT5HZM=; b=QY9WXEevC/nUGeFQav2etP3lgSY32MEeP/5XLp30G6EeaoyHKivTZ6s+gifT66m+VH b9IYjOIWEmFdB400yf+ZqUOqMNfn/63c+H7K5MWwRUCzmWah/N36W6vd2jvPaO/HquB1 5u5PSol5VlTdbBe9ONWG9auBYCzZPWmHsuGUMPeNft98cfw2O3WTJcOLbMWQOsUHjY0t UdV2wWDbrmrnTkwtQtvZBBAkGsxu0V8mcgX31c1NNGtzajekyvbxCwWuGUYnsjtOq8g3 noP+UYjYelYuG4qpc56LPWzAAGBSlc7KDMOnyiaSjDJb1pRdqdtVLRabEvcpHI0rPXiA pZIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=6k7/soDf/zY7ea1u0x241bCd1LspOeCsGfHxhgT5HZM=; b=BeLW5kgoB2vLHZPEiWyKxy4x8MNa969IGix9Ej8B77OHU2QsXhxtK1W2AvGP1Atu7h CuPI//qhVjKL9DnWr1yWBjitk/bNlF2qFC0dabzF923CHXGKN13lF7OFNRc5/U7oOd6n M3/eLRD85ppMvbAjesKZ5OI4b3uf/SNoxq/BsEv3vZ4lfX4KSGRQd+5deadAstO6GyIC B+z3oTw603lnYoL6Jiw8rm9kaZanlW0XBt24MHMRQH+mfyhvvSWWLCt+xZiPYtmViRAd ueLcnXy/txhJEFsV41xtTODEpgqi/NKpvxk7CFRFY7KHHCFATggEBlzUmn6rq9HMwxMd +Zmg== X-Gm-Message-State: APjAAAXlFIvUxRZT5LHVwTq5h06He/Bnnp32amFyKLjhiwh+RIeqlxdu ONDCXwpkfCsAMGHWcaMrSPU10Q== X-Google-Smtp-Source: APXvYqxH+OEOo1m9yI/RtPxpTzKWZH9mpZzQRn5vLRlGzsAAgUQjdOfN6LKIfRbfodC3TULf/7TZOQ== X-Received: by 2002:adf:cf0a:: with SMTP id o10mr28037607wrj.37.1561320265593; Sun, 23 Jun 2019 13:04:25 -0700 (PDT) Received: from localhost (ip-86-49-253-160.net.upcbroadband.cz. [86.49.253.160]) by smtp.gmail.com with ESMTPSA id 5sm19396435wrc.76.2019.06.23.13.04.22 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 23 Jun 2019 13:04:22 -0700 (PDT) Date: Sun, 23 Jun 2019 22:04:20 +0200 From: Tomas Vondra To: Dean Rasheed Cc: PostgreSQL Hackers Subject: Re: Multivariate MCV stats can leak data to unprivileged users Message-ID: <20190623200420.g5fdq54yz5f33wd3@development> References: <20190513223605.lwj65akict3tpetv@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716-1444-295967 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, Jun 23, 2019 at 06:56:53PM +0100, Dean Rasheed wrote: >On Mon, 13 May 2019 at 23:36, Tomas Vondra wrote: >> >> On Fri, May 10, 2019 at 10:19:44AM +0100, Dean Rasheed wrote: >> >While working on 1aebfbea83c, I noticed that the new multivariate MCV >> >stats feature suffers from the same problem, and also the original >> >problems that were fixed in e2d4ef8de8 and earlier --- namely that a >> >user can see values in the MCV lists that they shouldn't see (values >> >from tables that they don't have privileges on). >> > >> >I think there are 2 separate issues here: >> > >> >1). The table pg_statistic_ext is accessible to anyone, so any user >> >can see the MCV lists of any table. I think we should give this the >> >same treatment as pg_statistic, and hide it behind a security barrier >> >view, revoking public access from the table. >> > >> >2). The multivariate MCV stats planner code can be made to invoke >> >user-defined operators, so a user can create a leaky operator and use >> >it to reveal data values from the MCV lists even if they have no >> >permissions on the table. >> > >> >Attached is a draft patch to fix (2), which hooks into >> >statext_is_compatible_clause(). >> > >> >> I think that patch is good. >> > >I realised that we forgot to push this second part, so I've just done so. > Whoops! Too many patches in this thread. Thanks for noticing. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services