Re: Restrict postgres_fdw/dblink passfile to user mappings

From: Stepan Neretin <slpmcf(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Restrict postgres_fdw/dblink passfile to user mappings
Date: 2026-11-28 20:03:17
Message-ID: CA+Yyo5SQTHnsxKNgxVVQomkZc+rJ1ZokhtHN_EL=Vix_z-NDsQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Nov 29, 2026 at 2:43 AM Stepan Neretin <slpmcf(at)gmail(dot)com> wrote:

> Hi,
>
> password is a USER MAPPING option because libpq marks it with
> dispchar '*'. passfile is not marked that way, so postgres_fdw and
> dblink treat it as a FOREIGN SERVER option instead.
>
> That puts the password file path into srvoptions, which are broadly
> readable. Attached makes passfile user mapping only and
> superuser only, and rejects a leftover server side passfile at
> connect time. Same idea as keeping secrets out of srvoptions,
> in the spirit of the servicefile revert, just for placement.
>
> I left passfile in the libpqsrv proxy allowlist on purpose. That
> safelist still blesses it (like sslcert), and Sehrope noted passfile
> does not have the /dev/zero hang that servicefile did [1].
> Docs deferred.
>
> Regards,
> Stepan Neretin
>
> [1]
> https://postgr.es/m/CAH7T-aq+U6GDPO8mr3Gga3KzxGpAE=BSLb38x+R8fvWjzF-H8w@mail.gmail.com
>

Hi,

CFBot failed on kerberos/001_auth because that test still put
passfile on the foreign server. Attached v1 moves it to the
user mapping. No other change.

Regards,
Stepan Neretin

Attachment Content-Type Size
v1-0001-Make-postgres_fdw-dblink-passfile-a-user-mapping-option.patch text/x-patch 16.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Stepan Neretin 2026-11-28 19:43:23 Restrict postgres_fdw/dblink passfile to user mappings