Skip to content

Remove the unreachable '::1' entry from LOCAL_HOSTS #75

Description

@N-thnI

Description

Drop dead code and make loopback detection consistent.

Problem Statement

src/network/index.ts:41const LOCAL_HOSTS = new Set(['localhost', '127.0.0.1', '[::1]', '::1']); is tested against parsed.hostname (line 72).

The WHATWG URL parser always returns IPv6 hostnames in bracketed form (new URL('http://[::1]:8000').hostname === '[::1]'), so the bare '::1' entry can never match and is dead.

The set also misses the rest of the loopback range (127.0.0.0/8, e.g. 127.0.0.2), so allowInsecureLocalhost behaves inconsistently for hosts a developer would reasonably consider local.

Proposed Changes

  • Drop the unreachable '::1' entry
  • Replace the exact-match set with a loopback predicate covering 127.0.0.0/8, [::1], and localhost
  • Add tests for http://127.0.0.2:8000 and http://[::1]:8000 under allowInsecureLocalhost

Technical Implementation Scaffolding

  • Target Repository: vero-sdk
  • Target Path: src/network/index.ts
  • Branch Naming: fix/issue--loopback-host-detection
  • Authority Context: Correctness — dead code and inconsistent local detection

Acceptance Criteria

  • validateUrl('http://[::1]:8000', { allowInsecureLocalhost: true }) succeeds and validateUrl('http://[::1]:8000') throws INVALID_URL
  • http://127.0.0.2 is treated consistently with http://127.0.0.1
  • No unreachable entries remain in the host set

Definition of Done

  • Reviewed by lead maintainer
  • Pull request merged via verified status check

Activity

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

Metadata

Metadata

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions