mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 06:06:02 +09:00
Adds checkEncryptionAtRest() to ruflo doctor. Reports four facets
without ever logging the key bytes:
1. Gate status — is CLAUDE_FLOW_ENCRYPT_AT_REST truthy?
2. Key resolution — does CLAUDE_FLOW_ENCRYPTION_KEY decode to a
valid 32-byte key (env-var path; keychain/passphrase deferred
to Phase 5+).
3. Key fingerprint — first 16 hex chars of sha256(key) so users
can sanity-check across machines without leaking the key.
4. Per-store breakdown — for each high-tier store
(sessions/, terminals, memory.db) report whether on-disk bytes
carry the RFE1 magic ("enc"), are plaintext ("plain"), missing
("∅"), or unreadable ("err").
Outputs:
Off: warn — "Off — session/terminal/memory stores are plaintext
(mode 0600 only)"
fix: "export CLAUDE_FLOW_ENCRYPT_AT_REST=1 && export
CLAUDE_FLOW_ENCRYPTION_KEY=<64-char-hex>"
On + missing key: fail (fail-closed) with key-generation hint
On + malformed key: fail with key-format hint
On + valid key: pass — "On — key fp:abcd1234… (sessions/=enc
terminals=enc memory.db=enc)"
Wired into both allChecks (always-on) and componentMap as
'encryption' so users can drill in via `ruflo doctor -c encryption`.
Tests (__tests__/doctor-encryption.test.ts, 5 cases):
- command runs cleanly with gate off
- command runs cleanly with gate on + valid key
- command runs cleanly with gate on + missing key (fail-closed)
- command runs cleanly with gate on + malformed key
- command reads a real encrypted blob without crashing
Verified: tsc --noEmit clean; doctor-encryption suite 5/5 green.
Closes ADR-096 acceptance-criteria item "ruflo doctor reports
encryption status" — last open box on the high-tier scope.