Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDUxX-0002D0-Jy for pgsql-general@arkaria.postgresql.org; Wed, 02 Sep 2020 15:46:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kDUxW-00069M-I3 for pgsql-general@arkaria.postgresql.org; Wed, 02 Sep 2020 15:46:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDUxW-00069F-1P for pgsql-general@lists.postgresql.org; Wed, 02 Sep 2020 15:46:02 +0000 Received: from ns01.jtek.fr ([188.40.135.224] helo=ns01.j-tek.biz) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDUxT-00058Y-39 for pgsql-general@lists.postgresql.org; Wed, 02 Sep 2020 15:46:00 +0000 Received: from [192.168.0.39] (adsl.bouton.name [82.234.193.23]) by ns01.j-tek.biz (Postfix) with ESMTPSA id 844A64298F9 for ; Wed, 2 Sep 2020 17:45:56 +0200 (CEST) To: pgsql-general@lists.postgresql.org From: Lionel Bouton Subject: Reconstructing transaction content after the fact Autocrypt: addr=lionel.bouton@jtek.fr; prefer-encrypt=mutual; keydata= mQINBE3AUG0BEADDg0t02Yej7vQjZT8I2dKozVpszlv27NGgOL/1TvFv5xqoMIuQFoRvB3s/ QoJmu488c3B5xVasRY1xIwZJA6WLBgEPnxGGhR/igdOeA5UiXBcVifZPMgzDGHMoc9g/Ds/6 2T6R/ElZlgJYWrDMyAjg7v7/c+OTHGujI9ui4DX4myEY6ztQXYYHILgfl9zEqpzDESzBUF65 +4sxURUlX66/8Des+TTE6Xbv33lQX3sxa/luk99od8BKNH9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D4VVv+7PyEjJBsCe7lHw+1kEJ znu5aPeV723XzyRGJ5RLrCRFzPC/pZLBbPKIysFb7WJAXRuYX9O2nmOX/65m5Y1jUQ2ajrsk hb8yh64fOLzs7Wo7ZK8CNjYA9z9usYnDNZqqn06Ovm8pTDYEFcpkIH6Xpwa6h7POmyBAEq0g z7dQE02Xx7an7qgLUNUl8+upDwxtEBwc1cu6nx8xEODboUTZuSRm+FmJuxUyS42lJpliq/4b 0sHKp8A2rqeTQ76wa7aB4Kv//HfVwgWAddKly+2cug1XENymaHOMu1CT6te1s8MEJdbPlfoc Lis6siQljJCKaVBw2JDxzCUdNxVfhMwMMUrZPw/W5WZYw/izeR3x4TSjn575to0dZZobDbjH uGkL1Wt4cb24xc9+K9v0IwPsaquZfinvHS0ojkN0wyO++cFouzwr2sDEgOlgtujysOtx4KD0 KW7WwcZUQ18cROlM434abxhrVZ67a0roNyEKtWcs4VDBSixVevBLSh+GJfll8/hfeIZKRVui fVmbTTCFF2I5Iw== Message-ID: <091ea8f4-1530-40b7-ff01-56576903a4b1@jtek.fr> Date: Wed, 2 Sep 2020 17:45:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, I'm a long time PostgreSQL user (since 7.x), familiar with the basics of PostgreSQL internals and I'm currently participating in an audit of a software voting solution which should for obvious reasons avoid to store any link between the voter register and the actual votes. The software uses a modern version of PostgreSQL (9.6 or later) and uses a transaction to store a vote and the corresponding register entry in two separate tables. There's already an obvious angle of attack to correlate a vote and a register entry : the WAL. That said the WAL can be configured to be short lived to minimize the attack surface. By my understanding a low checkpoint_timeout value should allow postgresql to recycle/remove old WAL files early unless the system is overloaded. This can become a bit messy but if the system is tightly controlled I believe the attack surface can be reduced. Another angle I could think of are the transaction ids. If I'm not mistaken they are stored on disk inside the files storing table and index data (my quick read of the documentation lets me think the txid is stored in t_xmin in the HeapTupleHeaderData for a row content). These values might be cleaned up when the data is visible by all currently running transaction but I think this isn't needed and so probably not done (this information is stored in the visibility map). So reading the raw content from disk you should be able to correlate data in several tables from a single transaction by comparing the txid. Are txids in table file data indeed a means by which you can recover the data written by a single transaction (assuming the txids don't overflow the 32bit limit during the life of the cluster) ? Are these t_xmin values ever cleaned up (by VACUUM or another mechanism) ? If positive is there a way to configure the approximate time during which these values can be recovered ? Is there a way to access these values by connecting to a PostgreSQL server instead of analyzing in-memory or on-disk data ? Best regards, -- Lionel Bouton gérant de JTEK SARL https://www.linkedin.com/in/lionelbouton/