From 4e51aee1a9cf6f3b747a637f6e33744f1d73a7ca Mon Sep 17 00:00:00 2001 From: DonVoo Date: Sun, 5 Jul 2026 21:27:35 +0200 Subject: [PATCH] Redact IMAP login errors --- backend/04-imap-source.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/04-imap-source.go b/backend/04-imap-source.go index 459249e..2d520b4 100644 --- a/backend/04-imap-source.go +++ b/backend/04-imap-source.go @@ -123,7 +123,7 @@ func dialIMAP(host string, port int, security string, insecure bool) (*simpleIMA } func (c *simpleIMAP) login(user, pass string) error { - return c.simple("LOGIN " + imapQuote(user) + " " + imapQuote(pass)) + return c.simpleLabel("LOGIN "+imapQuote(user)+" "+imapQuote(pass), "LOGIN "+imapQuote(user)+" ") } func (c *simpleIMAP) selectMailbox(name string) error { @@ -131,6 +131,10 @@ func (c *simpleIMAP) selectMailbox(name string) error { } func (c *simpleIMAP) simple(cmd string) error { + return c.simpleLabel(cmd, cmd) +} + +func (c *simpleIMAP) simpleLabel(cmd, label string) error { tag := c.nextTag() if _, err := fmt.Fprintf(c.w, "%s %s\r\n", tag, cmd); err != nil { return err @@ -147,7 +151,7 @@ func (c *simpleIMAP) simple(cmd string) error { if strings.Contains(line, " OK") { return nil } - return fmt.Errorf("imap %s failed: %s", cmd, strings.TrimSpace(line)) + return fmt.Errorf("imap %s failed: %s", label, strings.TrimSpace(line)) } } }