You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Addresses Codex round-1 review (2026-06-04T21:43Z, CHANGES_REQUESTED):
1. Authorization / x-api-key / cookie / proxy-authorization redacted in
debug log via a small redactHeaders() helper. Same discipline as
bootstrap-defense.mjs's audit-record contract: never spread raw headers
to log code. [REDACTED] sentinel preserves "header was present" signal.
2. Gated all stdout/stderr behind CACHE_FIX_DEBUG. Removed the nine
module-top console.log(config.X) lines (fired on every import,
embedder-hostile) and the four ungated console.error() calls in the
dispatcher / forwardRequest catch. All debug surfaces now flow through
debugLog, which self-gates on process.env.CACHE_FIX_DEBUG === "1".
3. Dispatcher now awaits handleMessages / handleBootstrap inside an
async IIFE wrapped by try/catch — rejections from preForward() or
pipeline hooks no longer escape to unhandledRejection.
4. Fixed two misleading diagnostics: clientRes.url / .method are
undefined (those are request fields); replaced with clientReq.method /
.url in the pre.handled branch. Removed the bytesWritten lines (those
are socket-lifetime counters, not per-response payloads).
5. 500 fallback body is generic ({"error":"internal_proxy_error"}) — no
longer echoes error.message, which could leak internal paths or
upstream URLs.
Also:
- Removed unused fs imports (readFileSync/writeFileSync/renameSync).
- Wired mkdirSync for log-dir bootstrap (was imported but unwired).
- LOG_PATH now overridable via CACHE_FIX_DEBUG_LOG for test isolation.
- Live env read on every debugLog call (matches image-strip's #98 gate).
Test coverage in test/proxy-server-debug-log.test.mjs:
- /health hit with debug off creates no log file (no-noise control)
- Authorization / x-api-key / cookie / proxy-authorization all redact
- Non-sensitive header values still appear (over-redaction guard)
- Module import produces no stdout when CACHE_FIX_DEBUG unset (spawn child)
- Static: 500 body has no error.message echo; dispatcher awaits handlers
Co-authored-by: Aleksandr Usenko <nisqatsi@users.noreply.github.com>
0 commit comments