Plugins: Always validate root URL if specified in signature manfiest (#52332)

* always validate root URL if specified in signature

* tidy imports
This commit is contained in:
Will Browne
2022-07-15 17:42:20 +02:00
committed by GitHub
parent 1d3cd0103e
commit 5d052be6ff
10 changed files with 134 additions and 1 deletions

View File

@ -343,6 +343,38 @@ func TestLoader_Load(t *testing.T) {
},
},
},
{
name: "Load a plugin with manifest which has a file not found in plugin folder",
class: plugins.External,
cfg: &plugins.Cfg{
PluginsPath: filepath.Join(parentDir),
PluginsAllowUnsigned: []string{"test"},
},
pluginPaths: []string{"../testdata/invalid-v2-missing-file"},
want: []*plugins.Plugin{},
pluginErrors: map[string]*plugins.Error{
"test": {
PluginID: "test",
ErrorCode: "signatureModified",
},
},
},
{
name: "Load a plugin with file which is missing from the manifest",
class: plugins.External,
cfg: &plugins.Cfg{
PluginsPath: filepath.Join(parentDir),
PluginsAllowUnsigned: []string{"test"},
},
pluginPaths: []string{"../testdata/invalid-v2-extra-file"},
want: []*plugins.Plugin{},
pluginErrors: map[string]*plugins.Error{
"test": {
PluginID: "test",
ErrorCode: "signatureModified",
},
},
},
{
name: "Load an app with includes",
class: plugins.External,