Re: Facility for detecting insecure object naming

From: Nico Williams <nico(at)cryptonector(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Facility for detecting insecure object naming
Date: 2018-08-11 20:32:23
Message-ID: 20180811203221.GF5695@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 11, 2018 at 12:47:05PM -0700, Noah Misch wrote:
> -- (3) "SET search_path" with today's code.
> --
> -- Security and reliability considerations are the same as (2). Today, this
> -- reduces performance by suppressing optimizations like inlining.

Out of curiosity, why does this suppress inlining?

Anyways, my preference would be to have syntax by which to say: resolve
at declaration time using the then-in-effect search_path and store
as-qualified. This could just be SET search_path without an assignment.

CREATE FUNCTION ... AS $$ ... $$ SET search_path;

Another possibility would be to have a way to set a search_path for all
expressions in a given schema, something like:

SET SCHEMA my_schema DEFAULT search_path = ...;

which would apply to all expressions in schema elements in schema
"my_schema":

- CHECK expressions
- INDEX expressions
- VIEWs and MATERIALIZED VIEWs
- FUNCTION and STORED PROCEDURE bodies
- ...

CREATE SCHEMA IF NOT EXISTS my_schema;

SET SCHEMA my_schema DEFAULT search_path = my_schema, my_other_schema;

CREATE OR REPLACE FUNCTION foo() ... AS $$ ... $$;

...

Nico
--

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nico Williams 2018-08-11 20:35:14 Re: Facility for detecting insecure object naming
Previous Message Noah Misch 2018-08-11 19:47:05 Re: Facility for detecting insecure object naming