Restrict postgres_fdw/dblink passfile to user mappings
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]/messages/by-id/CAH7T-aq+U6GDPO8mr3Gga3KzxGpAE=BSLb38x+R8fvWjzF-H8w@mail.gmail.com.
Docs deferred.
Regards,
Stepan Neretin
[1]: /messages/by-id/CAH7T-aq+U6GDPO8mr3Gga3KzxGpAE=BSLb38x+R8fvWjzF-H8w@mail.gmail.com
/messages/by-id/CAH7T-aq+U6GDPO8mr3Gga3KzxGpAE=BSLb38x+R8fvWjzF-H8w@mail.gmail.com
On Sun, Nov 29, 2026 at 2:43 AM Stepan Neretin <slpmcf@gmail.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]
/messages/by-id/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