pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: How easy is it to lose permissions in 'public' schema?
Date: Mon, 11 Apr 2022 19:34:46 -0600
Message-ID: <690DFCF7-E684-4BA9-B9DD-D7A5BFBF5FA7@gmail.com> (raw)
In-Reply-To: <d81bd77e-be7f-0b53-1089-882ce2edf0ac@aklaver.com>
References: <d81bd77e-be7f-0b53-1089-882ce2edf0ac@aklaver.com>



> On Apr 11, 2022, at 6:51 PM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
> 
> On 4/11/22 17:34, Tom Lane wrote:
>> Adrian Klaver <adrian.klaver@aklaver.com> writes:
>>>> On 4/11/22 16:10, Rob Sargent wrote:
>>>>> I've just bumped into this.
>>>>> 
>>>>> barnard=> select public.genome_threshold_mono('a'::text,'b'::text);
>>>>> ERROR:  permission denied for schema public
>>>>> LINE 1: select public.genome_threshold_mono('a'::text,'b'::text);
>>>>> 
>>>>> I know I haven't intentionally removed 'public' from grantee's purview
>>>>> and short of the code block above not actually getting run, any guesses
>>>>> as to how access to 'public' got removed from grantee?
>>> I'm going to say someone read this:
>>> https://wiki.postgresql.org/wiki/A_Guide_to_CVE-2018-1058:_Protect_Your_Search_Path
>>> And did something along the line of this:
>>> REVOKE CREATE ON SCHEMA public FROM PUBLIC;
>> Note that that only recommends removing CREATE, though, not USAGE
>> which is what Rob seems to be lacking.
> 
> Yeah that is why I threw in the 'And did something along the line of this' and the 'Probably should take a look at what permissions the functions in public have?'. I'm guessing someone saw the release notes for 10.3(https://www.postgresql.org/docs/10/release-10-3.html) and the comments on the mailing list and got proactive.
> 
>>            regards, tom lane
> 
Gentlemen,thank you. 

Something similar to as described is a definite possibility during the ‘bringing over’. Same time one of the brought over dbs was imported twice without constraints etc. I love being looked after.
Cheers,
rjs

> 
> -- 
> Adrian Klaver
> adrian.klaver@aklaver.com

view thread (5+ messages)

Message-ID: <690DFCF7-E684-4BA9-B9DD-D7A5BFBF5FA7@gmail.com>
Permalink:  ../690DFCF7-E684-4BA9-B9DD-D7A5BFBF5FA7@gmail.com/
Also on:    postgresql.org/message-id/690DFCF7-E684-4BA9-B9DD-D7A5BFBF5FA7@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: robjsargent@gmail.com, adrian.klaver@aklaver.com, tgl@sss.pgh.pa.us
  Subject: Re: How easy is it to lose permissions in 'public' schema?
  In-Reply-To: <690DFCF7-E684-4BA9-B9DD-D7A5BFBF5FA7@gmail.com>
  References: <d81bd77e-be7f-0b53-1089-882ce2edf0ac@aklaver.com> <690DFCF7-E684-4BA9-B9DD-D7A5BFBF5FA7@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox