feat: add RFC 5322 compliant email address parser ($400 bounty)#17
Open
zhangjiayang6835-cyber wants to merge 1 commit into
Open
feat: add RFC 5322 compliant email address parser ($400 bounty)#17zhangjiayang6835-cyber wants to merge 1 commit into
zhangjiayang6835-cyber wants to merge 1 commit into
Conversation
Implement a complete email address parser conforming to RFC 5322 sections 3.2–3.4 with obsolete syntax from §4.4. Features: - Full ABNF grammar: addr-spec, mailbox, name-addr, group, angle-addr - Comment and folding whitespace (CFWS/FWS) handling - Quoted-string local parts with quoted-pair escape sequences - Domain literals (IPv4, IPv6, text) - Display names (plain and quoted) - Address lists and group syntax - Obsolete syntax fallbacks (§4.4) - Nested comments support - 46 comprehensive unit tests covering all grammar rules Closes UnsafeLabs#1
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements a fully RFC 5322 compliant email address parser in Python, covering sections 3.2 through 3.4 with obsolete syntax support from §4.4.
Files
parser.py: Complete parser withAddressParserclass andRFC5322Addressdata classtest_parser.py: 46 unit tests covering all grammar rulesParser Capabilities
addr-spec:user@domain,user+tag@domain,a.long.local.part@sub.domain.co.ukname-addr:John Doe <john@example.com>,"Smith, John" <john@example.com>"john doe"@example.comwith escaped quotes/backslashesuser@[192.168.1.1],user@[IPv6:2001:db8::1]John (CEO) <john@example.com>Developers: alice@a.com, bob@b.com;a@x.com, b@y.comobs-local-part,obs-domain,obs-angle-addrTesting
Test Coverage
Closes #1