From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id BE66C1FF0E0 for ; Thu, 23 Jul 2026 13:09:09 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id D0B8F21447; Thu, 23 Jul 2026 13:09:07 +0200 (CEST) Message-ID: <901201f6-9e5d-4470-8059-3016473b0944@proxmox.com> Date: Thu, 23 Jul 2026 13:08:54 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH proxmox-backup 1/2] fix #6990: server: drop verify state on non-decrypt pull job To: Jakob Klocker , pbs-devel@lists.proxmox.com References: <20260709122136.352839-1-j.klocker@proxmox.com> <20260709122136.352839-2-j.klocker@proxmox.com> Content-Language: en-US, de-DE From: Christian Ebner In-Reply-To: <20260709122136.352839-2-j.klocker@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1784804905877 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.186 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: S72PGBEUHD6A2DDVTDOEVWZCWDQYYMA3 X-Message-ID-Hash: S72PGBEUHD6A2DDVTDOEVWZCWDQYYMA3 X-MailFrom: c.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Thanks for the patch, mostly looks good to me. Just one comment and nit inline. On 7/9/26 2:22 PM, Jakob Klocker wrote: > On a non-decrypt pull the source manifest is written to the target > as-is, so the target inherits the source's verify_state flag instead of > being verified independently on its own storage. Because a snapshot > carrying a verify_state is skipped by verify jobs, the target's copy can > never be checked. > > The decrypt path already drops verify_state; do the same on the > non-decrypt path when the snapshot is newly pulled or re-synced due to > corruption. Also factor the manifest blob encoding and writing into a > helper, shared by both paths. > > Link: https://bugzilla.proxmox.com/show_bug.cgi?id=6990 > > Signed-off-by: Jakob Klocker > --- > src/server/pull.rs | 42 ++++++++++++++++++++++++++++-------------- > 1 file changed, 28 insertions(+), 14 deletions(-) > > diff --git a/src/server/pull.rs b/src/server/pull.rs > index e86a9c329..f8107911e 100644 > --- a/src/server/pull.rs > +++ b/src/server/pull.rs > @@ -745,7 +745,8 @@ async fn pull_snapshot<'a>( > }; > > let mut manifest_data = tmp_manifest_blob.raw_data().to_vec(); > - let manifest = BackupManifest::try_from(tmp_manifest_blob).with_context(|| prefix.clone())?; > + let mut manifest = > + BackupManifest::try_from(tmp_manifest_blob).with_context(|| prefix.clone())?; > > if ignore_not_verified_or_encrypted( > &manifest, > @@ -885,19 +886,15 @@ async fn pull_snapshot<'a>( > new_manifest.set_sync_source_signature(expected.bytes())?; > } > > - let manifest_string = new_manifest.to_string(None)?; > - let manifest_blob = DataBlob::encode(manifest_string.as_bytes(), None, true)?; > - // update contents to be uploaded to backend > - manifest_data = manifest_blob.raw_data().to_vec(); > - > - let mut tmp_manifest_file = OpenOptions::new() > - .write(true) > - .truncate(true) // clear pre-existing manifest content > - .open(&tmp_manifest_name) > - .await?; > - tmp_manifest_file.write_all(&manifest_data).await?; > - tmp_manifest_file.flush().await?; > - nix::unistd::fsync(tmp_manifest_file.as_raw_fd())?; > + manifest_data = write_manifest_blob(&new_manifest, &tmp_manifest_name).await?; > + } else if (is_new || corrupt) && manifest.unprotected.get("verify_state").is_some() { > + // the manifest is copied as-is on the non-decrypted path, drop verify_state explicitly > + if let Some(unprotected) = manifest.unprotected.as_object_mut() { > + unprotected.remove("verify_state"); > + } else { > + bail!("Encountered unexpected manifest without 'unprotected' section."); > + } > + manifest_data = write_manifest_blob(&manifest, &tmp_manifest_name).await?; > } > > if let Err(err) = std::fs::rename(&tmp_manifest_name, &manifest_name) { > @@ -927,6 +924,23 @@ async fn pull_snapshot<'a>( > Ok(Some(sync_stats)) > } > > +async fn write_manifest_blob( > + manifest: &BackupManifest, > + path: &std::path::Path, > +) -> Result, Error> { > + let manifest_blob = DataBlob::encode(manifest.to_string(None)?.as_bytes(), None, true)?; > + let manifest_data = manifest_blob.raw_data().to_vec(); > + let mut manifest_file = OpenOptions::new() > + .write(true) > + .truncate(true) > + .open(path) > + .await?; > + manifest_file.write_all(&manifest_data).await?; > + manifest_file.flush().await?; > + nix::unistd::fsync(manifest_file.as_raw_fd())?; nit: pre-existing but this is a blocking call and we are in an async context, so we should spawn a blocking tokio task for this I guess. Same is true for the std::fs::rename which should be replaced by it's tokio::fs::rename counterpart and the call to BackupDir::cleanup_unreferenced_files(). Could you also include additional patches to fix these since touching this? > + Ok(manifest_data) > +} comment: This should rather live as method impl on BackupManifest itself IMO. It could further be refactored to reduce common code with pbs-datastores BackupDir::update_manifest(). > /// Check if the decryption key should be used to decrypt the snapshot during > /// pull based on given pull parameter, source and optionally already present > /// target manifest.