pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Willy-Bas Loos <willybas@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: logical replication worker can't find postgis function
Date: Fri, 22 Apr 2022 15:39:33 +0200
Message-ID: <a833958a10decb79dc6724595e0eafae2733af53.camel@cybertec.at> (raw)
In-Reply-To: <CAHnozTj+sGSsfGHUn-a0p2fN4-ov4yri9dPHgkBAk5972btE-Q@mail.gmail.com>
References: <CAHnozTipziSK=QxKwQ9OF+AhcgTwUVWziZeqhx8tkCovQ_3Xsw@mail.gmail.com>
	<8d54fcdc3ea562e2fd1ada68997aa7377bda5187.camel@cybertec.at>
	<CAHnozTj+sGSsfGHUn-a0p2fN4-ov4yri9dPHgkBAk5972btE-Q@mail.gmail.com>

On Fri, 2022-04-22 at 15:26 +0200, Willy-Bas Loos wrote:
> On Fri, Apr 22, 2022 at 3:20 PM Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> > 
> > The trigger function is bad and dangerous, because it relies on the current setting of "search_path".
> > 
> > You notice that with logical replication, because "search_path" is empty to avoid security problems.
> 
> Thanks a lot!
> Do you mean that all trigger functions are bad and dangerous, or just mine?
> Do you have any suggestions for an alternative?

There is nothing wrong per se with using trigger functions.

But, to attempt a generic statement, any function that fails if you change "search_path"
is a potential problem.

If your application makes sure that "search_path" is always set correctly, the problem
is smaller.

If highly privileged processes call the function, the problem becomes worse, because the
potential damage is bigger.

The best way to make sure nothing can happen is to create all functions with a
hard-wired "search_path".  Then nothing can go wrong.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






view thread (5+ messages)  latest in thread

Message-ID: <a833958a10decb79dc6724595e0eafae2733af53.camel@cybertec.at>
Permalink:  ../a833958a10decb79dc6724595e0eafae2733af53.camel@cybertec.at/
Also on:    postgresql.org/message-id/a833958a10decb79dc6724595e0eafae2733af53.camel@cybertec.at

 · 

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: laurenz.albe@cybertec.at, willybas@gmail.com
  Subject: Re: logical replication worker can't find postgis function
  In-Reply-To: <a833958a10decb79dc6724595e0eafae2733af53.camel@cybertec.at>
  References: <CAHnozTipziSK=QxKwQ9OF+AhcgTwUVWziZeqhx8tkCovQ_3Xsw@mail.gmail.com> <8d54fcdc3ea562e2fd1ada68997aa7377bda5187.camel@cybertec.at> <CAHnozTj+sGSsfGHUn-a0p2fN4-ov4yri9dPHgkBAk5972btE-Q@mail.gmail.com> <a833958a10decb79dc6724595e0eafae2733af53.camel@cybertec.at>

* 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