Skip to content

ParseEndpoint rejects bracketed IPv6 endpoint URLs #4749

@officialasishkumar

Description

@officialasishkumar

Expected Behavior

Endpoint fields parsed by pkg/url.ParseEndpoint should accept valid URL host:port forms, including bracketed IPv6 literals such as https://[fd00::1]:443.

Current Behavior

ParseEndpoint currently splits url.Host with strings.Split(url.Host, ":"). For bracketed IPv6 hosts this produces more than two parts, so valid endpoints such as https://[fd00::1]:443 are rejected as invalid host.

This affects callers that validate or render endpoint fields through ParseEndpoint, including LogCollector additional store endpoints and NonClusterHost endpoints.

Possible Solution

Use the standard library host/port helpers for URL host parsing, so bracketed IPv6 literals are handled correctly while malformed host:port values still fail validation.

Steps to Reproduce (for bugs)

  1. Call pkg/url.ParseEndpoint("https://[fd00::1]:443").
  2. Observe that it returns an invalid host error.
  3. The endpoint is a valid URL host:port value and should parse to scheme https, host fd00::1, and port 443.

Context

IPv6 endpoint literals are valid URL hosts when bracketed. Rejecting them prevents users from configuring IPv6 endpoints in resources that rely on this parser.

Your Environment

  • Operating System and version: N/A
  • Link to your project (optional): N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions