Remove pinned builtin plugin versions from storage (#18051)

* Removes _builtin_ versions from mount storage where it already exists
* Stops new builtin versions being put into storage on mount creation/tuning
* Stops the plugin catalog from returning a builtin plugin that has been overridden, so it more accurately reflects the plugins that are available to actually run
This commit is contained in:
Tom Proctor
2022-11-23 18:36:25 +00:00
committed by GitHub
parent eb622cc796
commit 3c95f15cea
16 changed files with 517 additions and 28 deletions

View File

@@ -13,7 +13,9 @@ import (
"time"
"github.com/go-test/deep"
"github.com/hashicorp/go-hclog"
mongodbatlas "github.com/hashicorp/vault-plugin-database-mongodbatlas"
"github.com/hashicorp/vault/helper/builtinplugins"
"github.com/hashicorp/vault/helper/namespace"
postgreshelper "github.com/hashicorp/vault/helper/testhelpers/postgresql"
vaulthttp "github.com/hashicorp/vault/http"
@@ -36,6 +38,7 @@ func getCluster(t *testing.T) (*vault.TestCluster, logical.SystemView) {
LogicalBackends: map[string]logical.Factory{
"database": Factory,
},
BuiltinRegistry: builtinplugins.Registry,
}
cluster := vault.NewTestCluster(t, coreConfig, &vault.TestClusterOptions{
@@ -1550,6 +1553,15 @@ func TestBackend_AsyncClose(t *testing.T) {
}
}
func TestNewDatabaseWrapper_IgnoresBuiltinVersion(t *testing.T) {
cluster, sys := getCluster(t)
t.Cleanup(cluster.Cleanup)
_, err := newDatabaseWrapper(context.Background(), "hana-database-plugin", "v1.0.0+builtin", sys, hclog.Default())
if err != nil {
t.Fatal(err)
}
}
func testCredsExist(t *testing.T, resp *logical.Response, connURL string) bool {
t.Helper()
var d struct {