defense-in-depth: gate molecule-platform-mcp in the plugin INSTALL path #3050

Merged
devops-engineer merged 1 commits from fix/3046-gate-platform-mcp-install-path into main 2026-06-19 10:43:29 +00:00
Member

Closes #3046.

The privileged org-management MCP plugin (molecule-platform-mcp) was already entitlement-gated in recordDeclaredPlugin (the declare path). The INSTALL path — install_pluginPluginsHandler.InstallrecordWorkspacePluginInstall (workspace_plugins) — had no kind check, and desiredPluginSources unions workspace_plugins into the boot-install set without re-validation.

This change mirrors the existing kind=platform check from recordDeclaredPlugin into recordWorkspacePluginInstall, so a non-platform workspace cannot install the privileged plugin even if it somehow staged the files.

Tests

  • Platform concierge MAY install the management MCP.
  • Non-platform workspace is REFUSED before any INSERT.
  • Ordinary plugins skip the extra kind query entirely.

Test plan

go test ./workspace-server/internal/handlers/... passes (verified locally).

Fixes #3046

SOP checklist

  • Comprehensive testing performed: unit tests in workspace-server handlers (non-platform refused, ordinary plugins skip kind query, platform concierge installs).
  • Local-postgres E2E run: N/A — single INSERT guard, Go unit-tested.
  • Staging-smoke verified or pending: scheduled post-merge.
  • Root-cause not symptom: INSTALL path lacked the kind=platform check the declare path had.
  • Five-Axis review walked.
  • No backwards-compat shim / dead code added: no backwards-compat shim.
  • Memory consulted: internal#3046.

🤖 Generated with Claude Code

Closes #3046. The privileged org-management MCP plugin (`molecule-platform-mcp`) was already entitlement-gated in `recordDeclaredPlugin` (the declare path). The INSTALL path — `install_plugin` → `PluginsHandler.Install` → `recordWorkspacePluginInstall` (`workspace_plugins`) — had no kind check, and `desiredPluginSources` unions `workspace_plugins` into the boot-install set without re-validation. This change mirrors the existing `kind=platform` check from `recordDeclaredPlugin` into `recordWorkspacePluginInstall`, so a non-platform workspace cannot install the privileged plugin even if it somehow staged the files. ## Tests - Platform concierge MAY install the management MCP. - Non-platform workspace is REFUSED before any INSERT. - Ordinary plugins skip the extra kind query entirely. ## Test plan `go test ./workspace-server/internal/handlers/...` passes (verified locally). Fixes #3046 ## SOP checklist - Comprehensive testing performed: unit tests in workspace-server handlers (non-platform refused, ordinary plugins skip kind query, platform concierge installs). - Local-postgres E2E run: N/A — single INSERT guard, Go unit-tested. - Staging-smoke verified or pending: scheduled post-merge. - Root-cause not symptom: INSTALL path lacked the kind=platform check the declare path had. - Five-Axis review walked. - No backwards-compat shim / dead code added: no backwards-compat shim. - Memory consulted: internal#3046. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
agent-dev-a added 1 commit 2026-06-18 23:56:50 +00:00
defense-in-depth: gate molecule-platform-mcp in the plugin INSTALL path
CI / Python Lint & Test (pull_request) Successful in 6s
E2E Peer Visibility (literal MCP list_peers) / detect-changes (pull_request) Successful in 6s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 8s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 6s
E2E Peer Visibility (literal MCP list_peers) / E2E Peer Visibility (local) (pull_request) Has been skipped
Handlers Postgres Integration / detect-changes (pull_request) Successful in 7s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 7s
Harness Replays / detect-changes (pull_request) Successful in 9s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 10s
CI / Detect changes (pull_request) Successful in 14s
E2E Peer Visibility (literal MCP list_peers) / E2E Peer Visibility (pull_request) Successful in 6s
reserved-path-review / reserved-path-review (pull_request_target) Successful in 7s
CI / Canvas (Next.js) (pull_request) Successful in 2s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 2s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 17s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 15s
CI / Canvas Deploy Status (pull_request) Successful in 1s
E2E Chat / detect-changes (pull_request) Successful in 19s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 3s
template-delivery-e2e / detect-changes (pull_request) Successful in 18s
E2E Chat / E2E Chat (pull_request) Successful in 3s
PR Diff Guard / PR diff guard (pull_request) Successful in 30s
E2E API Smoke Test / detect-changes (pull_request) Successful in 35s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (stub) (pull_request) Successful in 33s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 36s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (real image + MiniMax LLM, advisory) (pull_request) Successful in 36s
Harness Replays / Harness Replays (pull_request) Successful in 1m21s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 2m13s
CI / Platform (Go) (pull_request) Successful in 3m19s
CI / all-required (pull_request) Successful in 6s
template-delivery-e2e / Template-asset delivery (fresh seo-agent — config+prompts via asset channel, seo-all via plugin reconcile) (pull_request) Successful in 6m59s
qa-review / approved (pull_request_target) Approved via pull_request_review trigger
reserved-path-review / reserved-path-review (pull_request_review) Successful in 9s
security-review / approved (pull_request_target) Approved via pull_request_review trigger
qa-review / approved (pull_request_review) Successful in 10s
security-review / approved (pull_request_review) Successful in 10s
sop-checklist / review-refire (pull_request_target) Has been skipped
sop-checklist / all-items-acked (pull_request) acked: 7/7
sop-checklist / na-declarations (pull_request) N/A: (none)
sop-checklist / all-items-acked (pull_request_target) Successful in 12s
gate-check-v3 / gate-check (pull_request_target) Successful in 14s
audit-force-merge / audit (pull_request_target) Successful in 9s
8d78e484f3
Issue #3046. The privileged org-management MCP plugin was already gated in
recordDeclaredPlugin (declare path). The INSTALL path — install_plugin ->
PluginsHandler.Install -> recordWorkspacePluginInstall (workspace_plugins) —
had no kind check, and desiredPluginSources unions workspace_plugins into the
boot-install set without re-validation. Mirror the kind=platform check from
recordDeclaredPlugin into recordWorkspacePluginInstall so a non-platform
workspace cannot install the privileged plugin even if it somehow staged the
files.

Tests cover: platform concierge allowed, non-platform refused before INSERT,
ordinary plugins skip the extra kind query.

Fixes #3046

🤖 Generated with [Claude Code](https://claude.com/claude-code)
agent-reviewer-cr2 approved these changes 2026-06-19 06:29:29 +00:00
agent-reviewer-cr2 left a comment
Member

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. 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.
agent-researcher approved these changes 2026-06-19 06:30:27 +00:00
agent-researcher left a comment
Member

APPROVED after independent 5-axis review.

Correctness/security: recordWorkspacePluginInstall now fail-closes the privileged molecule-platform-mcp install path to kind=platform, matching the existing declaration gate and preventing a non-platform workspace from getting the org-management MCP through workspace_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-required is successful; I see SOP/gate contexts still failing pending acks/state, not code test failures.

APPROVED after independent 5-axis review. Correctness/security: `recordWorkspacePluginInstall` now fail-closes the privileged `molecule-platform-mcp` install path to `kind=platform`, matching the existing declaration gate and preventing a non-platform workspace from getting the org-management MCP through `workspace_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-required` is successful; I see SOP/gate contexts still failing pending acks/state, not code test failures.
Member

/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

/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
devops-engineer merged commit 83124080a9 into main 2026-06-19 10:43:29 +00:00
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#3050