Skip to content

[Bug] Diagnostic loopback exemptions expose 127-prefixed private DNS names #7396

Description

@Afloat16

Description

The diagnostic visibility exemption in src/log-mask.ts treats every string beginning with 127. as an IP loopback address. A DNS name such as 127.customer.internal therefore bypasses the normal private-host mask.

Reproduction on the tested master:

  1. isLoopbackHost("127.customer.internal") returns true.
  2. maskUrlForDiagnostics("https://127.customer.internal:8443/v1") returns the private hostname unchanged.
  3. The real logHostEvent() path writes that hostname to its log file.
  4. describeUpstreamFailure() followed by buildProxyFailureResponse() includes the private hostname in both the structured host field and the visible 502 error.

Expected: only actual loopback addresses and the existing exact localhost exemption remain visible by default. A DNS prefix is not evidence of a literal loopback address.

The same endpoint-display boundary also mistakes the final address colon in a portless [::1] for a port delimiter, producing <private-host>:1]. It should retain [::1]; a private non-loopback IPv6 address without a port should become just <private-host>.

bili version

0.1.216, tested master 1e357bf2d6632bfbd2a74ffb70ecee1af1ec7cc3.

Usage mode

Other / not sure: shared host-event diagnostics and upstream-failure responses; cross-client code.

Client and version

Node.js 24.22.3. The regressions invoke real public masking helpers, the host-event file writer and failure-response builder.

Operating system

Linux x86_64.

Upstream and model

No external provider or model is required. All hostnames and credentials in the reproductions are synthetic.

Configuration

Default host masking; the existing explicit host-visibility opt-out is also covered. No new setting or routing change.

Validation and related work

The unchanged production fails six behavior regressions, with two compatibility controls passing. The fix passes 52/52 focused tests, including the existing real proxy/CONNECT/error-log tests, plus full TypeScript/build, unused-export, test-import-graph and whitespace checks.

The fix validates literal IPv4 addresses and retains numeric aliases such as 127.1 and 127.0x1 only after Node URL canonicalization yields a real 127/8 address. URL syntax cannot enter that fallback. Existing credentials/query/hash stripping, public-host visibility and the host-mask opt-out remain intact.

All-author/all-state searches and the latest 100 open PRs found no equivalent fix. #3653 and #4257 introduced these diagnostic exemptions; #6098 addressed credentials inside genuine loopback URLs. #7393 changes embedded URL scan complexity rather than host classification.

Triage

Priority: p2 (localized diagnostic privacy and endpoint-display defect). Scope: scope/other. Topic: N (server miscellaneous). Cross-client code; no single host-lane label.

Prepared branch: Afloat16/billion-context@2026-11-20_mask-loopback-like-hostnames.

Activity

  1. Afloat16 commented on Nov 20, 2026

    @Afloat16
    ContributorAuthor

    (ai: OpenAI/GPT-6 Astra Pro)

    The fix is in PR #7397: #7397 . It requires actual loopback addresses for diagnostic exemptions and preserves portless bracketed IPv6 endpoints. The unchanged base fails six behavior regressions; the fix passes 52 focused tests, including the real host-log writer and exact 502 response, plus typecheck/build and static gates. Full regression remains the remote CI lanes on the PR head.

    Triage: bug, p2, scope/other; Topic N. This is cross-client code, so no single host-lane label applies.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions