| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Isaac Morland <isaac(dot)morland(at)gmail(dot)com> |
| Cc: | jian he <jian(dot)universality(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Feike Steenbergen <feikesteenbergen(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: pg18: Virtual generated columns are not (yet) safe when superuser selects from them |
| Date: | 2025-06-03 03:30:08 |
| Message-ID: | 760856.1748921408@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Isaac Morland <isaac(dot)morland(at)gmail(dot)com> writes:
> On Mon, 2 Jun 2025 at 22:52, jian he <jian(dot)universality(at)gmail(dot)com> wrote:
> Do we consider INSERT associated with user defined function a security
>> bug?
> A very old issue for INSERT/UPDATE/DELETE, but until this patch not an
> issue for SELECT from a table (although if I understand correctly earlier
> discussion SELECT from a view can already be a problem).
Precisely.
> That being said I would like to see it corrected everywhere.
Yeah, one approach we could take here is to try to move the goalposts
for this whole topic, understanding that that will mean incompatible
changes as well as some performance loss. I'm not sure how many users
would be happy to take that tradeoff, but some would. Maybe two
different operating modes would make it an easier sell?
> My fix would
> be for check constraints, triggers, and view definitions to run as the
> owner of the object in question (constraint, trigger, or view or
> materialized view), essentially using the same facility as used to run
> security definer functions. Then, as an optimization only, skip actually
> doing the security definer stuff (which I understand to be slow) when it
> can be proven by the planner to be safe to do so (i.e., no difference in
> result).
I am interested to know how you think the planner could prove that.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Sami Imseih | 2025-06-03 03:31:25 | Re: track generic and custom plans in pg_stat_statements |
| Previous Message | Isaac Morland | 2025-06-03 03:03:17 | Re: pg18: Virtual generated columns are not (yet) safe when superuser selects from them |