Make \restrict keys protective in pg_dump --format=tar restore.sql. pg_dump tar format contains an undocumented restore.sql archive member that the user can edit according to its embedded comments and then run with psql. Commit 71ea0d6795438f95f4ee6e35867058c44b270d51 added \restrict and \unrestrict to fix CVE-2025-8714. That restore.sql always used "(null)" as the restriction key, so the key did not provide its intended protection. Also, there was an initial \unrestrict before any restrict, yielding a spurious error. Given the lack of reports about that spurious error in over a year, restore.sql may see negligible use.
This defers fixing restore.sql from "pg_dump --format=tar --inserts", because that relies on "\i" commands. That case is not subject to attack, but it fails to restore table data. We should eventually fix "pg_dump --format=tar --inserts" restore.sql or remove restore.sql. Given this combination with --inserts has been broken to that degree, again for over a year, the combination must see little use indeed. Back-patch to v14 (all supported versions). Reported-by: Pavel Kopylov <[email protected]> Reviewed-by: Nathan Bossart <[email protected]> (non-test) Reviewed-by: Jacob Champion <[email protected]> (test) Reviewed-by: Andres Freund <[email protected]> (test) Bug: #19718 Discussion: https://postgr.es/m/[email protected] Backpatch-through: 14 Security: CVE-2026-116330 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4d3c1372455c7c493ccbee98dbb07eb334d21c46 Modified Files -------------- doc/src/sgml/ref/pg_dump.sgml | 6 +- src/bin/pg_dump/Makefile | 1 + src/bin/pg_dump/meson.build | 2 + src/bin/pg_dump/pg_dump.c | 9 +- src/bin/pg_dump/t/011_restore.pl | 269 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 280 insertions(+), 7 deletions(-)
