Skip to content

Normalize domain input consistently and accept common paste formats (URL, port, *., IDN) #54

Closed

Description

@TMHSDigital

Why it matters

  • Inconsistent results. The same target produces different output depending on how it was given, which breaks dedup, diffing and downstream tooling.
  • Unhelpful errors. New users paste URLs and wildcards and get a bare "invalid domain format" error.

Evidence

  • A positional domain is validated but not normalized (main.go:253-258, and the TUI's internal/tui/form.go:354-360). -dL entries are lowercased and have trailing dots stripped (main.go:279).
    • Repro: subenum -simulate -seed 1 -hit-rate 100 -w w.txt Example.COM. outputs api.Example.COM..
    • The same domain via -dL outputs api.example.com.
  • internal/validate/validate.go:41-67 rejects each of the following with only invalid domain format: X:
    • https://example.com
    • example.com:443
    • *.example.com
    • bücher.de (IDN)
    • _dmarc.example.com, even though wordlist entries allow underscores (internal/wordlist/reader.go:14).

Suggested approach

  • Add validate.NormalizeDomain (trim spaces, lowercase, drop trailing dot) and use it in the positional, -dL and TUI paths.
  • Strip a scheme, path or port, or a leading *., and print a one-line notice.
  • Convert IDNs to punycode with golang.org/x/net/idna.
  • Allow underscores consistently.
  • Add targeted hints such as "looks like a URL; pass just the host".

Done when

All entry points produce identical output for Example.COM., example.com and https://example.com/, with table tests.

Activity

  1. added
    bug
    enhancement
    priority: medium
    area: cli
    on Oct 4, 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

    area: clibugenhancementpriority: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions