zeroclaw/src
Víctor R. Escobar 152a996b66 fix: replace XOR cipher with ChaCha20-Poly1305 AEAD for secret encryption
The previous secret store used a repeating-key XOR cipher which is
cryptographically broken:
- Deterministic (no nonce) — identical plaintexts produce identical
  ciphertexts
- No authentication — tampered ciphertext decrypts silently
- Vulnerable to known-plaintext attacks (e.g., "sk-" prefix reveals
  key bytes)

Replace with ChaCha20-Poly1305 authenticated encryption:
- Random 12-byte nonce per encryption (non-deterministic)
- Poly1305 authentication tag detects tampering
- Uses the same 32-byte key file (no migration needed for keys)

New ciphertext format is `enc2:<hex(nonce || ciphertext || tag)>`.
Legacy `enc:` values (XOR) are still decryptable for backward
compatibility during migration.

Adds chacha20poly1305 0.10 crate (pure Rust, no C dependencies).

New tests: tamper detection, wrong-key rejection, nonce uniqueness,
truncation handling, legacy XOR backward compatibility.

CWE-327 / CRIT-1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:43:02 +01:00
..
agent refactor: simplify CLI commands and update architecture docs 2026-02-14 05:17:16 -05:00
channels refactor: simplify CLI commands and update architecture docs 2026-02-14 05:17:16 -05:00
config refactor: simplify CLI commands and update architecture docs 2026-02-14 05:17:16 -05:00
cron feat: initial release — ZeroClaw v0.1.0 2026-02-13 12:19:14 -05:00
gateway fix: resolve all clippy --all-targets warnings across 15 files 2026-02-14 03:52:57 -05:00
heartbeat fix: resolve all clippy --all-targets warnings across 15 files 2026-02-14 03:52:57 -05:00
integrations refactor: simplify CLI commands and update architecture docs 2026-02-14 05:17:16 -05:00
memory fix: resolve all clippy --all-targets warnings across 15 files 2026-02-14 03:52:57 -05:00
observability fix: resolve all clippy --all-targets warnings across 15 files 2026-02-14 03:52:57 -05:00
onboard refactor: simplify CLI commands and update architecture docs 2026-02-14 05:17:16 -05:00
providers refactor: simplify CLI commands and update architecture docs 2026-02-14 05:17:16 -05:00
runtime fix: resolve all clippy --all-targets warnings across 15 files 2026-02-14 03:52:57 -05:00
security fix: replace XOR cipher with ChaCha20-Poly1305 AEAD for secret encryption 2026-02-14 13:43:02 +01:00
skills fix: resolve all clippy --all-targets warnings across 15 files 2026-02-14 03:52:57 -05:00
tools refactor: simplify CLI commands and update architecture docs 2026-02-14 05:17:16 -05:00
tunnel fix: resolve all clippy --all-targets warnings across 15 files 2026-02-14 03:52:57 -05:00
lib.rs feat: initial release — ZeroClaw v0.1.0 2026-02-13 12:19:14 -05:00
main.rs refactor: simplify CLI commands and update architecture docs 2026-02-14 05:17:16 -05:00