modern-email / defects

Collection of real-world email defects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Formats

EML/IMF

...

Protocols

IMAP

Note: "[...] do not attempt to deduce command syntax from the command section alone; instead refer to the Formal Syntax section."

Observed defects

Negative line length breaks parsing An IMAP server tells the number of lines in a message using the `body-fld-lines` ABNF rule:
body-fld-lines = number
number         = 1*DIGIT
                   ; Unsigned 32-bit integer
                   ; (0 <= n < 4,294,967,296)

According to the standard, negative values are not allowed. Still, Dovecot was observed sending -1 breaking parsing.

  • Observed in: Exchange/Dovecot (unknown)
  • Reported: No
  • Status: Unknown
  • Comment: Also see emersion/go-imap#534
  • Proposed solution(s):
    • Accept -1, emit warning, and rectify to 0 (implemented in imap-codec)
Missing `text` Status responses in IMAP MUST have a non-empty `text` (and preceeding space).
resp-text = ["[" resp-text-code "]" SP] text
text      = 1*TEXT-CHAR
TEXT-CHAR = <any CHAR except CR and LF>

It was observed that Gmail has neither the SP nor the text when using HIGHESTMODSEQ.

  • Observed in: Gmail (Sep. 27, 2023)
  • Reported: Yes
  • Status: Open
  • Comment: The examples in RFC 7162 are wrong, see errata.
  • Proposed solution(s):
    • Wait for Gmail to fix it (or comment on issue)
    • Replace with a sentinel value and log warning (implemented in imap-codec)
    • Discard, but make sure not to reproduce the defect
CHANGEDSINCE 0

CHANGEDSINCE 0 was sent for an account on a mail server that was update to support CONDSTORE (did not have the CONDSTORE extension before). CHANGEDSINCE should have been omitted from the command.

mod-sequence-value = 1*DIGIT
                      ;; Positive unsigned 63-bit integer
                      ;; (mod-sequence)
                      ;; (1 <= n <= 9,223,372,036,854,775,807).
  • Observed in: iPhone Mail (16.5.1)
  • Reported: Yes
  • Status: Open
  • Comment: None
  • Proposed solution(s): None
Not all variants of empty ID list are accepted

IMAP's ID command allows (), and nil to encode an empty parameter list:

id-params-list = "(" [field-value *(SP field-value)] ")" / nil
field-value    = string SP nstring

See #12 (comment).

Some servers don't recognize both variants.

  • Observed in: Nemesis (GMX, Web.de, ...), and Exchange (See #12 (comment))
  • Reported: No
  • Status: Unknown
  • Comment: None
  • Proposed solution(s):
    • Don't send an empty ID command. Note: Proxies may require extra attention!
Trailing space in untagged `STATUS` response

See emersion/go-imap#540

  • Observed in: Exchange (outlook.office365.com:993)
  • Reported: No
  • Status: Unknown
  • Comment: None
  • Proposed solution(s):
    • Consume the trailing space (making sure not to reproduce the defect.) Implemented in go-imap, imap-codec, and Ruby.

Ambiguities

`code` and `text` are ambiguous
Greeting { kind: Ok, code: None, text: "[FOO] ..." }

... will result in ...

* OK [FOO] ...

... and be interpreted like ...

Greeting { kind: Ok, code: Foo, text: "..." }

And ...

Greeting { kind: Ok, code: None, text: "[...]" }

... can't be expressed.

Unclear command continuation response(s) Unclear when base64 is allowed in command continuation responses.

+ Rm9vbw== could be interpreted as Fooo (base64) or just Rm9vbw== (text).

About

Collection of real-world email defects

License:MIT License