Skip to content

[WRONG BRANCH] fix(lab): redact bare hosts after socket errors - #249

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-host-redaction-for-bare-words
Draft

[WRONG BRANCH] fix(lab): redact bare hosts after socket errors#249
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-host-redaction-for-bare-words

Conversation

@luvs01

@luvs01 luvs01 commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Motivation

  • The sanitizer regressed and left bare single-label hosts (e.g. redis, gateway) and some host:port forms unredacted after socket/error markers such as ECONNREFUSED and ETIMEDOUT, leaking internal service names in Lab artifacts.

Description

  • Expand the strong host-context handling in src/lab/artifacts/sanitize.ts to treat resolver and socket-state markers (including ECONNREFUSED, ETIMEDOUT, EHOSTUNREACH, and dial tcp|udp) as destination-bearing contexts while still preserving prose safeguards.
  • Preserve explicit port evidence by matching host:port or … on port <n> first and redacting the host portion before other heuristics run.
  • Change token scanning logic to first redact obvious host-shaped tokens, then permit a bare single-label token only while the tail still looks like a destination (and not ordinary prose), avoiding earlier under‑ or over-redaction failures.
  • Add focused regression tests in tests/lab-evidence-sanitization.test.ts that assert redaction for socket-error forms (ECONNREFUSED redis, ETIMEDOUT gateway, dial tcp redis, etc.) while preserving natural-language connect to cases.

Testing

  • Ran bun run typecheck which succeeded locally in the environment used for the change.
  • Ran bun run privacy:scan which succeeded in this environment.
  • Executed direct sanitizer checks via a short script importing sanitizeDiagnostic and validated the updated cases (8 targeted checks) which passed.
  • bun test tests/lab-evidence-sanitization.test.ts and the full bun run test were blocked in this execution environment due to a Bun runtime mismatch (host has Bun 1.2.14 while the project expects Bun 1.3.14 and node:zlib lacks zstdDecompressSync), so the full suite could not be completed here.

Codex Task

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@luvs01, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 31 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 506f23a8-ce9b-45e4-8b67-45be723e062a

📥 Commits

Reviewing files that changed from the base of the PR and between 6d881db and c825f1e.

📒 Files selected for processing (2)
  • src/lab/artifacts/sanitize.ts
  • tests/lab-evidence-sanitization.test.ts

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 11, 2026
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev.

What to do

  • Retarget this PR to dev — all contributions go to dev.

Its title has been prefixed with [WRONG BRANCH].
This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions github-actions Bot changed the title fix(lab): redact bare hosts after socket errors [WRONG BRANCH] fix(lab): redact bare hosts after socket errors Aug 11, 2026
@github-actions
github-actions Bot marked this pull request as draft August 11, 2026 00:51

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c825f1ed54

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (token && isHostCandidate(token, resolver)) return m.replace(token, "[host]");
if (!token) continue;
if (isHostCandidate(token)) return m.replace(token, "[host]");
if (bareNamePossible && isHostCandidate(token, true)) return m.replace(token, "[host]");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid treating arbitrary errno prose as a hostname

When a socket error is followed by ordinary prose whose first word is absent from PROSE_AFTER_MARKER, isHostCandidate(token, true) accepts that word as a bare hostname. Consequently, common diagnostics such as ETIMEDOUT waiting for response become ETIMEDOUT [host] for response; worse, ETIMEDOUT connecting to gateway redacts connecting while leaving the actual host gateway exposed. Use positive destination syntax rather than a finite prose stoplist, and add regression cases for these phrasing variants.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant