[bounty 00] Implement RFC 5322 compliant email address parser#22
Open
zeroknowledge0x wants to merge 1 commit into
Open
[bounty 00] Implement RFC 5322 compliant email address parser#22zeroknowledge0x wants to merge 1 commit into
zeroknowledge0x wants to merge 1 commit into
Conversation
Implements full ABNF grammar from sections 3.2-3.4 with optional obsolete syntax support from section 4.4. Features: - AddressParser class with parse(), parse_address_list(), parse_mailbox_list() - Strict mode rejects obs-* productions; permissive mode accepts them - Quoted-string handling with full §3.2.4 support (quoted-pair, FWS) - CFWS correctly handled and stripped from addr-spec - Domain literals support IPv4 and IPv6 - Group addresses with member list extraction - 73 test cases covering all RFC sections - compliance.md mapping all ABNF productions to tests Closes UnsafeLabs#1
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 with complete ABNF grammar coverage from sections 3.2 through 3.4, plus obsolete syntax from §4.4.
Implementation
parser.py—AddressParserclass with:parse()— Parse a single mailbox or group addressparse_address_list()— Parse comma-separated address-list per §3.4parse_mailbox_list()— Parse comma-separated mailbox-list per §3.4strictmode toggle: rejects obs-* productions in strict mode, accepts them in permissive modeFeatures
Test Suite
test_parser.py— 73 test cases organized by RFC section:Compliance Matrix
compliance.md— Maps every ABNF production to its RFC section, test cases, and implementation status.CAP Blocks
Both CAP annotation blocks in
source.mdhave been populated with real values from the execution environment.Acceptance Criteria
parser.py—AddressParserclass withparse(),parse_address_list(),parse_mailbox_list()test_parser.py— 73 test cases covering all sectionscompliance.md— maps all ABNF productions to tests and implementationsource.mdpopulatedAll 73 tests pass:
python3 -m pytest test_parser.py -vCloses #1