Am 09.08.24 um 13:22 schrieb Fabian Grünbichler: > 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.gruenbich...@proxmox.com> > --- > > Notes: > requires pve-storage change to actually have an effect > > src/PVE/StorageTunnel.pm | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/src/PVE/StorageTunnel.pm b/src/PVE/StorageTunnel.pm > index c880889..21780bd 100644 > --- a/src/PVE/StorageTunnel.pm > +++ b/src/PVE/StorageTunnel.pm > @@ -280,6 +280,13 @@ 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}) {
Seems a bit like a plugin method would be nicest here. But I guess we can still add that if/when it becomes necessary for non-path-based plugins to do such checks. > + PVE::Storage::file_size_info(PVE::Storage::path($cfg, $volid), > undef, 1); Isn't this broken because PVE::Storage::path() uses wantarray? At least a small test program does "break" in the same scenario: > febner@enia ~ % cat asdf.pm > use strict; > use warnings; > > sub a { > return wantarray ? (1, 2) : 1; > } > > sub b { > my ($a, $b, $c) = @_; > > print "$a $b $c\n"; > } > > b(a(), 3, 4); > febner@enia ~ % perl asdf.pm > 1 2 3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel