Repository navigation
fix: preserve mail evidence and correct RFC parsing - #180
Merged
Merged
Conversation
Preserve file octets and MIME metadata, validate date semantics, include named inline text in body views, decode display words in lexical context, and scan Received fields structurally with safe sender-IP attribution. Keep recovery diagnostics and raw evidence, including unsafe codec output. Add targeted regressions and audited corpus fingerprints. Document the intentional file-input charset compatibility change and shared review rules. RFC review: RFC 5322 sections 3.3, 3.4, 3.6.7, 4 and 5; RFC 5321 section 4.4; applicable RFC 2045/2046, 2047, 2183, 2231 and 6532 requirements. Validation: 1238 tests and 5 subtests passed on Python 3.13 and 3.14; 69 corpus cases checked across Python 3.9-3.14 without new exceptions. Pre-commit, lint and Pyright passed. Dedicated security review completed; all reproduced High/Medium findings fixed and retested.
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.
Description
This PR fixes parsing behavior that could discard original bytes, silently normalize impossible dates, or interpret delimiters in the wrong context. Recovery preserves the original evidence and reports defects even when it succeeds.
Date,Resent-Date, andReceivedtimestamps while retaining valid obsolete syntax.Receivedfields structurally and prevent forged HELO content from influencing sender-IP attribution.Adds targeted tests, regression checks against the existing corpus, and updates documentation and the shared security-review procedure.
Validation: 1,238 tests and 5 subtests passed on Python 3.13 and 3.14. All 69 corpus cases were checked across Python 3.9–3.14 without new exceptions. Pre-commit, lint, and Pyright passed. A dedicated security review completed with no remaining High/Medium findings.
Compatibility: file input now honors the declared charset, consistently with the bytes API. Messages with incorrect charset declarations may display differently; their original bytes remain available.
Reviewed against RFC 5322 §§3.3–3.4, 3.6.7, 4–5 and applicable SMTP/MIME standards.