pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: How easy is it to lose permissions in 'public' schema?
Date: Mon, 11 Apr 2022 17:10:27 -0600
Message-ID: <cfb9204f-5f46-5078-294b-a4a090f2bf7e@gmail.com> (raw)

I'm using postgres 14 in a database recently brought over from postgres 
10.  (I did not do the bringing over.)

In my set-up, I partition datasets by schema, create a role per schema 
and part of that is this explicit permission granting (from superuser):

    p\g
    grant all on all tables in schema base, bulk, sgstemplate to
    sgstemplate\p\g
    --where sgstemplate is sedded to the real deal by the installer

there is no explicit 'public' in that set-up and here-to-fore the new 
grantee has been able to see into public stuff just fine, in particular 
to public functions which rely on getting grantee's version of tables 
(replicated in sister schema).

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've run those grants specifically naming public and all is well. Do I 
need to add that to the installer script?

view thread (5+ messages)  latest in thread

Message-ID: <cfb9204f-5f46-5078-294b-a4a090f2bf7e@gmail.com>
Permalink:  ../cfb9204f-5f46-5078-294b-a4a090f2bf7e@gmail.com/
Also on:    postgresql.org/message-id/cfb9204f-5f46-5078-294b-a4a090f2bf7e@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
  Subject: Re: How easy is it to lose permissions in 'public' schema?
  In-Reply-To: <cfb9204f-5f46-5078-294b-a4a090f2bf7e@gmail.com>
  References: <cfb9204f-5f46-5078-294b-a4a090f2bf7e@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