Re: security label support, part.2

From: KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: security label support, part.2
Date: 2010-07-23 00:58:11
Message-ID: 4C48E923.9050205@ak.jp.nec.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for your reviewing.

(2010/07/23 0:54), Robert Haas wrote:
> 2010/7/14 KaiGai Kohei<kaigai(at)ak(dot)jp(dot)nec(dot)com>:
>> The attached patch is a part of efforts to support security label
>> on database objects.
>
> This is similar to what I had in mind as a design for this feature,
> but I have some gripes:
>
> 1. I am inclined to suggest the syntax SECURITY LABEL ON ... IS ...,
> following COMMENT ON (it's also somewhat similar to the GRANT syntax).
> While the hook in ExecCheckRTPerms() will only allow meaningful
> permissions checks on the use of relations, there will presumably be
> ongoing demand to add additional hooks to cover other types of
> objects, and I'd rather add label support all at once rather than
> bit-by-bit. I also think that the SECURITY LABEL syntax is more
> future-proof; we don't need to worry about conflicts in other parts of
> the grammar.
>
Hmm. Indeed, we cannot deny the possibility to conflict with other part
in the future, if we use ALTER xxx statement here.

But, right now, we have no statement that starts in noun, rather than verb.
The "comment" is a noun, but "comment on" is a phrasal-verb, isn't it?

How about RELABEL <object> TO <label>, instead?

The "relabel" is a transitive-verb, we don't need "ON" between RELABEL
and <object>. And, it tries to change a property of the object, so
it seems to me "TO" is more appropriate than "IS".

> 2. Similarly, the design of the hook in secabel.h is way too
> short-sighted and won't scale to any other object type. We don't need
> or want one hook per object type here. Use an ObjectAddress.
>
I think the relation type is an exceptional object class, because of
the recursion due to the table inheritances.
For other object classes, I also think one security hook which takes
ObjectAddress as an argument is enough to implement.

So, I expect we need two hooks on relabeling eventually.
(One for relation, one for other object classes)

> 3. I am firmly of the view that we want to allow multiple security
> providers. I think the way this should work here is that we should
> keep a list somewhere of security providers known to the system, which
> loadable modules should add themselves to. Each such security
> provider should be represented by a struct containing, at least, a
> name and a function that gets called on relabel. The labels should be
> stored in the catalog. That way there is never any possibility of one
> security provider getting a label that was originally applied by some
> other security provider. If we were storing these labels in pg_class
> or pg_attribute or similar, the storage cost for this might be worth
> worrying about, but as this is a separate catalog, it's not.
>
What I'm worrying about is that we cannot estimate amount of works when
we expand the concept to row-level security. We will need to revise the
implementation, if individual user tuples have its security label in the
future version.
If we don't support multiple labels right now, it will not be feature
degradation, even if it will be hard to implement multiple label support
for each user tuples. :(

I don't deny worth of multiple security providers concurrently, however,
I doubt whether it should be supported from the beginning, or not.
It seems to me it is not too late after we can find out the way to label
individual user tuples.

Thanks,
--
KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-07-23 01:05:59 Re: security label support, part.2
Previous Message Robert Haas 2010-07-23 00:55:13 Re: [HACKERS] Trouble with COPY IN