pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int
7+ messages / 4 participants
[nested] [flat]

* Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int
@ 2021-08-24 06:21 Li EF Zhang <bjzhangl@cn.ibm.com>
  2021-08-24 10:22 ` Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Laurenz Albe <laurenz.albe@cybertec.at>
  2021-08-25 03:51 ` RE: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Li EF Zhang <bjzhangl@cn.ibm.com>
  0 siblings, 2 replies; 7+ messages in thread

From: Li EF Zhang @ 2021-08-24 06:21 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

<div class="socmaildefaultfont" dir="ltr" style="font-family:Arial, Helvetica, sans-serif;font-size:10pt" ><div dir="ltr" >Hi,</div>
<div dir="ltr" >&nbsp;</div>
<div dir="ltr" >dict_int is trusted extension in pg13. After creating dict_int extension with unprivileged user, ALTER TEXT SEARCH DICTIONARY intdict ((MAXLEN = 7) failed.</div>
<div dir="ltr" >&nbsp;</div>
<div dir="ltr" >admin=&gt; ALTER TEXT SEARCH DICTIONARY intdict (MAXLEN = 7);<br>ERROR:&nbsp; must be owner of text search dictionary intdict</div>
<div dir="ltr" >&nbsp;</div>
<div dir="ltr" >This is by design or a bug? Thanks!</div>
<div dir="ltr" >&nbsp;</div>
<div dir="ltr" >Lily</div></div><BR>
<BR>





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int
  2021-08-24 06:21 Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Li EF Zhang <bjzhangl@cn.ibm.com>
@ 2021-08-24 10:22 ` Laurenz Albe <laurenz.albe@cybertec.at>
  1 sibling, 0 replies; 7+ messages in thread

From: Laurenz Albe @ 2021-08-24 10:22 UTC (permalink / raw)
  To: Li EF Zhang <bjzhangl@cn.ibm.com>; pgsql-general@lists.postgresql.org

On Tue, 2021-08-24 at 06:21 +0000, Li EF Zhang wrote:
> dict_int is trusted extension in pg13. After creating dict_int extension with
> unprivileged user, ALTER TEXT SEARCH DICTIONARY intdict ((MAXLEN = 7) failed.
>  
> admin=> ALTER TEXT SEARCH DICTIONARY intdict (MAXLEN = 7);
> ERROR:  must be owner of text search dictionary intdict
>  
> This is by design or a bug? Thanks!

You must be the owner of an object to ALTER it.  That is working as designed.

It is a bad idea to ALTER an object that belongs to an extension.
The next ALTER EXTENSION ... UPDATE may undo the change or fail.

Create your own dictionary with the same template.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* RE: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int
  2021-08-24 06:21 Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Li EF Zhang <bjzhangl@cn.ibm.com>
@ 2021-08-25 03:51 ` Li EF Zhang <bjzhangl@cn.ibm.com>
  2021-08-25 04:01   ` Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int David G. Johnston <david.g.johnston@gmail.com>
  1 sibling, 1 reply; 7+ messages in thread

From: Li EF Zhang @ 2021-08-25 03:51 UTC (permalink / raw)
  To: laurenz.albe@cybertec.at; +Cc: pgsql-general@lists.postgresql.org

<div class="socmaildefaultfont" dir="ltr" style="font-family:Arial, Helvetica, sans-serif;font-size:10pt" ><div dir="ltr" >Thanks for your answer. My doubt is that since an ordinary user creates the extension, shouldn't be this user the owner of the objects created within the extension?</div>
<div dir="ltr" >&nbsp;</div>
<blockquote data-history-content-modified="1" dir="ltr" style="border-left:solid #aaaaaa 2px; margin-left:5px; padding-left:5px; direction:ltr; margin-right:0px" >----- Original message -----<br>From: "Laurenz Albe" &lt;laurenz.albe@cybertec.at&gt;<br>To: "Li EF Zhang" &lt;bjzhangl@cn.ibm.com&gt;, pgsql-general@lists.postgresql.org<br>Cc:<br>Subject: [EXTERNAL] Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int<br>Date: Tue, Aug 24, 2021 6:23 PM<br>&nbsp;
<div><font size="2" face="Default Monospace,Courier New,Courier,monospace" >On Tue, 2021-08-24 at 06:21 +0000, Li EF Zhang wrote:<br>&gt; dict_int is trusted extension in pg13. After creating dict_int extension with<br>&gt; unprivileged user, ALTER TEXT SEARCH DICTIONARY intdict ((MAXLEN = 7) failed.<br>&gt; &nbsp;<br>&gt; admin=&gt; ALTER TEXT SEARCH DICTIONARY intdict (MAXLEN = 7);<br>&gt; ERROR:&nbsp; must be owner of text search dictionary intdict<br>&gt; &nbsp;<br>&gt; This is by design or a bug? Thanks!<br><br>You must be the owner of an object to ALTER it. &nbsp;That is working as designed.<br><br>It is a bad idea to ALTER an object that belongs to an extension.<br>The next ALTER EXTENSION ... UPDATE may undo the change or fail.<br><br>Create your own dictionary with the same template.<br><br>Yours,<br>Laurenz Albe<br>--<br>Cybertec | <a href="https://www.cybertec-postgresql.com"; target="_blank">https://www.cybertec-postgresql.com</a>&nbsp;</font><br>&nbsp;</div>...;
<div dir="ltr" >&nbsp;</div></div><BR>
<BR>





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int
  2021-08-24 06:21 Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Li EF Zhang <bjzhangl@cn.ibm.com>
  2021-08-25 03:51 ` RE: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Li EF Zhang <bjzhangl@cn.ibm.com>
@ 2021-08-25 04:01   ` David G. Johnston <david.g.johnston@gmail.com>
  2021-08-25 04:19     ` Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 7+ messages in thread

From: David G. Johnston @ 2021-08-25 04:01 UTC (permalink / raw)
  To: Li EF Zhang <bjzhangl@cn.ibm.com>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On Tue, Aug 24, 2021 at 8:51 PM Li EF Zhang <bjzhangl@cn.ibm.com> wrote:

> Thanks for your answer. My doubt is that since an ordinary user creates
> the extension, shouldn't be this user the owner of the objects created
> within the extension?
>

While that is a possible implementation choice, that isn't what was chosen.

https://www.postgresql.org/docs/current/sql-createextension.html

"This configuration gives the calling user the right to drop the extension,
but not to modify individual objects within it."

"trust" just solves the "lets not require an actual superuser to install a
superuser requiring extension" problem, if that extension is deemed safe to
use in that manner by its author.

David J.

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int
  2021-08-24 06:21 Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Li EF Zhang <bjzhangl@cn.ibm.com>
  2021-08-25 03:51 ` RE: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Li EF Zhang <bjzhangl@cn.ibm.com>
  2021-08-25 04:01   ` Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int David G. Johnston <david.g.johnston@gmail.com>
@ 2021-08-25 04:19     ` Tom Lane <tgl@sss.pgh.pa.us>
  2021-08-25 05:29       ` Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int David G. Johnston <david.g.johnston@gmail.com>
  2021-08-25 06:00       ` RE: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Li EF Zhang <bjzhangl@cn.ibm.com>
  0 siblings, 2 replies; 7+ messages in thread

From: Tom Lane @ 2021-08-25 04:19 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Li EF Zhang <bjzhangl@cn.ibm.com>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Tue, Aug 24, 2021 at 8:51 PM Li EF Zhang <bjzhangl@cn.ibm.com> wrote:
>> Thanks for your answer. My doubt is that since an ordinary user creates
>> the extension, shouldn't be this user the owner of the objects created
>> within the extension?

> While that is a possible implementation choice, that isn't what was chosen.

Let's be clear here: that is not some random implementor's decision.
That is *necessary*, else the feature is completely insecure.

The example given at the top of the thread isn't especially
security-relevant, but there are a lot of other possible ALTER commands
that are.  For example, an ordinary user granted ownership of a
"C"-language function can easily modify it in a way that allows her to
gain full control of the installation.  So we cannot implement trusted
extensions by allowing the user requesting the install to own the
individual objects within the extension.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int
  2021-08-24 06:21 Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Li EF Zhang <bjzhangl@cn.ibm.com>
  2021-08-25 03:51 ` RE: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Li EF Zhang <bjzhangl@cn.ibm.com>
  2021-08-25 04:01   ` Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int David G. Johnston <david.g.johnston@gmail.com>
  2021-08-25 04:19     ` Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Tom Lane <tgl@sss.pgh.pa.us>
@ 2021-08-25 05:29       ` David G. Johnston <david.g.johnston@gmail.com>
  1 sibling, 0 replies; 7+ messages in thread

From: David G. Johnston @ 2021-08-25 05:29 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Li EF Zhang <bjzhangl@cn.ibm.com>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On Tue, Aug 24, 2021 at 9:20 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

> "David G. Johnston" <david.g.johnston@gmail.com> writes:
> > On Tue, Aug 24, 2021 at 8:51 PM Li EF Zhang <bjzhangl@cn.ibm.com> wrote:
> >> Thanks for your answer. My doubt is that since an ordinary user creates
> >> the extension, shouldn't be this user the owner of the objects created
> >> within the extension?
>
> > While that is a possible implementation choice, that isn't what was
> chosen.
>
> Let's be clear here: that is not some random implementor's decision.
> That is *necessary*, else the feature is completely insecure.
>
>
Fair.  Additionally, an extension that wishes for ordinary users to perform
limited configuration can always supply a security definer function to
facilitate such a change.  Though I'm unsure how/if it would go about
arranging role permissions without requiring a superuser.

David J.

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* RE: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int
  2021-08-24 06:21 Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Li EF Zhang <bjzhangl@cn.ibm.com>
  2021-08-25 03:51 ` RE: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Li EF Zhang <bjzhangl@cn.ibm.com>
  2021-08-25 04:01   ` Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int David G. Johnston <david.g.johnston@gmail.com>
  2021-08-25 04:19     ` Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Tom Lane <tgl@sss.pgh.pa.us>
@ 2021-08-25 06:00       ` Li EF Zhang <bjzhangl@cn.ibm.com>
  1 sibling, 0 replies; 7+ messages in thread

From: Li EF Zhang @ 2021-08-25 06:00 UTC (permalink / raw)
  To: david.g.johnston@gmail.com; +Cc: laurenz.albe@cybertec.at; pgsql-general@lists.postgresql.org; tgl@sss.pgh.pa.us

<div class="socmaildefaultfont" dir="ltr" style="font-family:Arial, Helvetica, sans-serif;font-size:10pt" ><div dir="ltr" >Got it! Thank you all very much!</div>
<div dir="ltr" >&nbsp;</div>
<blockquote data-history-content-modified="1" dir="ltr" style="border-left:solid #aaaaaa 2px; margin-left:5px; padding-left:5px; direction:ltr; margin-right:0px" >----- Original message -----<br>From: "David G. Johnston" &lt;david.g.johnston@gmail.com&gt;<br>To: "Tom Lane" &lt;tgl@sss.pgh.pa.us&gt;<br>Cc: "Li EF Zhang" &lt;bjzhangl@cn.ibm.com&gt;, "Laurenz Albe" &lt;laurenz.albe@cybertec.at&gt;, "pgsql-generallists.postgresql.org" &lt;pgsql-general@lists.postgresql.org&gt;<br>Subject: [EXTERNAL] Re: Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int<br>Date: Wed, Aug 25, 2021 1:29 PM<br>&nbsp;<br> 
<div dir="ltr" ><div dir="ltr" ><div style="font-family:arial,helvetica,sans-serif" ><span style="font-family:Arial,Helvetica,sans-serif" >On Tue, Aug 24, 2021 at 9:20 PM Tom Lane &lt;<a href="mailto:tgl@sss.pgh.pa.us" target="_blank" >tgl@sss.pgh.pa.us</a>&gt; wrote:</span></div></div>
<div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" >"David G. Johnston" &lt;<a href="mailto:david.g.johnston@gmail.com" target="_blank" >david.g.johnston@gmail.com</a>&gt; writes:<br>&gt; On Tue, Aug 24, 2021 at 8:51 PM Li EF Zhang &lt;<a href="mailto:bjzhangl@cn.ibm.com" target="_blank" >bjzhangl@cn.ibm.com</a>&gt; wrote:<br>&gt;&gt; Thanks for your answer. My doubt is that since an ordinary user creates<br>&gt;&gt; the extension, shouldn't be this user the owner of the objects created<br>&gt;&gt; within the extension?<br><br>&gt; While that is a possible implementation choice, that isn't what was chosen.<br><br>Let's be clear here: that is not some random implementor's decision.<br>That is *necessary*, else the feature is completely insecure.<br>&nbsp;</blockquote>
<div>&nbsp;</div>
<div style="font-family:arial,helvetica,sans-serif" >Fair.&nbsp; Additionally, an extension that wishes for ordinary users to perform limited configuration can always supply a security definer function to facilitate such a change.&nbsp; Though I'm unsure how/if it would go about arranging role permissions without requiring a superuser.</div>
<div style="font-family:arial,helvetica,sans-serif" >&nbsp;</div>
<div style="font-family:arial,helvetica,sans-serif" >David J.</div>
<div style="font-family:arial,helvetica,sans-serif" >&nbsp;</div></div></div></blockquote>
<div dir="ltr" >&nbsp;</div></div><BR>
<BR>





^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2021-08-25 06:00 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24 06:21 Can not ALTER TEXT SEARCH DICTIONARY intdict which is default in dict_int Li EF Zhang <bjzhangl@cn.ibm.com>
2021-08-24 10:22 ` Laurenz Albe <laurenz.albe@cybertec.at>
2021-08-25 03:51 ` Li EF Zhang <bjzhangl@cn.ibm.com>
2021-08-25 04:01   ` David G. Johnston <david.g.johnston@gmail.com>
2021-08-25 04:19     ` Tom Lane <tgl@sss.pgh.pa.us>
2021-08-25 05:29       ` David G. Johnston <david.g.johnston@gmail.com>
2021-08-25 06:00       ` Li EF Zhang <bjzhangl@cn.ibm.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox