mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 00:11:06 -05:00
This makes the client programs behave as documented regardless of the connect-time search_path and regardless of user-created objects. Today, a malicious user with CREATE permission on a search_path schema can take control of certain of these clients' queries and invoke arbitrary SQL functions under the client identity, often a superuser. This is exploitable in the default configuration, where all users have CREATE privilege on schema "public". This changes behavior of user-defined code stored in the database, like pg_index.indexprs and pg_extension_config_dump(). If they reach code bearing unqualified names, "does not exist" or "no schema has been selected to create in" errors might appear. Users may fix such errors by schema-qualifying affected names. After upgrading, consider watching server logs for these errors. The --table arguments of src/bin/scripts clients have been lax; for example, "vacuumdb -Zt pg_am\;CHECKPOINT" performed a checkpoint. That now fails, but for now, "vacuumdb -Zt 'pg_am(amname);CHECKPOINT'" still performs a checkpoint. Back-patch to 9.3 (all supported versions). Reviewed by Tom Lane, though this fix strategy was not his first choice. Reported by Arseniy Sharoglazov. Security: CVE-2018-1058
54 lines
1.6 KiB
Perl
54 lines
1.6 KiB
Perl
use strict;
|
|
use warnings;
|
|
|
|
use PostgresNode;
|
|
use TestLib;
|
|
use Test::More tests => 23;
|
|
|
|
program_help_ok('reindexdb');
|
|
program_version_ok('reindexdb');
|
|
program_options_handling_ok('reindexdb');
|
|
|
|
my $node = get_new_node('main');
|
|
$node->init;
|
|
$node->start;
|
|
|
|
$ENV{PGOPTIONS} = '--client-min-messages=WARNING';
|
|
|
|
$node->issues_sql_like(
|
|
[ 'reindexdb', 'postgres' ],
|
|
qr/statement: REINDEX DATABASE postgres;/,
|
|
'SQL REINDEX run');
|
|
|
|
$node->safe_psql('postgres',
|
|
'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a);');
|
|
$node->issues_sql_like(
|
|
[ 'reindexdb', '-t', 'test1', 'postgres' ],
|
|
qr/statement: REINDEX TABLE public\.test1;/,
|
|
'reindex specific table');
|
|
$node->issues_sql_like(
|
|
[ 'reindexdb', '-i', 'test1x', 'postgres' ],
|
|
qr/statement: REINDEX INDEX public\.test1x;/,
|
|
'reindex specific index');
|
|
$node->issues_sql_like(
|
|
[ 'reindexdb', '-S', 'pg_catalog', 'postgres' ],
|
|
qr/statement: REINDEX SCHEMA pg_catalog;/,
|
|
'reindex specific schema');
|
|
$node->issues_sql_like(
|
|
[ 'reindexdb', '-s', 'postgres' ],
|
|
qr/statement: REINDEX SYSTEM postgres;/,
|
|
'reindex system tables');
|
|
$node->issues_sql_like(
|
|
[ 'reindexdb', '-v', '-t', 'test1', 'postgres' ],
|
|
qr/statement: REINDEX \(VERBOSE\) TABLE public\.test1;/,
|
|
'reindex with verbose output');
|
|
|
|
$node->command_ok([qw(reindexdb --echo --table=pg_am dbname=template1)],
|
|
'reindexdb table with connection string');
|
|
$node->command_ok(
|
|
[qw(reindexdb --echo dbname=template1)],
|
|
'reindexdb database with connection string');
|
|
$node->command_ok(
|
|
[qw(reindexdb --echo --system dbname=template1)],
|
|
'reindexdb system with connection string');
|