allow to restrict the env vars passed to plugins

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2023-10-29 15:19:30 +01:00
parent 9a7a3b00dc
commit 5c938e46b7
10 changed files with 90 additions and 13 deletions

View File

@@ -16,7 +16,6 @@ package plugin
import (
"fmt"
"os/exec"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-plugin"
@@ -60,7 +59,8 @@ func (p *metadataPlugin) initialize() error {
client := plugin.NewClient(&plugin.ClientConfig{
HandshakeConfig: metadata.Handshake,
Plugins: metadata.PluginMap,
Cmd: exec.Command(p.config.Cmd, p.config.Args...),
Cmd: p.config.getCommand(),
SkipHostEnv: true,
AllowedProtocols: []plugin.Protocol{
plugin.ProtocolGRPC,
},