Keep same-named VMs from different drivers, reject ambiguous bare-name resolution, and add exact ResolveRef routing with driver-qualified keys. Declare DataRoot-relative VM roots in guest driver manifests, validate traversal and absolute paths, and scan declarations for unavailable drivers. Add data layout v3 for driver-qualified per-VM plugin settings, preserve explicit values during migration, and pass VMRef keys from the settings UI.
23 lines
826 B
Go
23 lines
826 B
Go
package plugin
|
|
|
|
import "testing"
|
|
|
|
func TestValidateManifestVMRootsStayInsideDataRoot(t *testing.T) {
|
|
base := Manifest{
|
|
ID: "vendor.linux", Version: "1.0.0", Name: LocalizedText{EnUS: "Linux"},
|
|
Permissions: []string{"driver:vm"},
|
|
}
|
|
for _, root := range []string{"", "/absolute", "../outside", "data/../../outside", `C:\outside`, `data\vms`, "."} {
|
|
m := base
|
|
m.Contributes.GuestDrivers = []GuestDriverContribution{{ID: "vendor.driver.linux", VMRoots: []string{root}}}
|
|
if err := ValidateManifest(m, "dev", true); err == nil {
|
|
t.Errorf("VM root %q accepted", root)
|
|
}
|
|
}
|
|
m := base
|
|
m.Contributes.GuestDrivers = []GuestDriverContribution{{ID: "vendor.driver.linux", VMRoots: []string{"data/linux/vms"}}}
|
|
if err := ValidateManifest(m, "dev", true); err != nil {
|
|
t.Fatalf("valid VM root rejected: %v", err)
|
|
}
|
|
}
|