Skip to content

Conversation

gbr-mendes
Copy link

This is a draft PR for issue #118569.

Motivation

RFC 6761 defines special-use domain names:

  • invalid and *.invalid must always return NXDOMAIN
  • localhost and *.localhost must always resolve to the loopback address

Currently, .NET relies fully on the OS resolver, which may allow invalid to resolve if defined in /etc/hosts or DNS, and may not handle *.localhost consistently across platforms.

Proposed approach

  • Intercept invalid and *.invalid before OS resolution → throw SocketException with HostNotFound (simulate NXDOMAIN).
  • Intercept localhost and *.localhost before OS resolution → return IPAddress.Loopback and IPAddress.IPv6Loopback.
  • Otherwise, fallback to the platform resolver as today.

Status

  • Draft PR to validate the idea/approach with maintainers.
  • No tests included yet.
  • Once approach is confirmed, I’ll proceed with the real implementation, unit tests and CI validation.

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Oct 3, 2025
Copy link
Contributor

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Net community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant