storage tunnel: check just-imported image files

remote migration requires elevated privileges already and can thus only be
triggered by trusted sources, but an additional safeguard of checking the image
for external references doesn't hurt.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2024-11-04 11:42:19 +01:00 committed by Thomas Lamprecht
parent ef051db594
commit 16ff09f72c

View File

@ -280,6 +280,14 @@ sub handle_query_disk_import {
delete $state->{sockets}->{$unix};
delete $state->{disk_import};
$state->{cleanup}->{volumes}->{$volid} = 1;
my $cfg = PVE::Storage::config();
my ($storage, $volume) = PVE::Storage::parse_volume_id($volid);
my $scfg = PVE::Storage::storage_config($cfg, $storage);
# check imported image for bad references
if ($scfg->{path}) {
my $path = PVE::Storage::path($cfg, $volid);
PVE::Storage::file_size_info($path, undef, 1);
}
return {
status => "complete",
volid => $volid,