Skip to content

fix(platform): reapply HIGH #6 + SA auth-gating + VULN-004 SHA enforcement after platform→workspace-server rename - #956

Closed
molecule-ai[bot] wants to merge 19 commits into
stagingfrom
fix/test-token-adminauth-reapply
Closed

molecule-ai[bot] wants to merge 19 commits into
stagingfrom
fix/test-token-adminauth-reapply

Conversation

@molecule-ai

@molecule-ai molecule-ai Bot commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

[backend-agent]

Summary

PR #954 (fix/launch-high6-cp-auth-token-boot) has been in CONFLICTING state since the platform/ → workspace-server/ rename (#479a027). This PR reapplies all five change sets from #954 to the correct new paths, resolving the conflict cleanly.

Changes ported from #954:

  • GET /workspaces/:id auth-gating (SA security finding): Unauthenticated callers now receive only {id, name, agent_card:{name,description,version}}. Container URLs (agent_card.url, top-level url), current_task, active_tasks, and all topology fields are withheld. The endpoint returns 200 in both cases (not 401) so A2A peer discovery continues to work. Adds publicAgentCard() helper.

  • HIGH Add admin endpoint to mint deterministic test tokens (follow-up to PR #5) #6 EC2 boot token race fix: provisionWorkspaceCP now issues the auth token BEFORE calling cpProv.Start() and injects it as MOLECULE_AUTH_TOKEN in the boot environment. Previously, issuing AFTER Start caused the EC2 instance's first /registry/register call to be treated as a re-registration (returning no token), leaving the agent stuck at provisioning forever with 401 heartbeats.

  • Orphaned token revocation (security Q6): Both provisionWorkspaceOpts and provisionWorkspaceCP now use a startSucceeded defer pattern — if Start() fails, the freshly-issued token is revoked so it cannot be used by a never-launched workspace.

  • Full SHA-only enforcement (VULN-004, issue security: plugin supply chain hardening — require pinned refs and SHA256 manifest integrity (SAFE-T1102) #768): github.go now rejects branch names and movable tags (in addition to empty refs). Only a full 40-character hex commit SHA passes. Uppercase SHAs are normalized to lowercase. SHA refs use the correct git init + git fetch + git checkout FETCH_HEAD protocol instead of git clone --branch (which doesn't accept commit SHAs).

  • MOLECULE_AUTH_TOKEN bootstrap: workspace/platform_auth.py's get_token() reads the env var as a fallback after the .auth_token file, auto-persists it to disk (0600) on first use.

Test plan

Related

🤖 Generated with Claude Code

Hongming Wang and others added 19 commits April 18, 2026 00:47
Moved to private repo so the public monorepo only contains docs
useful for contributors and users:

Removed (now in Molecule-AI/internal):
- edit-history/ — 15 daily dev session logs
- retrospectives/ — session postmortems with ops details
- marketing/ — competitor analysis, SEO strategy, landing briefs
- product/ — PRD, SaaS strategy, growth research
- runbooks/ — SaaS ops (secrets rotation, GDPR, admin auth)
- security/ — internal security advisories
- research/ — competitive framework analysis
- ecosystem-watch.md — competitive landscape tracking
- demo/, spikes/ — internal prototypes
- known-issues.md, remote-workspaces-readiness.md

Also removed duplicate docs/architecture.md (superseded by
docs/architecture/overview.md).

Remaining public docs: architecture, API reference, adapters,
agent-runtime, plugins, guides, tutorials, development, frontend,
integrations, glossary, quickstart.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
chore: move internal docs to private repo
Removed:
- docs/.vitepress/ + package.json — docs site config belongs in Molecule-AI/docs
- scripts/bridge/ — internal Claude Code bridge server
- scripts/claude-code-bridge.py — internal agent bridge
- scripts/dedup_settings_hooks.py, verify_settings_hooks.py — internal maintenance

Gitignored:
- .mcp.json → .mcp.json.example (local MCP config, users create their own)
- test-results/ — ephemeral build artifacts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
chore: final cleanup — remove internal tooling, gitignore local config
Remove entries for org-templates/, plugins/, docs/.vitepress/dist/
that no longer exist. Deduplicate .claude-bridge/ entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Aligns CI workflow filename with the platform/ → workspace-server/ rename.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PRs targeting staging got no CI because the workflow only triggered
on main. Now runs on both main and staging pushes + PRs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The supply_chain.go implementation was merged in #937 but never called
from the actual install handler. Plugins with a manifest.json sha256
field now get verified before staging completes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…egrity

fix(plugins): wire VerifyManifestIntegrity into install pipeline
…names

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fix(docs): update cd commands for workspace-server/ and workspace/ renames
…rver rename

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fix(docs): architecture + API paths for workspace-server rename
…ace rename

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rm→workspace-server rename

Ports all changes from fix/launch-high6-cp-auth-token-boot to the renamed
workspace-server/ and workspace/ paths. Resolves the CONFLICTING state of
PR #954 by applying each change cleanly to its new location.

Changes applied:

1. workspace.go — GET /workspaces/:id auth-gating (SA finding):
   Authenticated callers get the full operational response; unauthenticated
   callers get only {id, name, agent_card:{name,description,version}} —
   stripping container URLs (SSRF risk), current_task, and topology fields.
   Adds publicAgentCard() helper to scrub agent_card.url.

2. workspace_provision.go — startSucceeded defer (security Q6):
   Revokes freshly-issued tokens if Start() fails, preventing orphaned
   tokens on 'failed' workspaces from authenticating API calls.

3. workspace_provision.go — HIGH #6 EC2 boot token race fix:
   Issues the auth token BEFORE cpProv.Start() and injects it as
   MOLECULE_AUTH_TOKEN in the boot env so EC2 agents don't race
   /registry/register. Token revocation guard added for CP path too.

4. plugins/github.go — full SHA-only enforcement (VULN-004):
   Strengthens the existing empty-ref check to also reject non-SHA refs
   (branch names, movable tags). Adds strings.ToLower normalization for
   uppercase clipboard SHAs. Uses git init+fetch+checkout for SHA refs
   instead of git clone --branch (which doesn't accept commit SHAs).

5. workspace/platform_auth.py — MOLECULE_AUTH_TOKEN bootstrap:
   get_token() now reads MOLECULE_AUTH_TOKEN env var as a fallback and
   auto-persists it to .auth_token (0600) on first access, surviving
   process restarts that don't inherit the original launch environment.

Tests: updates github_test.go with PLUGIN_ALLOW_UNPINNED=true guards on all
branch-ref tests; adds SHA enforcement regression suite. Updates workspace_test.go
and handlers_test.go for the auth-gating path. Adds test_platform_auth.py cases
for the MOLECULE_AUTH_TOKEN bootstrap.

Closes #954 conflict; supersedes fix/launch-high6-cp-auth-token-boot.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

Closing — this PR duplicates and conflicts with the open-source cleanup work already merged:

The changes in this PR (auth-gating, SHA enforcement, path renames) are either already on staging or need to be re-implemented on the current staging HEAD to avoid conflicts.

@molecule-ai
molecule-ai Bot deleted the fix/test-token-adminauth-reapply branch May 20, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant