mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
Check if plugin version matches running version (#17182)
Check if plugin version matches running version When registering a plugin, we check if the request version matches the self-reported version from the plugin. If these do not match, we log a warning. This uncovered a few missing pieces for getting the database version code fully working. We added an environment variable that helps us unit test the running version behavior as well, but only for approle, postgresql, and consul plugins. Return 400 on plugin not found or version mismatch Populate the running SHA256 of plugins in the mount and auth tables (#17217)
This commit is contained in:
committed by
GitHub
parent
c3c323d8d8
commit
0b34b73c47
@@ -2,6 +2,7 @@ package pluginutil
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
@@ -13,6 +14,8 @@ import (
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
var ErrNoMultiplexingIDFound = errors.New("no multiplexing ID found")
|
||||
|
||||
type PluginMultiplexingServerImpl struct {
|
||||
UnimplementedPluginMultiplexingServer
|
||||
|
||||
@@ -62,7 +65,9 @@ func GetMultiplexIDFromContext(ctx context.Context) (string, error) {
|
||||
}
|
||||
|
||||
multiplexIDs := md[MultiplexingCtxKey]
|
||||
if len(multiplexIDs) != 1 {
|
||||
if len(multiplexIDs) == 0 {
|
||||
return "", ErrNoMultiplexingIDFound
|
||||
} else if len(multiplexIDs) != 1 {
|
||||
return "", fmt.Errorf("unexpected number of IDs in metadata: (%d)", len(multiplexIDs))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user