pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michel Pelletier <pelletier.michel@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Hiding a GUC from SQL
Date: Wed, 17 Jun 2020 18:55:25 -0400
Message-ID: <1513794.1592434525@sss.pgh.pa.us> (raw)
In-Reply-To: <CACxu=vJhoXdtMKJR+Pc0T=4UknLYUKQzKJhwwBnJbemQwN1d0w@mail.gmail.com>
References: <CACxu=vJhoXdtMKJR+Pc0T=4UknLYUKQzKJhwwBnJbemQwN1d0w@mail.gmail.com>

Michel Pelletier <pelletier.michel@gmail.com> writes:
> In my extension pgsodium I'm defining a custom variable at startup to store
> a key:

> https://github.com/michelp/pgsodium/blob/master/src/pgsodium.c#L1107

> I'm using the flags GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE
> | GUC_DISALLOW_IN_FILE, and a custom "no show" show hook that obscures the
> value.  This idea was inspired from the pgcryptokey module from Bruce
> Momjian.

I guess I'm wondering why you're making it a GUC at all, if you don't
want any of the GUC facilities to apply.

As far as I can think at the moment, putting in a no-op show hook
is sufficient to prevent the value from being seen at the SQL level.
However, it's far from clear that doing that isn't going to have
negative side-effects; it'll possibly also break other things like
GUC save/restore (eg rolling back when a transaction fails).

It seems like if you want to be this paranoid, you'd be better off
not exposing the variable to the GUC machinery in the first place.
You could use a custom set-function (like setseed) to replace the one
bit of functionality you do want.

			regards, tom lane





view thread (9+ messages)  latest in thread

Message-ID: <1513794.1592434525@sss.pgh.pa.us>
Permalink:  ../1513794.1592434525@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1513794.1592434525@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, pelletier.michel@gmail.com
  Subject: Re: Hiding a GUC from SQL
  In-Reply-To: <1513794.1592434525@sss.pgh.pa.us>
  References: <CACxu=vJhoXdtMKJR+Pc0T=4UknLYUKQzKJhwwBnJbemQwN1d0w@mail.gmail.com> <1513794.1592434525@sss.pgh.pa.us>

* 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