From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | 高 云龙 <gaoyunlong(at)biss(dot)com> |
Cc: | "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: A function privilege problem |
Date: | 2019-07-23 16:50:40 |
Message-ID: | 5305.1563900640@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
=?gb2312?B?uN8g1MbB+g==?= <gaoyunlong(at)biss(dot)com> writes:
> Hi ,my postgresql is 11.1 and find a problem about the execute privilege
> Now I have a new db user and a UDF. The function¡¯s body is update a table
> When I run grant update on table xxx to the new user, find that i can execute the function and don¡¯t report "Execute permission for functions<https://www.postgresql.org/message-id/4C2BBAEA.6040805%40gmail.com> xxx¡±£¬Is this right£¿
This is not a bug. Per the GRANT manual page [1]:
PostgreSQL grants default privileges on some types of objects to
PUBLIC. No privileges are granted to PUBLIC by default on tables,
table columns, sequences, foreign data wrappers, foreign servers,
large objects, schemas, or tablespaces. For other types of objects,
the default privileges granted to PUBLIC are as follows: CONNECT and
TEMPORARY (create temporary tables) privileges for databases;
EXECUTE privilege for functions and procedures; and USAGE privilege
for languages and data types (including domains). The object owner
can, of course, REVOKE both default and expressly granted
privileges. (For maximum security, issue the REVOKE in the same
transaction that creates the object; then there is no window in which
another user can use the object.) Also, these initial default
privilege settings can be changed using the ALTER DEFAULT PRIVILEGES
command.
So the new user is making use of the default grant of EXECUTE to PUBLIC.
If you don't want that, revoke execute privilege on that function from
PUBLIC and then grant it to just the users who should be allowed to call
the function.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2019-07-23 17:52:04 | Re: BUG #15922: Simple select with multiple exists filters returns duplicates from a primary key field |
Previous Message | PG Bug reporting form | 2019-07-23 16:48:16 | BUG #15922: Simple select with multiple exists filters returns duplicates from a primary key field |