fix: harden secret redaction, cache perms, and CRLF parsing#1
fix: harden secret redaction, cache perms, and CRLF parsing#1marcelo-maciel wants to merge 1 commit into
Conversation
Security and cross-OS hardening from a full-source audit: - Redact todo content/activeForm in buildTodoStr and before persisting lastTodos to the state cache, matching lookupTask. Prevents a secret pasted into a todo from rendering raw or landing raw on disk. - Write all atomicWrite caches (utils + both hooks) with mode 0600 so cost / rate-limit / account-adjacent data stays owner-only on shared *nix hosts. No-op on Windows. - Trim contentStr in transcript parsing so a CRLF /clear record still triggers the conversation reset across OSes. - Add GitHub Actions matrix (ubuntu/macos/windows x node 20/22) running node --test to verify cross-OS behavior that cannot be run locally.
|
VEREDITO: APROVAR — hardening correto e bem escopado; redação, perms 0600 e trim de CRLF estão certos, sem bug nem regressão (25/25 testes verdes). ResumoPR pequeno (6 arquivos, ~50 linhas), só hardening (sem breaking change, sem dependência nova). Revisei o diff inteiro nas 5 dimensões (aderência ao repo, bugs no diff, histórico, código adjacente, comentários). Nenhum achado 🔴/🟡 sobreviveu ao corte de confiança. Validação local
Achados🔵 Sugestão — sem teste de regressão para os dois comportamentos novos
A matriz CI nova ( + // test-effort.js — /clear com CRLF ainda reseta
+ test('clear-crlf-resets', () => {
+ const r = run(userCmd('/clear\r', '', '2026-06-03T11:00:00Z') + assistantTurn());
+ assert.strictEqual(r.turnCount, 0, 'clear-crlf-resets');
+ });+ // test-util.js (ou test-effort.js) — segredo em TodoWrite não persiste cru
+ test('todo-secret-redacted-on-parse', () => {
+ const secret = 'a'.repeat(40);
+ const r = run(todoWrite([{content:`sk-ant-${secret}`, status:'in_progress', activeForm:`sk-ant-${secret}`}]));
+ assert.ok(!JSON.stringify(r.lastTodos).includes(secret), 'todo-secret-redacted-on-parse');
+ });(Os helpers
Perguntas
|
Context
Full-source security + cross-OS audit of ccvitals. Verdict: cross-OS solid, security good. Findings below are hardening, not exploitable vulns.
Changes
buildTodoStrandparseTranscriptnow redact todocontent/activeForm, matchinglookupTask. Stops a secret pasted into a todo from rendering raw or persisting raw to the state cache.atomicWritecaches (utils.js+ both hooks) written withmode 0600so cost/rate-limit data stays owner-only on shared *nix hosts. No-op on Windows.contentStrtrimmed in transcript parsing so a CRLF/clearrecord still triggers the reset across OSes.node --test— verifies cross-OS behavior that cannot be run locally (dev is win32-only).Verification
node --test: 25/25 pass (baseline and post-edit)./clear\rrecord resets turnCount.Out of scope (deliberate)
S2/S3/S5/S6, C2, C3 — info or already mitigated. No schema change, no new dependency.