marcbradshaw / mail-dkim

Mail::DKIM Perl module, forked from svn://svn.code.sf.net/p/dkimproxy/code/Mail-DKIM/trunk
0 stars 13 forks source link

Bad wrapped DKIM formatted signatures #15

Open bigio opened 1 month ago

bigio commented 1 month ago

In some cases, when using DKIM::TextWrap, some spaces are added between keys and values (d=, s=).
Example:

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= server0.domain.tld; h=from:message-id:
date:to :subject:mime-version:content-type:content-transfer-encoding; s= main; bh=fd...
marcbradshaw commented 4 weeks ago

FWS is allowed in those places as defined in section 3.5 of RFC6376, is the a parser that is failing to parse these?

s= The selector subdividing the namespace for the "d=" (domain) tag
      (plain-text; REQUIRED).

      Internationalized selector names MUST be encoded as A-labels, as
      described in [Section 2.3 of [RFC5890]](https://datatracker.ietf.org/doc/html/rfc5890#section-2.3).

      ABNF:

      sig-s-tag    = %x73 [FWS] "=" [FWS] selector

And in the header list

      sig-h-tag       = %x68 [FWS] "=" [FWS] hdr-name
                         *( [FWS] ":" [FWS] hdr-name )
bigio commented 3 weeks ago

I bet I saw a parser that fails with those headers but I cannot find the email that failed atm, I will update the issue if I find it.