Re: Bug fix in vacuumdb --buffer-usage-limit xxx -Z - Mailing list pgsql-hackers

From David Rowley
Subject Re: Bug fix in vacuumdb --buffer-usage-limit xxx -Z
Date
Msg-id CAApHDvqrfvwJy1g7bwBQgr9uTJU9e4OEtiLLDVfNuPmjB3+QFw@mail.gmail.com
Whole thread Raw
In response to Re: Bug fix in vacuumdb --buffer-usage-limit xxx -Z  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: Bug fix in vacuumdb --buffer-usage-limit xxx -Z
Re: Bug fix in vacuumdb --buffer-usage-limit xxx -Z
List pgsql-hackers
On Thu, 21 Sept 2023 at 16:18, David Rowley <dgrowleyml@gmail.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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Guiding principle for dropping LLVM versions?
Next
From: Etsuro Fujita
Date:
Subject: Re: Comment about set_join_pathlist_hook()