Re: Add more sanity checks around callers of changeDependencyFor()
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Heikki Linnakangas <hlinnaka@iki.fi>, Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-07-08T04:41:13Z
Lists: pgsql-hackers
On Thu, Jul 06, 2023 at 10:09:20AM -0700, Andres Freund wrote:
> Well, it adds an exploitation opportunity. If other functions in the extension
> reference the original location (explicitly or via search_path), somebody else
> can create a function there, which might be called from a more privileged
> context. Obviously permissions limit the likelihood of this being a real
> issue.
Yeah..
> I also don't think pg_dump will dump the changed schema, which means a
> dump/restore leads to a different schema - IMO something to avoid.
Yes, you're right here. The function dumped is restored in the same
schema as the extension. For instance:
psql postgres << EOF
CREATE SCHEMA test_func_dep1;
CREATE SCHEMA test_func_dep2;
CREATE EXTENSION test_ext_req_schema1 SCHEMA test_func_dep1;
ALTER FUNCTION test_func_dep1.dep_req1() SET SCHEMA test_func_dep2;
EOF
pg_dump -f dump.sql postgres
createdb popo
psql -f dump.sql popo
psql -c '\dx+ test_ext_req_schema1' popo
Objects in extension "test_ext_req_schema1"
Object description
------------------------------------
function test_func_dep1.dep_req1()
(1 row)
I am honestly not sure how much restrictions we should have here, as
this could hurt anybody relying on the existing behavior, as well, if
there are any. (It seems that that schema modification restrictions
for extension objects would need to go through
ExecAlterObjectSchemaStmt().)
Anyway, I think that I'll just go ahead and fix the SET SCHEMA bug, as
that's wrong as it stands. Regarding these restrictions, perhaps
something could be done on HEAD, though it impacts usability IMO.
--
Michael
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add more sanity checks with callers of changeDependencyFor()
- 9b286858e3ab 17.0 landed
-
Fix ALTER EXTENSION SET SCHEMA with objects outside an extension's schema
- 914e72e6e8d3 11.21 landed
- 02021f1b2f65 12.16 landed
- f5b075adcf4c 13.12 landed
- 235e716bc24d 14.9 landed
- d1e0f408cbe2 15.4 landed
- 55c95f24cd7c 16.0 landed
- bd5ddbe8666a 17.0 landed