Plugins: Tighten requirements for multiplexing (#17403)

Change the multiplexing key to use all `PluginRunner` config (converted to a struct which is comparable), so that plugins with the same name but different env, args, types, versions etc are not incorrectly multiplexed together.

Co-authored-by: Christopher Swenson <christopher.swenson@hashicorp.com>
This commit is contained in:
Tom Proctor
2022-10-05 09:29:29 +01:00
committed by GitHub
parent 294d4c351c
commit 418e528008
5 changed files with 375 additions and 101 deletions

View File

@@ -2,11 +2,14 @@ package mock
import (
"context"
"os"
"github.com/hashicorp/vault/sdk/framework"
"github.com/hashicorp/vault/sdk/logical"
)
const MockPluginVersionEnv = "TESTING_MOCK_VAULT_PLUGIN_VERSION"
// New returns a new backend as an interface. This func
// is only necessary for builtin backend plugins.
func New() (interface{}, error) {
@@ -60,6 +63,9 @@ func Backend() *backend {
}
b.internal = "bar"
b.RunningVersion = "v0.0.0+mock"
if version := os.Getenv(MockPluginVersionEnv); version != "" {
b.RunningVersion = version
}
return &b
}