aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2025-07-09 16:48:12 +0200
committerAleksandr Nogikh <nogikh@google.com>2025-07-10 08:52:48 +0000
commit2a9a3ab9ac5c9f66069e751a394482a38b36e29f (patch)
tree59d8e1a197c6afc2ef5e7a485628a2ecab84cdba
parent7356bdcc3a454e8477836dd53e5938e1e7312d62 (diff)
syz-cluster: detect all own emails
Detect own emails sent both via SMTP and via Dashapi. Add tests.
-rw-r--r--syz-cluster/email-reporter/stream.go3
-rw-r--r--syz-cluster/email-reporter/stream_test.go27
2 files changed, 30 insertions, 0 deletions
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: <new-thread>
+In-Reply-To: <whatever>
+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: <new-thread>
+In-Reply-To: <whatever>
+From: Ourselves <`+emailCfg.Dashapi.From+`>
+Content-Type: text/plain
+
+`)
+ msg = <-writeTo
+ assert.True(t, msg.OwnEmail)
+
t.Logf("stopping the loop")
cancel()