Re: Bug fix in vacuumdb --buffer-usage-limit xxx -Z

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Ryoga Yoshida <bt23yoshidar(at)oss(dot)nttdata(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Bug fix in vacuumdb --buffer-usage-limit xxx -Z
Date: 2023-09-21 05:50:26
Message-ID: CAApHDvqrfvwJy1g7bwBQgr9uTJU9e4OEtiLLDVfNuPmjB3+QFw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 21 Sept 2023 at 16:18, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> Thanks for the report and the patch. I agree this has been overlooked.
>
> I also wonder if we should be escaping the buffer-usage-limit string
> sent in the comment. It seems quite an unlikely attack vector, as the
> user would have command line access and could likely just use psql
> anyway, but I had thought about something along the lines of:
>
> $ vacuumdb --buffer-usage-limit "1MB'); drop database postgres;--" postgres
> vacuumdb: vacuuming database "postgres"
> vacuumdb: error: processing of database "postgres" failed: ERROR:
> VACUUM cannot run inside a transaction block
>
> seems that won't work, due to sending multiple commands at once, but I
> think we should fix it anyway.

I've pushed your patch plus some additional code to escape the text
specified in --buffer-usage-limit before passing it to the server in
commit 5cfba1ad6

Thanks again for the report.

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2023-09-21 05:53:01 Re: Comment about set_join_pathlist_hook()
Previous Message Tom Lane 2023-09-21 05:28:22 Re: Guiding principle for dropping LLVM versions?