prevent non-superuser terminate bgworker running as superuser - Mailing list pgsql-hackers

From Hemanth Sandrana
Subject prevent non-superuser terminate bgworker running as superuser
Date
Msg-id CAAB6CY5H7Yp3jfMWP25tA0AMYbY5eSogS7GNbGEXN0KRmmxy1g@mail.gmail.com
Whole thread Raw
Responses Re: prevent non-superuser terminate bgworker running as superuser
List pgsql-hackers
Hi All,

Currently, BackgroundWorker connected to a database by calling
BackgroundWorkerInitializeConnection with username as NULL can be
terminated by non-superuser with pg_signal_backend privilege. When the
username is NULL the bgworker process runs as superuser (which is
expected as per the documentation -
https://www.postgresql.org/docs/current/bgworker.html ), but can the
non-superuser (with pg_signal_backend) terminate this superuser owned
process?
We (Mahendrakar and Myself) think that this is a bug and proposing a
fix that sets MyProc->roleId to BOOTSTRAP_SUPERUSERID, similar to
InitializeSessionUserId, to prevent non-superuser terminating it.

Please let us know your comments.

Thanks,
Hemanth Sandrana

Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: controlling meson's parallelism (and some whining)
Next
From: Robert Haas
Date:
Subject: Re: New WAL record to detect the checkpoint redo location