lib/commit: always validate metadata

This tweaks commit logic in order to always validate metadata,
including on commits where the expected checksum is already known.
This commit is contained in:
Luca BRUNO 2022-01-19 13:44:10 +00:00
parent a05b02fa9c
commit 6230b3eeab
No known key found for this signature in database
GPG Key ID: A9834A2252078E4E
1 changed files with 2 additions and 6 deletions

View File

@ -2478,12 +2478,8 @@ ostree_repo_write_metadata (OstreeRepo *self,
normalized = g_variant_get_normal_form (object); normalized = g_variant_get_normal_form (object);
} }
/* For untrusted objects, verify their structure here */ if (!_ostree_validate_structureof_metadata (objtype, object, error))
if (expected_checksum) return FALSE;
{
if (!_ostree_validate_structureof_metadata (objtype, object, error))
return FALSE;
}
g_autoptr(GBytes) vdata = g_variant_get_data_as_bytes (normalized); g_autoptr(GBytes) vdata = g_variant_get_data_as_bytes (normalized);
if (!write_metadata_object (self, objtype, expected_checksum, if (!write_metadata_object (self, objtype, expected_checksum,