Skip to content

Add version pinning to plugin catalog#24960

Merged
tomhjp merged 5 commits intomainfrom
vault-21610/pin-plugin-version
Jan 26, 2024
Merged

Add version pinning to plugin catalog#24960
tomhjp merged 5 commits intomainfrom
vault-21610/pin-plugin-version

Conversation

@tomhjp
Copy link
Contributor

@tomhjp tomhjp commented Jan 19, 2024

This implements new functionality in the plugin catalog to store pinned versions, and consumes it for database, secrets, and auth plugins. The intention is to allow Vault admins who have access to the plugin catalog to enforce that all sub-namespaces should use a particular version, so that they can safely manage the lifecycle of plugins in the catalog without having to enumerate all child namespaces.

However, to keep the size of this PR reasonable, there's no HTTP API implementation yet for managing pins, so it's not usable in a proper server yet. Without the HTTP API, it's hard to write a good test for the database plugin as it can't reach into the private plugin catalog of the core, so I'll add the integration test for database plugins along with the HTTP API.

@tomhjp tomhjp added this to the 1.16.0-rc1 milestone Jan 19, 2024
@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Jan 19, 2024
@github-actions
Copy link

github-actions bot commented Jan 19, 2024

CI Results:
All Go tests succeeded! ✅

@tomhjp tomhjp force-pushed the vault-21610/pin-plugin-version branch 2 times, most recently from b7ed8e7 to 7ced796 Compare January 19, 2024 21:09
vault/auth.go Outdated
Comment on lines 191 to 198
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several chunks of logic similar to this have been consolidated inside c.newCredentialBackend and c.newLogicalBackend.

No HTTP API implementation yet for managing pins, so no user-facing effects yet
@tomhjp tomhjp force-pushed the vault-21610/pin-plugin-version branch from 7ced796 to 88e76a1 Compare January 19, 2024 22:35
@tomhjp tomhjp marked this pull request as ready for review January 19, 2024 22:37
@tomhjp tomhjp requested a review from a team as a code owner January 19, 2024 22:37
func (b *databaseBackend) getPinnedVersion(ctx context.Context, pluginName string) (string, error) {
extendedSys, ok := b.System().(logical.ExtendedSystemView)
if !ok {
return "", fmt.Errorf("database backend does not support running as an external plugin")
Copy link
Contributor Author

@tomhjp tomhjp Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was already true because the database plugin uses logical.SystemView methods that are not available over the gRPC implementation of SystemView. In hindsight, those methods (like ListVersionedPlugins) probably should also have been added to logical.ExtendedSystemView instead.

@github-actions
Copy link

github-actions bot commented Jan 19, 2024

Build Results:
All builds succeeded! ✅

Copy link
Contributor

@fairclothjm fairclothjm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tomhjp tomhjp enabled auto-merge (squash) January 26, 2024 17:18
@tomhjp tomhjp merged commit af27ab3 into main Jan 26, 2024
@tomhjp tomhjp deleted the vault-21610/pin-plugin-version branch January 26, 2024 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core/plugin hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed pr/no-changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants