agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Undo inadvertent loosening of archive filename checking.
Date: Mon, 03 Aug 2026 16:38:16 +0000
Message-ID: <E1wqvg8-0000000021x-2fPD@gemulon.postgresql.org> (raw)

Undo inadvertent loosening of archive filename checking.

Commit c8a350a439826267186c187dbfbf1f839f7521aa attempted to consolidate
code for identify possibly-compressed tar archives by suffix into a new
function parse_tar_compress_algorithm(). Unfortunately, the refactoring
wasn't perfect, and slightly changed the behavior at both existing call
sites.

In CreateBackupStreamer(), the previous code required the filename to
consist of more than just a suffix, so the aforementioned commit had the
effect of allowing pg_basebackup to accept a file from the server whose
entire name was something like .tar.gz -- which should never happen, but
let's reject it as previous releases did.

In precheck_tar_backup_file(), the previous code required the suffix to
be immediately adjacent to the prefix already checked, so the commit
in question allowed pg_verifybackup to accept not only filenames like
base.tar.gz but also filenames like baseFOOBARBAZ.tar.gz. While such
filenames are perhaps unlikely, rejecting them is correct, so let's go
back to that behavior.

Discussion: http://postgr.es/m/CA+TgmoYJY8FkoeYKGF_YF1S6uOK7fd0Bd3zrw0XY_oZXbmVFpQ@mail.gmail.com
Reported-by: Sarath Kumar <Sarath@iitmpravartak.net>
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/dd62a71013c8c4d988624d0424503ec40520760e

Modified Files
--------------
src/bin/pg_basebackup/pg_basebackup.c     |  4 ++--
src/bin/pg_verifybackup/pg_verifybackup.c |  8 ++++++--
src/bin/pg_waldump/pg_waldump.c           |  5 +++--
src/common/compression.c                  | 28 +++++++++++++++++++++-------
src/include/common/compression.h          |  2 +-
5 files changed, 33 insertions(+), 14 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1wqvg8-0000000021x-2fPD@gemulon.postgresql.org>
Permalink:  ../E1wqvg8-0000000021x-2fPD@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wqvg8-0000000021x-2fPD@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: rhaas@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Undo inadvertent loosening of archive filename checking.
  In-Reply-To: <E1wqvg8-0000000021x-2fPD@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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