[sepgsql 3/3] Add db_procedure:execute permission checks

Lists: pgsql-hackers
From: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
To: PgHacker <pgsql-hackers(at)postgresql(dot)org>
Subject: [sepgsql 3/3] Add db_procedure:execute permission checks
Date: 2013-01-15 20:46:46
Message-ID: CADyhKSXCQREbxZhfz-p2txu1WXpq+sVdJEF5Z71+rhyX3iV-YA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

This patch adds sepgsql support for permission checks almost
equivalent to the existing FUNCTION EXECUTE privilege.

This feature is constructed on new OAT_FUNCTION_EXEC event
type being invoked around pg_proc_aclcheck() except for cases
when function's permissions are checked during CREATE or
ALTER commands. (Extension can handle these cases on
OAT_POST_CREATE or OAT_POST_ALTER hooks if needed.)

This patch assumes db_schema:{search} patch is applied on top.
So, please also check the patches below...
https://commitfest.postgresql.org/action/patch_view?id=1003
https://commitfest.postgresql.org/action/patch_view?id=1065

Thanks,
--
KaiGai Kohei <kaigai(at)kaigai(dot)gr(dot)jp>

Attachment Content-Type Size
sepgsql-v9.3-function-execute-permission.v1.patch application/octet-stream 22.7 KB

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
Cc: PgHacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [sepgsql 3/3] Add db_procedure:execute permission checks
Date: 2013-04-10 23:49:50
Message-ID: 20130410234950.GW3751@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Kohei KaiGai wrote:
> This patch adds sepgsql support for permission checks almost
> equivalent to the existing FUNCTION EXECUTE privilege.

While skimming this patch I noticed that you're using
getObjectDescription() as the "audit_name" of objects. This may be a
bit unstable, for example consider that it's translated if lc_messages
is set to something other than english. I would suggest that the object
identity as introduced by commit f8348ea32ec8 is a better choice for
this.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: PgHacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [sepgsql 3/3] Add db_procedure:execute permission checks
Date: 2013-04-11 16:10:35
Message-ID: CADyhKSXMTqndbcEuSXspyJdirFL36DHYGaBowUfcrPRMgVJj8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2013/4/11 Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>:
> Kohei KaiGai wrote:
>> This patch adds sepgsql support for permission checks almost
>> equivalent to the existing FUNCTION EXECUTE privilege.
>
> While skimming this patch I noticed that you're using
> getObjectDescription() as the "audit_name" of objects. This may be a
> bit unstable, for example consider that it's translated if lc_messages
> is set to something other than english. I would suggest that the object
> identity as introduced by commit f8348ea32ec8 is a better choice for
> this.
>
Thanks for your suggestion.

I tried to replace getObjectDescription() by getObjectIdentity() almost
mechanically, even though I had to put special handling around
OAT_POST_CREATE hook, as existing code doing, because
SnapshotNow cannot reference the new object just after creation.

Even though it massively affects regression test results, my preference
is the format using getObjectIdentity(), because audit log is not assumed
being read by human eyes usually. Thus, newer one is kindness style
for script developers to put just an identifier of object into "name" field
of audit log, without anything else.

Best regards,
--
KaiGai Kohei <kaigai(at)kaigai(dot)gr(dot)jp>

Attachment Content-Type Size
sepgsql-v9.3-replace-get-object-description.v1.patch application/octet-stream 125.5 KB