From 2a9a3ab9ac5c9f66069e751a394482a38b36e29f Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Wed, 9 Jul 2025 16:48:12 +0200 Subject: syz-cluster: detect all own emails Detect own emails sent both via SMTP and via Dashapi. Add tests. --- syz-cluster/email-reporter/stream.go | 3 +++ syz-cluster/email-reporter/stream_test.go | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/syz-cluster/email-reporter/stream.go b/syz-cluster/email-reporter/stream.go index c76826e27..4aa035cec 100644 --- a/syz-cluster/email-reporter/stream.go +++ b/syz-cluster/email-reporter/stream.go @@ -34,6 +34,9 @@ func NewLKMLEmailStream(repoFolder string, client *api.ReporterClient, if cfg.Dashapi != nil { ownEmails = append(ownEmails, cfg.Dashapi.From) } + if cfg.SMTP != nil { + ownEmails = append(ownEmails, cfg.SMTP.From) + } return &LKMLEmailStream{ cfg: cfg, ownEmails: ownEmails, diff --git a/syz-cluster/email-reporter/stream_test.go b/syz-cluster/email-reporter/stream_test.go index e98fd26d4..db92ce927 100644 --- a/syz-cluster/email-reporter/stream_test.go +++ b/syz-cluster/email-reporter/stream_test.go @@ -41,6 +41,9 @@ func TestEmailStream(t *testing.T) { writeTo := make(chan *email.Email, 16) emailCfg := &app.EmailConfig{ LoreArchiveURL: loreArchive.remoteRef(), + SMTP: &app.SMTPConfig{ + From: `syzbot@syzkaller.appspotmail.com`, + }, Dashapi: &app.DashapiConfig{ From: "bot@syzbot.org", ContextPrefix: "ci_", @@ -98,6 +101,30 @@ Content-Type: text/plain msg = <-writeTo assert.Equal(t, []string{report.ID}, msg.BugIDs) + t.Logf("own email (SMTP)") + loreArchive.saveMessage(t, `Date: Sun, 7 May 2017 19:55:00 -0700 +Subject: New thread +Message-ID: +In-Reply-To: +From: Ourselves <`+emailCfg.SMTP.From+`> +Content-Type: text/plain + +`) + msg = <-writeTo + assert.True(t, msg.OwnEmail) + + t.Logf("own email (dashapi)") + loreArchive.saveMessage(t, `Date: Sun, 7 May 2017 19:55:00 -0700 +Subject: New thread +Message-ID: +In-Reply-To: +From: Ourselves <`+emailCfg.Dashapi.From+`> +Content-Type: text/plain + +`) + msg = <-writeTo + assert.True(t, msg.OwnEmail) + t.Logf("stopping the loop") cancel() -- cgit mrf-deployment