[pbs-devel] [PATCH proxmox-backup 1/2] manifest: revert canonicalization to old behaviour

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Jul 20 10:22:12 CEST 2020


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 <f.gruenbichler at proxmox.com>
---
Note: after this has been applied and proxmox-backup has been bumped,
libproxmox-backup-qemu needs to be be re-built with the new code and
bumped for restore to work again.

 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)?;
                     }
-- 
2.20.1






More information about the pbs-devel mailing list