track signature files + add warn log (#38938)

This commit is contained in:
Will Browne
2021-09-08 08:49:05 +02:00
committed by GitHub
parent 0383becc46
commit 40643ee023
8 changed files with 223 additions and 107 deletions

View File

@ -73,6 +73,7 @@ type PluginBase struct {
IsCorePlugin bool `json:"-"`
SignatureType PluginSignatureType `json:"-"`
SignatureOrg string `json:"-"`
SignedFiles PluginFiles `json:"-"`
GrafanaNetVersion string `json:"-"`
GrafanaNetHasUpdate bool `json:"-"`
@ -80,6 +81,23 @@ type PluginBase struct {
Root *PluginBase
}
func (p *PluginBase) IncludedInSignature(file string) bool {
// permit Core plugin files
if p.IsCorePlugin {
return true
}
// permit when no signed files (no MANIFEST)
if p.SignedFiles == nil {
return true
}
if _, exists := p.SignedFiles[file]; !exists {
return false
}
return true
}
type PluginDependencies struct {
GrafanaVersion string `json:"grafanaVersion"`
Plugins []PluginDependencyItem `json:"plugins"`