[codex] Redact SSH tunnel diagnostics - #3412
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved Security-focused change that redacts sensitive information (credentials, secrets, paths) from SSH tunnel diagnostic logs. Changes are well-scoped with comprehensive test coverage verifying that secrets are not leaked. You can customize Macroscope's approvability policy. Learn more. |
868aec6
into
codex/effect-service-shared-ssh
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Problem
SSH tunnel readiness and lifecycle logs included complete forwarded URLs and nested causes. A forwarded request can contain credentials and private path, query, or fragment data, while HTTP client causes retain the complete request. Logging those objects directly leaks the values that structured errors intentionally preserve for the cause chain.
Changes
Validation
vp checkvp test packages/ssh/src/command.test.ts packages/ssh/src/tunnel.test.tsvp run typecheckThe focused tests use credentials plus private path, query, and fragment sentinels and verify exact cause identity without serializing those values into logs.
Note
Medium Risk
Touches SSH tunnel readiness, auth retry, and diagnostic paths where mis-redaction could hide debugging signal or mishandle causes; behavior is heavily test-covered but still security-sensitive logging.
Overview
SSH tunnel and command logging no longer emit full forwarded URLs or raw nested errors, reducing leakage of credentials, paths, query params, and fragments that structured errors still keep on the in-memory cause chain.
Tunnel lifecycle and readiness logs now use
getUrlDiagnostics/readinessUrlDiagnostics(protocol, hostname, lengths, query/fragment flags) instead ofhttpBaseUrlstrings.describeReadinessCausewalks Effect causes and errors with a depth cap, strips arbitrary messages, and surfaces tags/structure for log fields renamed fromcausetofailure(auth, stale tunnels, ready failures, target-resolve fallback logs onlyfailureTag).Tests assert secrets stay out of captured logs while HTTP transport causes remain identical on
SshReadinessProbeError.Reviewed by Cursor Bugbot for commit 9591bea. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Redact sensitive data from SSH tunnel diagnostic logs
describeReadinessCauseAtDepthhelper in tunnel.ts.describeReadinessCauseAtDepthproduces depth-bounded (max depth 6) descriptions of Effect Cause trees, preventing infinite recursion on cyclic structures and avoiding exposure of secrets in logs.getUrlDiagnostics()andreadinessUrlDiagnostics(), stripping userinfo, query, fragment, and path details from emitted log fields.startSshTunnelandSshEnvironmentManager, rawcausefields are replaced withfailure: describeReadinessCause(...)and rawhttpBaseUrlis replaced withhttpBaseUrlDiagnostics.resolveSshTargeterror log now emits onlyfailureTaginstead of the full cause object.Macroscope summarized 9591bea.