Add 29 new tests across auth/, crypt/, and trust/ packages: - auth: concurrent sessions, token uniqueness, challenge expiry boundary, empty password, long/unicode usernames, air-gapped round-trip, expired refresh - crypt: wrong passphrase, empty/large plaintext, KDF determinism, HKDF info separation, checksum edge cases - trust: concurrent registry operations, tier validation, token expiry boundary, empty ScopedRepos behaviour, unknown capabilities Add benchmark suites: - crypt: Argon2, ChaCha20, AES-GCM, HMAC (1KB/1MB payloads) - trust: PolicyEvaluate (100 agents), RegistryGet, RegistryRegister Security audit documented in FINDINGS.md: - F1: LTHN hash used for password verification (medium) - F2: PGP private keys not zeroed after use (low, upstream limitation) - F3: Empty ScopedRepos bypasses repo scope check (medium) - F4: go vet clean, no math/rand, no secrets in error messages All tests pass with -race. go vet clean. Co-Authored-By: Virgil <virgil@lethean.io> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3.5 KiB
3.5 KiB
TODO.md — go-crypt
Dispatched from core/go orchestration. Pick up tasks in order.
Phase 0: Test Coverage & Hardening
- Expand auth/ tests — Added 8 new tests: concurrent session creation (10 goroutines), session token uniqueness (1000 tokens), challenge expiry boundary, empty password registration, very long username (10K chars), Unicode username/password, air-gapped round-trip, refresh already-expired session. All pass with
-race. - Expand crypt/ tests — Added 12 new tests: wrong passphrase decrypt (ChaCha20+AES), empty plaintext round-trip (ChaCha20+AES), 1MB payload round-trip (ChaCha20+AES), ciphertext-too-short rejection, key derivation determinism (Argon2id+scrypt), HKDF different info strings, HKDF nil salt, checksum of empty file (SHA-256+SHA-512), checksum of non-existent file, checksum consistency with SHA256Sum. Note: large payload test uses 1MB (not 10MB) to keep tests fast.
- Expand trust/ tests — Added 9 new tests: concurrent Register/Get/Remove (10 goroutines, race-safe), Tier 0 rejection, negative tier rejection, token expiry boundary, zero-value token expiry, concurrent List during mutations, empty ScopedRepos behaviour (documented as finding F3), capability not in any list, concurrent Evaluate.
- Security audit — Full audit documented in FINDINGS.md. 4 findings: F1 (LTHN used for passwords, medium), F2 (PGP keys not zeroed, low), F3 (empty ScopedRepos bypasses scope, medium), F4 (go vet clean). No
math/randusage. All nonces usecrypto/rand. No secrets in error messages. go vet ./...clean — No warnings.- Benchmark suite — Created
crypt/bench_test.go(7 benchmarks: Argon2Derive, ChaCha20 1KB/1MB, AESGCM 1KB/1MB, HMACSHA256 1KB, VerifyHMACSHA256) andtrust/bench_test.go(3 benchmarks: PolicyEvaluate 100 agents, RegistryGet, RegistryRegister).
Phase 1: Session Persistence
- Session storage interface — Extract in-memory session map into
SessionStoreinterface withGet,Set,Delete,Cleanupmethods. - SQLite session store — Implement
SessionStorebacked by go-store (SQLite KV). Migrate session tokens + expiry to persistent storage. - Background cleanup — Goroutine to purge expired sessions periodically. Configurable interval.
- Session migration — Backward-compatible: in-memory as default, optional persistent store via config.
Phase 2: Key Management
- Key rotation — Add
RotateKeyPair(userID, oldPassword, newPassword)to auth.Authenticator. Generate new keypair, re-encrypt metadata, update stored keys. - Key revocation — Implement revocation certificate flow. Currently
.revis a placeholder. - Hardware key support — Interface for PKCS#11 / YubiKey backing. Not implemented, but define the contract.
Phase 3: Trust Policy Extensions
- Approval workflow — Implement the approval flow that
NeedsApprovaldecisions point to. Queue-based: agent requests approval → admin reviews → approve/deny. - Audit log — Record all policy evaluations (agent, capability, decision, timestamp). Append-only log for compliance.
- Dynamic policies — Load policies from YAML/JSON config. Currently hardcoded in
DefaultPolicies(). - Scope wildcards — Support
core/*scope patterns in ScopedRepos, not just exact strings.
Workflow
- Virgil in core/go writes tasks here after research
- This repo's dedicated session picks up tasks in phase order
- Mark
[x]when done, note commit hash