Only a bare address passes — display names, angle brackets, trailing content and address lists are rejected via the Name/Address checks.
Behaviour change:ParseAddress doesn't require a dotted domain, so alice@localhost now validates. Stricter domain rules should be a separate explicit check.
Also rewrites FuzzEmail (which asserted every input is invalid — only passing because the seed corpus is empty) into no-panic / stable-verdict / expected-error-type checks. Ran clean for 15s of -fuzz locally; full go test ./... green.
Replaces the RFC 5322 mega-regexp in `email.go` with `net/mail.ParseAddress`.
```go
addr, err := mail.ParseAddress(value)
if err != nil || addr.Name != "" || addr.Address != value {
return ErrInvalidEmail
}
```
Only a bare address passes — display names, angle brackets, trailing content and address lists are rejected via the `Name`/`Address` checks.
**Behaviour change:** `ParseAddress` doesn't require a dotted domain, so `alice@localhost` now validates. Stricter domain rules should be a separate explicit check.
Also rewrites `FuzzEmail` (which asserted *every* input is invalid — only passing because the seed corpus is empty) into no-panic / stable-verdict / expected-error-type checks. Ran clean for 15s of `-fuzz` locally; full `go test ./...` green.
Closes #7
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Replace the RFC 5322 mega-regexp with net/mail.ParseAddress, which is the
standard library's address parser and far easier to audit. A bare address
is required: inputs with a display name, angle brackets, a comment, or
trailing content are rejected, as is an address list.
Behaviour change: ParseAddress does not require the domain to contain a
dot, so "alice@localhost" now validates. Layer Match or a DNS lookup on
top if a stricter domain is needed.
Also rewrites FuzzEmail, which previously asserted that *every* input is
invalid, into checks that Email never returns an unexpected error type,
never panics, and gives a stable verdict.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Replaces the RFC 5322 mega-regexp in
email.gowithnet/mail.ParseAddress.Only a bare address passes — display names, angle brackets, trailing content and address lists are rejected via the
Name/Addresschecks.Behaviour change:
ParseAddressdoesn't require a dotted domain, soalice@localhostnow validates. Stricter domain rules should be a separate explicit check.Also rewrites
FuzzEmail(which asserted every input is invalid — only passing because the seed corpus is empty) into no-panic / stable-verdict / expected-error-type checks. Ran clean for 15s of-fuzzlocally; fullgo test ./...green.Closes #7
🤖 Generated with Claude Code