From 1b1110581a9104a841eeaf2a9dc188bbd9fa2860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Mon, 20 Jul 2020 10:22:12 +0200 Subject: [PATCH] manifest: revert canonicalization to old behaviour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JSON keys MUST be quoted. this is a one-time break in signature validation for backups created with the broken canonicalization code. QEMU backups are not affected, as libproxmox-backup-qemu never linked the broken versions. Signed-off-by: Fabian Grünbichler --- src/backup/manifest.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backup/manifest.rs b/src/backup/manifest.rs index 2ee3d440..f90f1159 100644 --- a/src/backup/manifest.rs +++ b/src/backup/manifest.rs @@ -160,12 +160,12 @@ impl BackupManifest { keys.sort(); let mut iter = keys.into_iter(); if let Some(key) = iter.next() { - output.extend(key.as_bytes()); + Self::write_canonical_json(&key.into(), output)?; output.push(b':'); Self::write_canonical_json(&map[key], output)?; for key in iter { output.push(b','); - output.extend(key.as_bytes()); + Self::write_canonical_json(&key.into(), output)?; output.push(b':'); Self::write_canonical_json(&map[key], output)?; }