Re: allow building trusted languages without the untrusted versions

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: allow building trusted languages without the untrusted versions
Date: 2022-05-25 17:49:40
Message-ID: 20220525174940.GQ9030@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greetings,

* Nathan Bossart (nathandbossart(at)gmail(dot)com) wrote:
> I guess I'd ask again whether we can do both... We've got predefined roles
> like pg_execute_server_program that allow access to COPY TO/FROM PROGRAM,
> but I have no way to categorically disable that ѕort of thing if I wanted
> to really lock things down, even for superusers. I'm not suggesting that
> every predefined role needs a corresponding configure option, but basic
> things like arbitrary disk/network/program access seem like reasonable
> proposals.

Locking things down "even for superuser" is something we've very
explicitly said we're not going to try and do. Even with v1 functions,
the ability to hack around with pg_proc strikes me as almost certainly
going to provide a way for someone to gain enough control of execution
to be able to 'break out', not to mention obvious other things like
ALTER SYSTEM to change archive_command to run whatever shell commands an
attacker with superuser wants to..

> I have about 50% of a generic --disable-disk-access patch coded up which
> I'll share soon to help inform the discussion.

Do you disable the ability of superusers to use ALTER SYSTEM with this?

I really don't think this is going to be anywhere near as
straight-forward as it might appear to be to prevent a superuser from
being able to break out of PG. Instead, we should be moving in the
direction of making it so that there doesn't need to be a superuser
that's ever logged into except under serious emergency situations where
the system is built to require multi-person access to do so.

Thanks,

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-05-25 18:28:31 Re: allow building trusted languages without the untrusted versions
Previous Message Zhihong Yu 2022-05-25 16:34:51 Re: adding status for COPY progress report