defense-in-depth: gate molecule-platform-mcp in the plugin INSTALL path #3050
Reference in New Issue
Block a user
Delete Branch "fix/3046-gate-platform-mcp-install-path"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #3046.
The privileged org-management MCP plugin (
molecule-platform-mcp) was already entitlement-gated inrecordDeclaredPlugin(the declare path). The INSTALL path —install_plugin→PluginsHandler.Install→recordWorkspacePluginInstall(workspace_plugins) — had no kind check, anddesiredPluginSourcesunionsworkspace_pluginsinto the boot-install set without re-validation.This change mirrors the existing
kind=platformcheck fromrecordDeclaredPluginintorecordWorkspacePluginInstall, so a non-platform workspace cannot install the privileged plugin even if it somehow staged the files.Tests
Test plan
go test ./workspace-server/internal/handlers/...passes (verified locally).Fixes #3046
SOP checklist
🤖 Generated with Claude Code
APPROVED. 5-axis review on head
8d78e484.Correctness: recordWorkspacePluginInstall now applies the same kind=platform entitlement gate used by recordDeclaredPlugin for the privileged molecule-platform-mcp plugin. This closes the install-path gap before any workspace_plugins row is written, while allowing the platform concierge to install the management MCP and leaving ordinary plugin installs unchanged.
Robustness: the kind lookup fail-closes on DB/read errors, which is appropriate for this privileged plugin. The check is scoped to the exact privileged plugin name, so normal install paths avoid the extra query and retain existing behavior.
Security: this is a meaningful defense-in-depth improvement because desiredPluginSources unions installed plugins into the boot-install set; non-platform workspaces can no longer use workspace_plugins as a bypass to obtain the org-management MCP surface.
Performance/readability: one small DB lookup only for the privileged name; comments and tests make the boundary clear. Tests cover platform allow, non-platform refusal before INSERT, and ordinary-plugin no-precheck behavior. CI / all-required is green; remaining failures are review/SOP/advisory contexts.
APPROVED after independent 5-axis review.
Correctness/security:
recordWorkspacePluginInstallnow fail-closes the privilegedmolecule-platform-mcpinstall path tokind=platform, matching the existing declaration gate and preventing a non-platform workspace from getting the org-management MCP throughworkspace_plugins. Robustness: DB kind lookup errors block the privileged install; ordinary plugins skip the extra query. Performance: only the privileged name pays the precheck. Readability/tests: localized change with tests for platform allowed, non-platform refused before INSERT, and ordinary-plugin no-precheck.CI / all-requiredis successful; I see SOP/gate contexts still failing pending acks/state, not code test failures./sop-ack comprehensive-testing
/sop-ack local-postgres-e2e
/sop-ack staging-smoke
/sop-ack root-cause
/sop-ack five-axis-review
/sop-ack no-backwards-compat
/sop-ack memory-consulted