Fix DKIM: use relaxed/relaxed canonicalization, reject non-FQDN senders#572
Merged
Fix DKIM: use relaxed/relaxed canonicalization, reject non-FQDN senders#572
Conversation
DKIM signing: Changed from simple/simple (library default) to relaxed/relaxed canonicalization. Google is strict about whitespace — simple mode causes verification failures if any mail processor touches header or body whitespace in transit. Also added explicit HeaderKeys list (from, to, subject, date, message-id, mime-version, content-type) instead of signing all headers, which is more predictable. SMTP sender validation: The inbound SMTP server was accepting mail from addresses like "no-reply@wetransfer" — that's not a valid FQDN (no dot in the domain). Added three validation checks before the existing anti-spoofing and blocklist: 1. Address must parse (mail.ParseAddress) 2. Must have a non-empty domain after @ 3. Domain must contain a dot (FQDN check) Rejects with 550 and logs the specific reason. https://claude.ai/code/session_01GRGLA9yj7BpqKiyi6xFwnm
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.
DKIM signing:
Changed from simple/simple (library default) to relaxed/relaxed canonicalization. Google is strict about whitespace — simple mode causes verification failures if any mail processor touches header or body whitespace in transit. Also added explicit HeaderKeys list (from, to, subject, date, message-id, mime-version, content-type) instead of signing all headers, which is more predictable.
SMTP sender validation:
The inbound SMTP server was accepting mail from addresses like "no-reply@wetransfer" — that's not a valid FQDN (no dot in the domain). Added three validation checks before the existing anti-spoofing and blocklist:
Rejects with 550 and logs the specific reason.
https://claude.ai/code/session_01GRGLA9yj7BpqKiyi6xFwnm