pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add option to bgworkers to allow the bypass of role login check
Date: Thu, 12 Oct 2023 00:26:17 +0000
Message-ID: <E1qqjWr-0004Q3-CF@gemulon.postgresql.org> (raw)

Add option to bgworkers to allow the bypass of role login check

This adds a new option called BGWORKER_BYPASS_ROLELOGINCHECK to the
flags available to BackgroundWorkerInitializeConnection() and
BackgroundWorkerInitializeConnectionByOid().

This gives the possibility to bgworkers to bypass the role login check,
making possible the use of a role that has no login rights while not
being a superuser.  PostgresInit() gains a new flag called
INIT_PG_OVERRIDE_ROLE_LOGIN, taking advantage of the refactoring done in
4800a5dfb4c4.

Regression tests are added to worker_spi to check the behavior of this
new option with bgworkers.

Author: Bertrand Drouvot
Reviewed-by: Nathan Bossart, Michael Paquier, Bharath Rupireddy
Discussion: https://postgr.es/m/bcc36259-7850-4882-97ef-d6b905d2fc51@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e7689190b3d58404abbafe2d3312c3268a51cca3

Modified Files
--------------
doc/src/sgml/bgworker.sgml                      |  3 +++
src/backend/postmaster/postmaster.c             |  6 +++++
src/backend/utils/init/miscinit.c               |  4 ++--
src/backend/utils/init/postinit.c               |  6 +++--
src/include/miscadmin.h                         |  4 +++-
src/include/postmaster/bgworker.h               |  6 +++--
src/test/modules/worker_spi/t/001_worker_spi.pl | 30 +++++++++++++++++++++++++
src/test/modules/worker_spi/worker_spi.c        |  2 ++
8 files changed, 54 insertions(+), 7 deletions(-)



Message-ID: <E1qqjWr-0004Q3-CF@gemulon.postgresql.org>
Permalink:  ../E1qqjWr-0004Q3-CF@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qqjWr-0004Q3-CF@gemulon.postgresql.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add option to bgworkers to allow the bypass of role login check
  In-Reply-To: <E1qqjWr-0004Q3-CF@gemulon.postgresql.org>

* 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