Skip to content

emrg: Redact log previews of user content (rant message, task prompt, memory tool results) - #516

Merged
argszero merged 1 commit into
masterfrom
feature/log-redaction-result-previews
Aug 6, 2026
Merged

emrg: Redact log previews of user content (rant message, task prompt, memory tool results)#516
argszero merged 1 commit into
masterfrom
feature/log-redaction-result-previews

Conversation

@argszero

@argszero argszero commented Aug 6, 2026

Copy link
Copy Markdown
Owner

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:

  1. (daemon.py:2346/2450) — first 100 chars of tool RESULT text, which for read_tool is file contents (a read of ~/.emrg/config.toml would dump the API key). emrg: Extend _redact to mask inline credentials in string values (sk-/ghp_/Bearer/JWT/base64-JSON) #513/emrg: Fix sk- redaction false positive on path fragments (task-evolution) — tighten key patterns #515 only covered tool-call ARGS.
  2. (daemon.py:894) — first 100 chars of the user's rant message (users paste tokens).
  3. (daemon.py:401) — first 60 chars of the user's prompt (same paste risk).

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 --help OK.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

@argszero
argszero merged commit 64520d8 into master Aug 6, 2026
1 check passed
@argszero
argszero deleted the feature/log-redaction-result-previews branch August 6, 2026 16:57
argszero added a commit that referenced this pull request Aug 6, 2026
…ry (#517)

* emrg: evolution_prompt quick-ref — add #516 log-preview-redaction entry

* emrg: re-trigger CI (runner cancellation)

---------

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant