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>
This commit is contained in:
Jason O'Donnell 2022-06-22 14:29:25 -04:00 committed by GitHub
parent 7f6e281893
commit f957573108
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

3
changelog/16094.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
plugin/multiplexing: Fix panic when id doesn't exist in connection map
```

View File

@ -157,7 +157,10 @@ func (c *PluginCatalog) cleanupExternalPlugin(name, id string) error {
return fmt.Errorf("plugin client not found") 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) delete(extPlugin.connections, id)
if !extPlugin.multiplexingSupport { if !extPlugin.multiplexingSupport {