mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 06:06:02 +09:00
Dream-cycle #2752 (arXiv 2607.16199 PlanFlip + persistent memory poisoning): planning-phase injection cascades to every downstream sub-agent; memory poisoning survives write-time defenses. Both attack surfaces share ChannelGuard's detector signature (injection phrases, role-shift, encoded payloads, zero-width unicode), so this delivery is a bounded engineering fix rather than a new subsystem. Two integration surfaces: 1. PlanFlip — `ruflo security scan-plan` Scans an agent-emitted plan (inline via -p or --plan-file <path>). Gate FIRES on high-severity findings (default) or ANY finding (--strict). Exit 2 signals fire so callers can gate distribution. 2. MemPoison — `ruflo memory store --scan-content` Runs the scanner on the value BEFORE persistence and refuses the write with exit 2 on any finding. Also activated globally via RUFLO_MEMORY_SCAN_ON_WRITE=1 for safety-critical flows. Failing the scan does not fall through to the sql.js path — refusal is authoritative. Non-critical scanner errors log dim and continue. Both gates reuse ChannelGuard's scanChannelMessage from the shared security/injection-catalog + channel-guard modules — adding a phrase to the catalog now strengthens: composition-scan, channel-scan, scan-plan, and memory store --scan-content simultaneously. E2E verified in a fresh scratch cwd against the shipped CLI: - memory store --scan-content "ignore previous instructions ..." → exit 2, "MemPoison gate refused write (#2752)" - memory store --scan-content "benign design note ..." → stored - RUFLO_MEMORY_SCAN_ON_WRITE=1 memory store "…delete all files" → exit 2, refused - security scan-plan --plan-file plan.md (with injected step) → exit 2, "FIRE — plan should not be distributed" Regression tests: - planflip-mempoison-2752.test.ts: 6/6 pass (detector + 3 CLI wire E2E tests using real execFileSync against bin/cli.js) - Total security tests (#2752 + #2783): 21/21. Refs: dream-cycle #2752 (2026-07-21). Co-Authored-By: RuFlo <ruv@ruv.net>