You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
email: address literals with extra brackets are accepted (user@[[192.168.0.1]]) #583
With ipv4_address=True or ipv6_address=True, email unwraps the domain part with domain_part.lstrip("[").rstrip("]"). lstrip/rstrip remove every leading [ and trailing ], so any number of brackets is accepted on either side, even unbalanced ones.
RFC 5321 §4.1.3: address-literal = "[" ( IPv4-address-literal / IPv6-address-literal / General-address-literal ) "]" – exactly one pair of brackets. All three values above are invalid.
Proposed fix
Remove exactly one bracket on each side (domain_part[1:-1]); the inner value then fails the IP check because it still contains a bracket. A PR follows.
Found while writing specification-based tests for a university software-testing project (NYCU). The investigation and this write-up were done with the help of an AI assistant (Claude Code); the reproduction was run on the current master.
Activity