deploy: Ensure xa.ref, if set, is correct

tingping/wmclass
Alexander Larsson 2017-05-23 11:41:58 +02:00
parent aa3ff4650e
commit e89facde7f
1 changed files with 12 additions and 0 deletions

View File

@ -4347,6 +4347,7 @@ flatpak_dir_deploy (FlatpakDir *self,
g_autofree char *tmp_dir_path = NULL;
g_autofree char *alt_id = NULL;
const char *xa_metadata = NULL;
const char *xa_ref = NULL;
g_autofree char *checkout_basename = NULL;
gboolean created_extra_data = FALSE;
g_autoptr(GVariant) commit_metadata = NULL;
@ -4532,6 +4533,17 @@ flatpak_dir_deploy (FlatpakDir *self,
}
}
g_variant_lookup (commit_metadata, "xa.ref", "s", &xa_ref);
if (xa_ref != NULL)
{
if (strcmp (ref, xa_ref) != 0)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
_("Deployed ref %s does not match commit (%s)"), ref, xa_ref);
return FALSE;
}
}
/* Check the metadata in the commit to make sure it matches the actual
deployed metadata, in case we relied on the one in the commit for
a decision */