Keep the IMAP password out of error messages
Test and publish / test (push) Successful in 1m11s
Test and publish / publish (push) Successful in 48s

A refused IMAP command's error quoted the whole command, so a failed
LOGIN put the password into the log on every sync. The error now names
only the verb ("IMAP LOGIN failed: ..."). Carried over from web_server's
backend, which logged it the same way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-14 17:14:18 +01:00
co-authored by Claude Opus 5.5
parent e6ed29d4a9
commit 0d31332033
2 changed files with 38 additions and 1 deletions
+4 -1
View File
@@ -120,7 +120,10 @@ func (c *imapClient) sendCommandOK(cmd string) ([]string, error) {
// "<tag> BAD ..." otherwise; only the second field matters.
parts := strings.SplitN(status, " ", 3)
if len(parts) < 2 || parts[1] != "OK" {
return untagged, fmt.Errorf("command %q failed: %s", cmd, status)
// Only the verb, never the whole command: a failed LOGIN carries the
// password, and this error goes to the log.
verb, _, _ := strings.Cut(cmd, " ")
return untagged, fmt.Errorf("IMAP %s failed: %s", verb, status)
}
return untagged, nil
}