Skip to content

emrg: Redact LLM request/stream URLs in debug logs (query-string tokens in base_url) - #520

Merged
argszero merged 1 commit into
masterfrom
feature/llm-url-redaction
Aug 6, 2026
Merged

emrg: Redact LLM request/stream URLs in debug logs (query-string tokens in base_url)#520
argszero merged 1 commit into
masterfrom
feature/llm-url-redaction

Conversation

@argszero

@argszero argszero commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

Small follow-up to #518: the LLM debug log lines (LLM request: url=%s / LLM stream: url=%s in emrg/server/llm.py) logged the request URL verbatim. A user-configured base_url may embed credentials in the query string (e.g. https://api.example.com/v1?key=sk-...), which would leak into emrgd.log at DEBUG level.

Change

Both URL debug lines now pass through _redact_text() (the #518 inline-credential masker):

  • LLM request: url=%s ..._redact_text(url)
  • LLM stream: url=%s ..._redact_text(url)

Verified: ?key=sk-... in a URL becomes ?key=***; plain base URLs (e.g. https://olr-dev.shenbiai.net/.../chat/completions) are unchanged.

Verification

No new tests (reuses #518's _redact_text); pytest 493 + GUI 86 pass; 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 20260807-014520 (emrg-00c41753, author self-check, 1/3)

Verified live: URL with query-string key (?key=sk-...) → ?key=***; plain base URLs unchanged; llm.py syntax OK; pytest 493 + GUI 86 green. 2-line change reusing #518's _redact_text — the final URL surface in the LLM logging audit. No new tests needed (covered by existing _redact_text tests).

@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 20260807-013646 (emrg-00c41753, 2/3)

Verified in fresh worktree (branch 3d9b518): full suite 493 passed.

Adversarial checks on the URL redaction (beyond author's test): query-string api_key (sk-...) and token (ghp_...) masked; JWT in URL path masked; plain URLs and non-secret query params (model=, temperature=) preserved. Reuses _redact_text from #518 — consistent with the established chain (#513/#515/#516/#518), covers the remaining log surface (debug request URLs can carry query-string credentials).

Small, focused, correct. CI pending re-check.

@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 20260807-013646 (emrg-00c41753, 3/3)

Third independent vote. Branch content unchanged since the 2/3 deep review (3d9b518): 5/5 adversarial URL-redaction checks pass (query api_key/token masked, JWT-in-path masked, plain URL + non-secret query preserved), full suite 493 passed, reuses _redact_text chain. CI green (31124313401), MERGEABLE.

@argszero
argszero merged commit 2d8dfd2 into master Aug 6, 2026
1 check passed
@argszero
argszero deleted the feature/llm-url-redaction branch August 6, 2026 18:15
argszero added a commit that referenced this pull request Aug 6, 2026
…521)

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