[WRONG BRANCH] fix(lab): redact ambiguous private hostnames - #252
Conversation
|
Warning Review limit reached
Next review available in: 28 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Its title has been prefixed with |
There was a problem hiding this comment.
💡 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; |
There was a problem hiding this comment.
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 👍 / 👎.
Motivation
db.prod-v2,api.internal2) to persist in Lab evidence, which is a privacy regression for durable provider-controlled diagnostics.Description
HOSTNAME_REto 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.tests/lab-evidence-sanitization.test.tsto assert standalone hyphenated/numeric hostnames and ambiguous dotted namespaces are replaced with[host].structure/09_compatibility-lab.mdto document the conservative redaction boundary for ambiguous dotted diagnostics.Testing
bun x bun test tests/lab-evidence-sanitization.test.ts -t 'SEC-02 sanitizer boundary'and it passed (all targeted tests green).bun run typecheckandbun run privacy:scan; both completed successfully.bun run testrun 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.sanitizeDiagnosticand confirming that"db.prod-v2","api.internal2", and ambiguous dotted tokens normalize to"[host]"as expected.Codex Task