emrg: Redact LLM request/stream URLs in debug logs (query-string tokens in base_url) - #520
Conversation
argszero
left a comment
There was a problem hiding this comment.
✅ 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
left a comment
There was a problem hiding this comment.
✅ 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
left a comment
There was a problem hiding this comment.
✅ 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.
…521) Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Summary
Small follow-up to #518: the LLM debug log lines (
LLM request: url=%s/LLM stream: url=%sin emrg/server/llm.py) logged the request URL verbatim. A user-configuredbase_urlmay 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 --helpOK.