Re: [HACKERS] Re: Fw: Isn't pg_statistic a security hole - Solution Proposal

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Joe Conway <joe(at)conway-family(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: [HACKERS] Re: Fw: Isn't pg_statistic a security hole - Solution Proposal
Date: 2001-06-12 01:44:53
Message-ID: 200106120144.f5C1irv10582@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Your patch has been added to the PostgreSQL unapplied patches list at:

http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

> > I have just thought of a possible compromise. Peter is right that we
> > don't want case conversion on table names that are extracted from
> > catalogs. But I think we do want it on table names expressed as string
> > literals. Could we make the assumption that table names in catalogs
> > will be of type 'name'? If so, it'd work to make two versions of the
> > has_table_privilege function, one taking type "name" and the other
> > taking type "text". The "name" version would take its input as-is,
> > the "text" version would do case folding and truncation. This would
> > work transparently for queries selecting relation names from the system
> > catalogs, and it'd also work transparently for queries using unmarked
> > string literals (which will be preferentially resolved as type "text").
> > Worst case if the system makes the wrong choice is you throw in an
> > explicit coercion to name or text. Comments?
>
> OK -- here's take #5.
>
> It "make"s and "make check"s clean against current cvs tip.
>
> There are now both Text and Name variants, and the regression test support
> is rolled into the patch. Note that to be complete wrt Name based variants,
> there are now 12 user visible versions of has_table_privilege:
>
> has_table_privilege(Text usename, Text relname, Text priv_type)
> has_table_privilege(Text usename, Name relname, Text priv_type)
> has_table_privilege(Name usename, Text relname, Text priv_type)
> has_table_privilege(Name usename, Name relname, Text priv_type)
> has_table_privilege(Text relname, Text priv_type) /* assumes current_user */
> has_table_privilege(Name relname, Text priv_type) /* assumes current_user */
> has_table_privilege(Text usename, Oid reloid, Text priv_type)
> has_table_privilege(Name usename, Oid reloid, Text priv_type)
> has_table_privilege(Oid reloid, Text priv_type) /* assumes current_user */
> has_table_privilege(Oid usesysid, Text relname, Text priv_type)
> has_table_privilege(Oid usesysid, Name relname, Text priv_type)
> has_table_privilege(Oid usesysid, Oid reloid, Text priv_type)
>
> For the Text based inputs, a new internal function, get_Name is used
> (shamelessly copied from get_seq_name in sequence.c) to downcase if not
> quoted, or remove quotes if quoted, and truncate. I also added a few test
> cases for the downcasing, quote removal, and Name based variants to the
> regression test.
>
> Only thing left (I hope!) is documentation. I'm sure I either have or can
> get the DocBook tools, but I've never used them. Would it be simpler to
> clone and hand edit one of the existing docs? Any suggestions to get me
> started?
>
> Thanks,
>
> -- Joe
>
>
>
>
>
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-06-12 01:45:31 Re: [HACKERS] Re: Fw: Isn't pg_statistic a security hole - Solution Proposal
Previous Message Alex Pilosov 2001-06-12 01:29:39 [PATCH] addition of text_inet, text_cidr and inet_set_masklen

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2001-06-12 01:45:31 Re: [HACKERS] Re: Fw: Isn't pg_statistic a security hole - Solution Proposal
Previous Message Bruce Momjian 2001-06-11 22:52:52 Re: Australian timezone configure option