Skip to content

[WRONG BRANCH] fix(lab): redact ambiguous private hostnames - #252

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-lab-sanitizer-vulnerability
Draft

[WRONG BRANCH] fix(lab): redact ambiguous private hostnames#252
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-lab-sanitizer-vulnerability

Conversation

@luvs01

@luvs01 luvs01 commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Motivation

  • A recent change narrowed hostname redaction and allowed multi-label hostnames with numeric or hyphenated final labels (for example db.prod-v2, api.internal2) to persist in Lab evidence, which is a privacy regression for durable provider-controlled diagnostics.
  • The intent of this change is to fail closed for ambiguous dotted tokens that could be internal hostnames so the Lab does not accidentally record network identifiers.

Description

  • Tighten the hostname sanitizer by updating HOSTNAME_RE to match the full DNS label grammar (including private suffixes containing digits or hyphens) and to exclude plain version-like tokens, so ambiguous multi-label tokens are treated as hosts.
  • Adjust contextual logic so multi-label names are redacted as hostnames in durable evidence rather than relying on shape-only heuristics.
  • Add and update focused unit tests in tests/lab-evidence-sanitization.test.ts to assert standalone hyphenated/numeric hostnames and ambiguous dotted namespaces are replaced with [host].
  • Update structure/09_compatibility-lab.md to document the conservative redaction boundary for ambiguous dotted diagnostics.

Testing

  • Ran the focused suite bun x bun test tests/lab-evidence-sanitization.test.ts -t 'SEC-02 sanitizer boundary' and it passed (all targeted tests green).
  • Ran bun run typecheck and bun run privacy:scan; both completed successfully.
  • Attempted a full bun run test run but an in-flight edit and environment-sensitive timeouts produced unrelated failures during an earlier invocation; the regression was validated by the targeted test runs above.
  • Verified the sanitizer on representative inputs by importing sanitizeDiagnostic and confirming that "db.prod-v2", "api.internal2", and ambiguous dotted tokens normalize to "[host]" as expected.

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: 28 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: b7e56d2a-46d8-44d7-a796-de7c6bcf122c

📥 Commits

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

📒 Files selected for processing (3)
  • src/lab/artifacts/sanitize.ts
  • structure/09_compatibility-lab.md
  • 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 ambiguous private hostnames [WRONG BRANCH] fix(lab): redact ambiguous private hostnames Aug 11, 2026
@github-actions
github-actions Bot marked this pull request as draft August 11, 2026 00:55

@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: 4ebe9250a9

ℹ️ 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".

// single alternation — either the token ends cleanly, or it ends with an FQDN
// root dot that is itself followed by nothing label-shaped.
const HOSTNAME_RE = /(?<![\w.-])(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.){1,8}(?:xn--[a-z0-9-]{1,55}|[a-z]{2,24})(?:\.(?![\w-])|(?![\w.-]))/gi;
const HOSTNAME_RE = /(?<![\w.-])(?!v?[0-9.]+(?:\.|$))(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.){1,8}[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.(?![\w-])|(?![\w.-]))/gi;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Anchor the numeric-version exclusion to the whole token

When a private hostname starts with a numeric or version-like label, such as 1.internal, 123.example.com, or v2.internal, the new negative lookahead matches only the initial 1./v2. prefix and rejects the entire hostname. sanitizeDiagnostic consequently preserves these values verbatim even though the previous regex redacted them, allowing provider-controlled durable evidence to persist an internal hostname. Make the exclusion require the entire candidate to be a numeric version rather than accepting its first dot, and add numeric-leading hostname regression cases.

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