Skip to content

IMAP checker does not quote passwords or usernames with special characters #54

@wandernauta

Description

@wandernauta

The IMAP checker currently sends usernames and passwords as atoms (so unquoted), but this is only permitted if there are no special characters or spaces, which passwords may contain. If they do, the checker reports that the sentinel message was not found.

For instance, this configuration:

imap{
  servername="test.mailu.io",
  user="[email protected]",
  password="this is my passphrase",
  server="78.47.92.244"
}

with debug logging gives:

$ ./simplomon ../simplomon.conf
Detected working IPv6 connectivity
IPv6 checks: enabled
There are 1 checkers with 1 unique notifiers
Sending A0 login [email protected] this is my passphrase
Response is A0 BAD Error in IMAP command received by server.
Sending A1 namespace
Response is A1 BAD Error in IMAP command received by server.
Sending A2 select "INBOX"
Response is * BYE Too many invalid IMAP commands.
Response is Sending A3 uid search subject "Simplomon test message"
Response is Got 0 uids: []
.
Got 1 filtered results, ["imap: No recent sentinel message found"]

Per RFC9051, the "atom-specials" include (, ), {, %, *, double quote, backslash, space, and control characters. However, the easiest and most compatible approach may be to just always double-quote these fields (and backslash-escape any double-quotes or backslashes).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions