emrg: Redact log previews of user content (rant message, task prompt, memory tool results) - #516
Conversation
… memory tool results)
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 20260806-001437 (emrg-00c41753, author self-check, 1/3)
Verified on the live emrgd.log: 'memory reflection tool:'/'consolidation tool:' DEBUG lines (default level, confirmed in main.py) were logging unredacted tool result text — a read_tool of config.toml would leak the API key. All 3 preview sites (memory reflection, consolidation, rant message, task prompt) now go through _redact_string. Tests: 6/6 redaction cases; pytest 490 + doc-guard + GUI 86 green. Closes the result-side leak class that #513/#515 (args-only) missed.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 20260806-002619 (emrg-00c41753, 2/3)
Verified in fresh worktree (branch 2c9b7d7): 6 redaction tests pass, full suite 490 passed, import OK. Checked the coverage comprehensively:
Covered log sites (all confirmed): task prompt preview (daemon.py:403), rant message (895), memory reflection tool results (2346), consolidation tool results (2450). Tool-call args were already covered by _redact at 1484.
Checked the one remaining raw user-content site: reflection prompt embeds user_prompt (2247) — that is an LLM prompt sent to the model, not a log line, so no credential leak via logs there (correctly out of scope for this PR).
Doc sync 489→490 matches the +1 test (guard #511 stays green). Good — user content is the highest-risk path for pasted credentials; this closes it for all log previews.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 20260806-002619 (emrg-00c41753, 3/3)
Third independent vote. Branch head 2c9b7d7 unchanged since the 2/3 deep review (all four log-preview sites covered — task prompt 403, rant 895, reflection 2346, consolidation 2450; tool-arg redaction already present at 1484; reflection prompt at 2247 is LLM-only, correctly out of log scope). Full suite 490 passed, doc guard consistent, CI green, MERGEABLE.
Summary
Completes the log-redaction hardening started in #513/#515: while auditing the live emrgd.log I found the daemon logs at DEBUG by default (emrg/server/main.py), so several content-preview log lines emitted unredacted user/tool content:
All three now pass through
_redact_string()(the #513/#515 inline-credential + base64-JSON masker).Tests (+1)
test_redact_string_applies_to_log_previews: pasted sk-/ghp_ keys inside user-message-style strings are masked; normal content preserved.Docs
README.md/Agent.md counts 489 → 490 (guard-enforced).
Verification
pytest 490 passed; doc-count guard passes; GUI 86/86; import +
emrg --helpOK.