From 682968d0dfe5194e3ead6662b1428e1ca5b494cd Mon Sep 17 00:00:00 2001 From: Lucas Bajolet Date: Wed, 15 May 2024 16:42:35 -0400 Subject: [PATCH] packer: don't load plugins with metadata in name If a plugin is installed in the PACKER_PLUGIN_PATH, and its version contains metadata, we reject it. This is because metadata is free-form data, which could then make it possible to have multiple conflicting versions of a plugin installed, so we don't support it and explicitely reject plugins like those. A valid plugin with metadata in its version information should be installed without its metadata part, so there can only be one variant of the plugin installed at a specific version. --- packer/plugin-getter/plugins.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packer/plugin-getter/plugins.go b/packer/plugin-getter/plugins.go index ef84d6f0efd..1554960d69a 100644 --- a/packer/plugin-getter/plugins.go +++ b/packer/plugin-getter/plugins.go @@ -280,6 +280,11 @@ func (pr Requirement) ListInstallations(opts ListInstallationsOptions) (InstallL continue } + if ver.Metadata() != "" { + log.Printf("found version %q with metadata in the name, this could introduce ambiguity and is not supported, ignoring it.", pluginVersionStr) + continue + } + descVersion, err := goversion.NewVersion(describeInfo.Version) if err != nil { log.Printf("malformed reported version string %q: %s, ignoring", describeInfo.Version, err)