BUG #11552: Trigger functions (but not funcs in trigger or rule conditions) are called regardless their privs - Mailing list pgsql-bugs

From bashtanov@imap.cc
Subject BUG #11552: Trigger functions (but not funcs in trigger or rule conditions) are called regardless their privs
Date
Msg-id 20141002084208.2543.34215@wrigleys.postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      11552
Logged by:          Alexey Bashtanov
Email address:      bashtanov@imap.cc
PostgreSQL version: 9.3.4
Operating system:   CentOS 6.5
Description:

Hello!

Actions I performed:
0. login as user repl (I have one)
1. create a table "x", reassign it to ro user
2. create a function foo() owned by repl
3. create a trigger after insert on x for each row execute foo()
4. make the function foo() not callable by anyone (revoke execute from
public and from repl)
5. login as ro
6. try to insert into x. It works, trigger is fired (!)
7. login as repl
8. make the function foo() callable by repl
9. drop the existing trigger, create another one similar but with condition
`when (foo() is null)`
10. make the function foo() not callable by anyone
11. login as ro
12. try to insert into x. It does not work, trigger is not fired because it
cannot call foo()

The behavior in pp. 6, 12 is pretty strange, namely that it is different in
these two situations.
At least this should be mentioned in docs.

Regards, Alexey

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Unreliable results returned with PostgreSQL Spatial query?
Next
From: eric@wadhome.org
Date:
Subject: BUG #11551: copy and paste issues in pgadmin SQL editor