18529 nomad executes any file in plugins (#18530)

Co-authored-by: James Rasell <jrasell@hashicorp.com>
This commit is contained in:
stswidwinski
2025-02-10 11:08:22 -05:00
committed by GitHub
parent cfc24116b3
commit 871585ee90
4 changed files with 22 additions and 4 deletions

View File

@@ -264,10 +264,15 @@ func (l *PluginLoader) fingerprintPlugins(plugins []os.FileInfo, configs map[str
fingerprinted := make(map[PluginID]*pluginInfo, len(plugins))
for _, p := range plugins {
name := cleanPluginExecutable(p.Name())
// Use the cleaned plugin name to check whether it is configured by the
// operator for use. If it is not, skip loading it and log a message, so
// operators can easily see this.
c, ok := configs[name]
if !ok {
// COMPAT(1.7): Skip executing unconfigured plugins in 1.8 or later.
l.logger.Warn("plugin not referenced in the agent configuration file, future versions of Nomad will not load this plugin until the agent configuration is updated", "plugin", name)
l.logger.Warn("plugin not referenced in the agent configuration file, loading skipped",
"plugin", name)
continue
}
info, err := l.fingerprintPlugin(p, c)
if err != nil {