Skip to content

NormalizeDomain keeps a trailing dot and ignores Unicode full stops #281

Closed

Description

@TMHSDigital

Summary

validate.NormalizeDomain can return a domain that still ends in a dot, and it does not treat Unicode full stops (。, ., 。) as label separators. The result is a target that is not in canonical form, and normalising it a second time gives a different answer.

Where

  • internal/validate/validate.go:116 (NormalizeDomain): strings.TrimSuffix(s, ".") removes only one dot, and runs before the IDN conversion
  • internal/validate/validate.go (Domain): accepts a name ending in a dot

Details

Observed at 69ab79a:

input result
example.com.. example.com. (accepted)
bücher.example.. xn--bcher-kva.example. (accepted)
bücher.example。 xn--bcher-kva.xn--example-dp3f (the full stop becomes part of a label)
bücher.example.。 xn--bcher-kva.example.xn--r6j

IDNA (UTS #46) maps U+3002, U+FF0E and U+FF61 to ., so a pasted Japanese or Chinese domain ending in 。 should be read as that domain, not as one with an extra label.

Found by a fuzz target added for #259 (FuzzNormalizeDomain: an accepted domain should normalise to itself).

Impact

Low. A target typed or pasted with a trailing .. or an ideographic full stop is scanned under a name that is not the user's domain (or with a stray trailing dot in output and diffs), and different entry points may disagree on the canonical form.

Steps to reproduce

  1. go test -run '^$' -fuzz '^FuzzNormalizeDomain$' -fuzztime 30s ./internal/validate/, or
  2. Call validate.NormalizeDomain("example.com..") and see "example.com." with no error.

Suggested fix

Map the Unicode full stops to . before splitting, trim every trailing dot (or reject more than one), and make Domain reject a trailing dot so non-canonical names cannot pass. Add the inputs above to validate_test.go.

Acceptance criteria

  • NormalizeDomain never returns a name ending in ..
  • bücher.example。 normalises to xn--bcher-kva.example.
  • FuzzNormalizeDomain runs for a few minutes without failures.

Getting started

  • Relevant files: internal/validate/validate.go, internal/validate/validate_test.go, internal/validate/fuzz_test.go
  • How to run tests: go test ./internal/validate/
  • Related docs: docs/cli.md (target normalisation)

Related: #54


Filed by repo-audit/fix-issues at 69ab79a. Severity: low. Effort: S. audit-key: bug|internal/validate/validate.go|NormalizeDomain-trailing-dot

Activity

  1. added
    bug
    good first issue
    severity: low
    on Nov 14, 2026
  2. added a commit that references this issue on Nov 14, 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

    buggood first issueseverity: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions