Re: pgsql: Fix search_path to a safe value during maintenance operations. - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: pgsql: Fix search_path to a safe value during maintenance operations.
Date
Msg-id 43bbc9f7318057f51552d5986830908cb018dadf.camel@j-davis.com
Whole thread Raw
In response to Re: pgsql: Fix search_path to a safe value during maintenance operations.  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: pgsql: Fix search_path to a safe value during maintenance operations.
List pgsql-hackers
On Thu, 2023-06-29 at 11:19 -0400, Robert Haas wrote:
> Yeah. I mean, as things stand, it seems like giving someone the
> MAINTAIN privilege will be sufficient to allow them to escalate to
> the
> table owner if there are any expression indexes involved. That seems
> like a real problem. We shouldn't ship a new feature with a built-in
> security hole like that.

Let's take David's suggestion[1] then, and only restrict the search
path for those without owner privileges on the object.

That would mean no behavior change unless using the MAINTAIN privilege,
which is new, so no breakage. And if someone is using the MAINTAIN
privilege, they wouldn't be able to abuse the search_path, so it would
close the hole.

Patch attached (created a bit quickly, but seems to work).

Regards,
    Jeff Davis

[1]
https://postgr.es/m/CAKFQuwaVJkM9u%2BqpOaom2UkPE1sz0BASF-E5amxWPxncUhm4Hw%40mail.gmail.com


Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Changing types of block and chunk sizes in memory contexts
Next
From: Tom Lane
Date:
Subject: Re: pgsql: Fix search_path to a safe value during maintenance operations.