mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 19:47:54 +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
@@ -233,7 +233,10 @@ func (mw databaseMetricsMiddleware) Close() (err error) {
|
||||
// Error Sanitizer Middleware Domain
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
var _ Database = DatabaseErrorSanitizerMiddleware{}
|
||||
var (
|
||||
_ Database = (*DatabaseErrorSanitizerMiddleware)(nil)
|
||||
_ logical.PluginVersioner = (*DatabaseErrorSanitizerMiddleware)(nil)
|
||||
)
|
||||
|
||||
// DatabaseErrorSanitizerMiddleware wraps an implementation of Databases and
|
||||
// sanitizes returned error messages
|
||||
@@ -280,6 +283,13 @@ func (mw DatabaseErrorSanitizerMiddleware) Close() (err error) {
|
||||
return mw.sanitize(mw.next.Close())
|
||||
}
|
||||
|
||||
func (mw DatabaseErrorSanitizerMiddleware) PluginVersion() logical.PluginVersion {
|
||||
if versioner, ok := mw.next.(logical.PluginVersioner); ok {
|
||||
return versioner.PluginVersion()
|
||||
}
|
||||
return logical.EmptyPluginVersion
|
||||
}
|
||||
|
||||
// sanitize errors by removing any sensitive strings within their messages. This uses
|
||||
// the secretsFn to determine what fields should be sanitized.
|
||||
func (mw DatabaseErrorSanitizerMiddleware) sanitize(err error) error {
|
||||
|
||||
Reference in New Issue
Block a user