The vulnerability lies in the handling of channel plugin discovery during the setup process. The functions resolveChannelSetupEntries, resolveScopedChannelPluginId, and setupChannels all relied on catalog lookup functions (listChannelPluginCatalogEntries and getChannelPluginCatalogEntry) that did not differentiate between trusted, bundled plugins and untrusted plugins located in the workspace. This allowed for a 'workspace plugin shadow' attack, where a malicious plugin in the workspace could impersonate a legitimate one.
The patch addresses this by introducing a new layer of trust verification. The new file src/commands/channel-setup/trusted-catalog.ts exports functions like listTrustedChannelPluginCatalogEntries and getTrustedChannelPluginCatalogEntry. These functions wrap the original catalog lookup functions and check if a workspace plugin is explicitly trusted in the configuration. If a workspace plugin is not in the allowlist, the functions fall back to using only the bundled plugins by calling the original functions with an excludeWorkspace: true option. The vulnerable functions were then updated to use these new trusted lookup functions, ensuring that only trusted plugins are considered during channel setup.