Alter Default Privileges Does Not Work For Functions

Поиск
Список
Период
Сортировка
От David Johnston
Тема Alter Default Privileges Does Not Work For Functions
Дата
Msg-id 02b401cbcc94$bfb16050$3f1420f0$@yahoo.com
обсуждение исходный текст
Ответы Re: Alter Default Privileges Does Not Work For Functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general

After creating and logging into a new database run this script.   The initial ALTER DEFAULT PRIVILEGES should make all users unable to execute functions unless given explicit permissions elsewhere.  However, the first call to “testfunc()” succeeds.  When I explicitly REVOKE ALL for the specific function (or all functions in schema) and roles I DO get a permission denied exception as expected.   For those that read the other thread I had assumed PUBLIC had its EXECUTE privileges revoked due to executing the ALTER DEFAULT statement. It apparently did not and thus all users were still able to execute functions via PUBLIC even if their explicit role had execute revoked.

 

SET ROLE postgres;

 

CREATE ROLE impotent;

 

ALTER DEFAULT PRIVILEGES

IN SCHEMA public

REVOKE ALL ON FUNCTIONS

FROM PUBLIC, impotent;

 

CREATE FUNCTION testfunc() RETURNS boolean AS $$

BEGIN

      RETURN true;

END;

$$ LANGUAGE 'plpgsql';

 

SET ROLE impotent;

 

SELECT testfunc(); -- SUCCEEDES

 

SET ROLE postgres;

 

REVOKE ALL ON ALL FUNCTIONS IN SCHEMA public FROM PUBLIC, impotent;

 

SET ROLE impotent;

 

SELECT testfunc(); --FAILS

 

David J

 

В списке pgsql-general по дате отправления:

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: SELECT INTO array[i] with PL/pgSQL
Следующее
От: deepak
Дата:
Сообщение: Building extensions on Windows using VS2008