v3/docs/adr/ADR-364-dream-cycle-security-plugin-supply-chain-scanner.md
Status: Proposed
Authors: claude (dream-cycle agent, 2026-07-11)
Dream Cycle Issue: #TBD (filed tonight)
Supersedes: None
Related: ADR-178 (IPI / VMG / RepE context-level injection), ADR-150 (MetaHarness integration)
ADR numbering note: Three prior unmerged dream-cycle branches (dream/2026-07-09-swarm, dream/2026-07-10-performance, tonight) all claim ADR-364 because the formula reads from
mainwhere ADR-178 is the last merged entry. Human reviewer must resolve on merge — recommend renumbering tonight's as ADR-181 if both prior branches merge first.
The 2026 research literature documents a rapid escalation in agent skill/plugin supply-chain attacks:
collaboration namespace.Ruflo's plugin registry (@claude-flow/plugins) publishes 21 optional plugins via IPFS/Pinata. The publish path (npx ruflo plugins publish) pins a JSON manifest and plugin bundle to IPFS with no pre-flight security scan. The install path (npx ruflo plugins install @name) fetches the CID with no AST analysis, no dependency graph walk, and no runtime permission manifest.
The @claude-flow/security module (InputValidator, PathValidator, SafeExecutor) addresses system-boundary injection but has no plugin-scoped security surface. There is no published OWASP GenAI Top 10 mapping for Ruflo — a visible gap in the security documentation that no competitor has filled (first-mover opportunity).
Add PluginScanner to v3/@claude-flow/security/src/plugin-scanner.ts, exported from @claude-flow/security.
Trigger: Called by npx ruflo plugins publish before Pinata pin; also callable standalone via npx ruflo security scan --plugin <path>.
Analysis layers (in order):
AST credential extraction scan: Flag process.env access to sensitive keys, fs.readFile/fs.readFileSync on paths matching /(\.env|secrets?|credentials?|\.ssh|\.aws)/i, and eval/Function() constructs.
Network exfiltration scan: Flag outbound fetch/axios/got/http.request calls to hosts not declared in the plugin's allowedHosts manifest field.
Hook injection scan: Flag registration of hooks (pre-task, post-task, pre-edit, post-edit, session-start, session-end) that are not declared in the plugin's hooks manifest field.
Dependency graph walk (arXiv:2607.01136 pattern): Recursively scan all transitive require/import dependencies up to depth 5. Flag any dep not in node_modules that matches the above patterns.
Result: ScanResult { passed: boolean; findings: Finding[]; grade: 'A'|'B'|'C'|'FAIL' }. Gate: FAIL blocks publish. C requires --force-publish flag and writes finding to IPFS pin metadata.
Neuro-symbolic enhancement (Phase 2, optional): Integrate the pattern from arXiv:2603.27204 — train a lightweight classifier on MalSkillBench (3,944 malicious skills) to supplement AST rules. Target: ≥90% F1 (reference: 93% in paper). Phase 2 is not blocked on ADR approval.
Add declarative permission manifests to v3/@claude-flow/cli/src/plugins/manager.ts.
Manifest schema (added to existing plugin.json / IPFS bundle):
{
"permissions": {
"env": ["ANTHROPIC_API_KEY"],
"net": ["api.pinata.cloud"],
"fs": ["./data/plugin-name/**"],
"hooks": ["pre-task", "post-task"]
}
}
Runtime enforcement: Wrap every plugin tool call in a PermissionGuard that checks the declared manifest. Violations:
plugin:permission-violation event (observable via npx ruflo status --events)~/.claude/security-events.jsonl with timestamp, plugin ID, violation typeMemory integrity seal (arXiv:2603.15727 / ClawWorm mitigation): In the post-edit hook, HMAC-sign values written to shared namespaces (collaboration, patterns) using a per-session key. On read, verify HMAC before passing to downstream agents. Prevents cross-agent memory poisoning via compromised plugins.
Produce docs/security/owasp-genai-top10-mapping.md mapping all 10 OWASP GenAI v2025 entries to Ruflo's @claude-flow/security module. Minimum per-entry: current status (Covered/Partial/Gap), relevant Ruflo component, and open remediation task.
ADR-364 deliverables map to:
SafeExecutor (document as Covered)PluginScanner is composable: usable standalone, in CI, and as a gating step in the plugin publish flowplugins publish adds a scan step (~1–5s for typical plugin bundles); --skip-scan flag available for internal/known-safe plugins only with explicit overridenode_modules/ stdlib equivalents required| Phase | Deliverable | Target |
|---|---|---|
| 1 (sprint) | PluginScanner AST scan + plugins publish gate | v3.7.1 |
| 1 (sprint) | Plugin manifest schema + PermissionGuard runtime | v3.7.1 |
| 1 (sprint) | OWASP GenAI Top 10 mapping document | v3.7.1 |
| 2 (research) | Memory HMAC integrity seal for collaboration namespace | v3.8.0 |
| 2 (research) | Neuro-symbolic scanner Phase 2 (MalSkillBench training) | v3.8.0 |
Generated by Ruflo Dream Cycle agent — 2026-07-11. Do not self-merge.