Skip to content

Host gate accepts bare single-label names, fec0::/10, and a double trailing dot #339

Closed

Description

@beardthelion

is_public_http_url (crates/gitlawb-node/src/api/peers.rs:109) is the shared host-class gate for every operator-supplied outbound URL: peer announce, webhook creation, the boot-time peer prune. Three host forms get past it that the checklist around them clearly means to exclude.

Bare single-label names. The gate tests .local and .internal as suffixes, so a name with no dot never matches:

http://local/      ACCEPTED     http://foo.local/      rejected
http://internal/   ACCEPTED     http://foo.internal/   rejected
http://intranet/   ACCEPTED
http://wpad/       ACCEPTED
http://metadata/   ACCEPTED

A dotless name is resolved through whatever search domain the host is configured with, so on a node with search corp.example.com a peer row pointing at http://internal/ reaches internal.corp.example.com. POST /api/v1/peers/announce is unauthenticated, and a peer row's http_url is used for outbound sync-notify fan-out. ICANN's SAC053 and the IAB statement on dotless domains both treat these as names that should not be trusted to mean what they look like.

fec0::/10. The IPv6 arm rejects fc00::/7 and fe80::/10 with (s[0] & 0xfe00) == 0xfc00 || (s[0] & 0xffc0) == 0xfe80. Site-local is 0xfec0, and 0xfec0 & 0xffc0 is 0xfec0, so it falls through. RFC 3879 deprecated the range in 2004, which is an argument for rejecting it rather than for ignoring it.

A double trailing dot. The normalizer strips exactly one root dot, so localhost.. becomes localhost., which matches neither == "localhost" nor .ends_with(".localhost") and is accepted. I could not resolve that name here (getaddrinfo rejects the empty label), so this is a gap in the predicate rather than a demonstrated reachable target, and it is listed for completeness.

Fix direction

Reject a host with no dot that is not an IP literal, widen the site-local mask, and strip trailing dots to fixation instead of once. Table-driven cases for the accepted forms above, with the dotted forms kept as negative controls so the suffix checks stay proven.

Related, separate work

The peer surface has prune_non_public_peers (crates/gitlawb-node/src/db/mod.rs:2457) to sweep rows written before announce-time validation existed. Webhooks have no equivalent, so a webhook row registered before any tightening is still delivered to. Owner-gated and lower reach than the announce path, but it is the reason a widened predicate does not fully take effect on existing data. Worth doing in the same area, not in the same patch.

This issue covers the predicate only. The larger gap, that nothing validates what a hostname actually resolves to, is tracked separately.

Activity

  1. added
    crate:node
    kind:security
    sev:high
    subsystem:api
    subsystem:peers
    on Aug 15, 2026
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

    crate:nodekind:securitysev:highsubsystem:apisubsystem:peers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions