Commit Graph

2 Commits

Author SHA1 Message Date
Molecule AI QA Engineer
1d74168a2a test(supply-chain): TDD spec for plugin supply-chain hardening (#768)
Adds platform/internal/plugins/supply_chain_test.go with 8 tests (7 from
the spec + 1 end-to-end combo) specifying both security controls.

Control 1 — SHA256 content integrity (tests 1-3 + end-to-end):
  Tests call VerifyManifestIntegrity(stagedDir string) error, which does
  NOT exist yet → 5 compile errors / build failure until supply_chain.go
  is written. Once stubbed to nil, SHA256Mismatch test fails at runtime.

  VerifyManifestIntegrity contract:
    - manifest.json absent → nil (backward compat)
    - manifest.json present, no sha256 field → nil (backward compat)
    - sha256 matches computed stagedDirDigest → nil
    - sha256 mismatch → error mentioning "sha256"

  stagedDirDigest algorithm (canonical, test + impl must agree):
    Walk all files except manifest.json, sorted by rel path,
    format each as "<rel>\x00<content>", concatenate, SHA256, hex.

Control 2 — Pinned-ref enforcement (tests 4-7):
  Tests call GithubResolver.Fetch with/without "#ref" fragment.
  Currently returns nil for bare refs → TestPluginInstall_UnpinnedRef_Rejected
  fails (GitRunner IS called; no "pinned ref" in error message).
  PLUGIN_ALLOW_UNPINNED=true escape hatch tested by test 7.

RED state summary (current):
  go test ./internal/plugins/... -v -run TestPluginInstall
  → build failed: 5× undefined: VerifyManifestIntegrity
  → (with no-op stub) 2 runtime failures:
       FAIL TestPluginInstall_SHA256Mismatch_AbortsInstall
       FAIL TestPluginInstall_UnpinnedRef_Rejected

Backend Engineer implementation checklist:
  [ ] Add supply_chain.go in package plugins with VerifyManifestIntegrity
  [ ] Add pinned-ref gate to GithubResolver.Fetch in github.go
  [ ] PLUGIN_ALLOW_UNPINNED=true check skips the gate
  [ ] All 8 tests GREEN before merge

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 16:41:32 +00:00
Hongming Wang
24fec62d7f initial commit — Molecule AI platform
Forked clean from public hackathon repo (Starfire-AgentTeam, BSL 1.1)
with full rebrand to Molecule AI under github.com/Molecule-AI/molecule-monorepo.

Brand: Starfire → Molecule AI.
Slug: starfire / agent-molecule → molecule.
Env vars: STARFIRE_* → MOLECULE_*.
Go module: github.com/agent-molecule/platform → github.com/Molecule-AI/molecule-monorepo/platform.
Python packages: starfire_plugin → molecule_plugin, starfire_agent → molecule_agent.
DB: agentmolecule → molecule.

History truncated; see public repo for prior commits and contributor
attribution. Verified green: go test -race ./... (platform), pytest
(workspace-template 1129 + sdk 132), vitest (canvas 352), build (mcp).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 11:55:37 -07:00