Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication Results parser fails if smtp.remote-ip/policy.iprev contains an IPv6 address #436

Closed
MASHtm opened this issue Mar 7, 2024 · 4 comments
Labels

Comments

@MASHtm
Copy link

MASHtm commented Mar 7, 2024

If the authentication results parser sees something like

iprev=pass (mail-qt1-x829.google.com) smtp.remote-ip=2607:f8b0:4864:20::829;

it fails with

DKIM_Verifier.AuthVerifier	ERROR	 Ignoring error in parsing of ARH DKIM_Error: Parsing error
    match moz-extension://ea39292a-878c-4d82-943c-2ad127dc3587/modules/arhParser.mjs.js:354
    parseResInfo moz-extension://ea39292a-878c-4d82-943c-2ad127dc3587/modules/arhParser.mjs.js:188
    parse moz-extension://ea39292a-878c-4d82-943c-2ad127dc3587/modules/arhParser.mjs.js:158
    getARHResult moz-extension://ea39292a-878c-4d82-943c-2ad127dc3587/modules/authVerifier.mjs.js:265
    verify moz-extension://ea39292a-878c-4d82-943c-2ad127dc3587/modules/authVerifier.mjs.js:177

in the console.

Setting this to an IPv4 address immediately fixes the parser error.
Setting "Try to read non RFC compliant Authentication-Results header" also fixes the issue, but this header is RFC compliant enough IMO.

And yes, smtp.remote-ip= is not defined/valid according to the latest IANA registry and it should read

iprev=pass (mail-qt1-x829.google.com) policy.iprev=2607:f8b0:4864:20::829;

which fails to parse as well. I will file a bug for Exim to get this property changed. But AFAIS the extension doesn't care much about unknown ptype.property=value pairs as long as it can parse it as such.

@lieser
Copy link
Owner

lieser commented Mar 11, 2024

Thanks for the detailed report.

The problem are the : inside the IPv6 address, which is only allowed in a value that is inside a quoted-string.

And yes, smtp.remote-ip= is not defined/valid according to the latest IANA registry and it should read

As you write yourself, this should not be a problem.
The extension only cares that the ptype.property=value pairs conform to the syntax in the RFC, not that they are registered in the IANA.
One should of course try to use the ones registered where it makes sense.

@MASHtm
Copy link
Author

MASHtm commented Mar 11, 2024

The problem are the : inside the IPv6 address, which is only allowed in a value that is inside a quoted-string.

Only to get that right... you mean according to RFC 8601:2.2. Formal Definition: ....
"The "value" is as defined in Section 5.1 of [MIME] with
"quoted-string" updated as specified in [RFC6532]" ...

which more or less refers back to RFC5322:3.2.3 Atom ... where dot-atom-atext allows IPv4 addresses, but not IPv6 addresses which needs to be quoted because "specials,, qtext, ...." count.

If I got it right I'll take this to the Exim people ... maybe with a patch in hand;-)

@lieser
Copy link
Owner

lieser commented Mar 12, 2024

"The "value" is as defined in Section 5.1 of [MIME] with
"quoted-string" updated as specified in [RFC6532]" ...

That part is correct, unsure how you are coming to the dot-atom-atext.

From https://datatracker.ietf.org/doc/html/rfc2045#section-5.1

     value := token / quoted-string

     token := 1*<any (US-ASCII) CHAR except SPACE, CTLs,
                 or tspecials>

     tspecials :=  "(" / ")" / "<" / ">" / "@" /
                   "," / ";" / ":" / "\" / <">
                   "/" / "[" / "]" / "?" / "="
                   ; Must be in quoted-string,
                   ; to use within parameter values

As : is part of tspecials it can only appear inside a quoted-string.

@MASHtm
Copy link
Author

MASHtm commented Mar 13, 2024

thanks. will be fixed in Exim then... closing this issue.

@MASHtm MASHtm closed this as completed Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants