From f9575731081607424a6d5a9720f58b15dfe6050c Mon Sep 17 00:00:00 2001 From: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> Date: Wed, 22 Jun 2022 14:29:25 -0400 Subject: [PATCH] Fix bug where id not existing in multiplexing map causes panic (#16094) * multiplexing: guard against connection panic * changelog * Update vault/plugin_catalog.go Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com> Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com> --- changelog/16094.txt | 3 +++ vault/plugin_catalog.go | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelog/16094.txt diff --git a/changelog/16094.txt b/changelog/16094.txt new file mode 100644 index 000000000..edb10600d --- /dev/null +++ b/changelog/16094.txt @@ -0,0 +1,3 @@ +```release-note:bug +plugin/multiplexing: Fix panic when id doesn't exist in connection map +``` \ No newline at end of file diff --git a/vault/plugin_catalog.go b/vault/plugin_catalog.go index dcfa95203..9caaa2410 100644 --- a/vault/plugin_catalog.go +++ b/vault/plugin_catalog.go @@ -157,7 +157,10 @@ func (c *PluginCatalog) cleanupExternalPlugin(name, id string) error { return fmt.Errorf("plugin client not found") } - pc := extPlugin.connections[id] + pc, ok := extPlugin.connections[id] + if !ok { + return fmt.Errorf("plugin connection not found") + } delete(extPlugin.connections, id) if !extPlugin.multiplexingSupport {