From 0d1223f1dc0faefcf010d6ee3e5a1e9571a1ad1a Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 17 Jul 2025 12:30:43 +0200 Subject: syz-cluster: keep only one Cc list in SessionReport Currently, the list was both within the Series object and within the SessionReport object that also encloses Series. And, since only was was actually filled, we were unable to actually Cc the people from the series. Keep only the Cc list in the Series object and adjust the tests. --- syz-cluster/email-reporter/handler.go | 4 ++-- syz-cluster/pkg/api/api.go | 1 - syz-cluster/pkg/controller/testutil.go | 8 +++++--- syz-cluster/pkg/report/template.txt | 2 +- syz-cluster/pkg/report/testdata/1.in.json | 2 +- syz-cluster/pkg/report/testdata/2.in.json | 2 +- syz-cluster/pkg/reporter/api_test.go | 6 ++++-- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/syz-cluster/email-reporter/handler.go b/syz-cluster/email-reporter/handler.go index 7ea229483..5074ad24f 100644 --- a/syz-cluster/email-reporter/handler.go +++ b/syz-cluster/email-reporter/handler.go @@ -71,7 +71,7 @@ func (h *Handler) report(ctx context.Context, rep *api.SessionReport) error { } toSend := &emailclient.Email{ Subject: "Re: " + rep.Series.Title, // TODO: use the original rather than the stripped title. - To: rep.Cc, + To: rep.Series.Cc, Body: body, Cc: []string{h.emailConfig.ArchiveList}, BugID: rep.ID, @@ -85,7 +85,7 @@ func (h *Handler) report(ctx context.Context, rep *api.SessionReport) error { } // We assume that email reporting is used for series received over emails. toSend.InReplyTo = rep.Series.ExtID - toSend.To = rep.Cc + toSend.To = rep.Series.Cc } msgID, err := h.sender(ctx, toSend) if err != nil { diff --git a/syz-cluster/pkg/api/api.go b/syz-cluster/pkg/api/api.go index 95cf73ae5..128be02ba 100644 --- a/syz-cluster/pkg/api/api.go +++ b/syz-cluster/pkg/api/api.go @@ -129,7 +129,6 @@ type NewSession struct { type SessionReport struct { ID string `json:"id"` - Cc []string `json:"cc"` Moderation bool `json:"moderation"` Series *Series `json:"series"` Findings []*Finding `json:"findings"` diff --git a/syz-cluster/pkg/controller/testutil.go b/syz-cluster/pkg/controller/testutil.go index 9ec90f190..752f9e433 100644 --- a/syz-cluster/pkg/controller/testutil.go +++ b/syz-cluster/pkg/controller/testutil.go @@ -6,13 +6,14 @@ package controller import ( "context" "fmt" + "net/http/httptest" + "testing" + "time" + "github.com/google/syzkaller/syz-cluster/pkg/api" "github.com/google/syzkaller/syz-cluster/pkg/app" "github.com/google/syzkaller/syz-cluster/pkg/db" "github.com/stretchr/testify/assert" - "net/http/httptest" - "testing" - "time" ) type EntityIDs struct { @@ -59,6 +60,7 @@ func DummySeries() *api.Series { ExtID: "ext-id", Title: "test series name", Link: "http://link/to/series", + Cc: []string{"first@user.com", "second@user.com"}, Patches: []api.SeriesPatch{ { Seq: 1, diff --git a/syz-cluster/pkg/report/template.txt b/syz-cluster/pkg/report/template.txt index 3778ad3f6..165af9d2f 100644 --- a/syz-cluster/pkg/report/template.txt +++ b/syz-cluster/pkg/report/template.txt @@ -63,7 +63,7 @@ See {{.Config.DocsLink}} for more information about {{.Config.Name}}. {{- if .Report.Moderation}} The email will later be sent to: -{{.Report.Cc}} +{{.Report.Series.Cc}} If the report looks fine to you, reply with: #syz upstream diff --git a/syz-cluster/pkg/report/testdata/1.in.json b/syz-cluster/pkg/report/testdata/1.in.json index 0cc8e7261..4bd1361bd 100644 --- a/syz-cluster/pkg/report/testdata/1.in.json +++ b/syz-cluster/pkg/report/testdata/1.in.json @@ -4,6 +4,7 @@ "title": "Series title''", "version": 2, "link": "http://link/to/series", + "cc": ["a@a.com", "b@b.com"], "patches": [ { "title": "first patch" @@ -42,6 +43,5 @@ } } ], - "cc": ["a@a.com", "b@b.com"], "link": "http://some/link/to/report" } diff --git a/syz-cluster/pkg/report/testdata/2.in.json b/syz-cluster/pkg/report/testdata/2.in.json index 22ca8c943..8fe304176 100644 --- a/syz-cluster/pkg/report/testdata/2.in.json +++ b/syz-cluster/pkg/report/testdata/2.in.json @@ -4,6 +4,7 @@ "title": "Series title", "version": 2, "link": "http://link/to/series", + "cc": ["a@a.com", "b@b.com"], "patches": [ { "title": "first patch" @@ -29,6 +30,5 @@ } } ], - "cc": ["a@a.com", "b@b.com"], "link": "http://some/link/to/report" } diff --git a/syz-cluster/pkg/reporter/api_test.go b/syz-cluster/pkg/reporter/api_test.go index 74068139b..dccff237b 100644 --- a/syz-cluster/pkg/reporter/api_test.go +++ b/syz-cluster/pkg/reporter/api_test.go @@ -4,12 +4,13 @@ package reporter import ( + "testing" + "time" + "github.com/google/syzkaller/syz-cluster/pkg/api" "github.com/google/syzkaller/syz-cluster/pkg/app" "github.com/google/syzkaller/syz-cluster/pkg/controller" "github.com/stretchr/testify/assert" - "testing" - "time" ) func TestAPIReportFlow(t *testing.T) { @@ -53,6 +54,7 @@ func TestAPIReportFlow(t *testing.T) { ExtID: testSeries.ExtID, Title: testSeries.Title, Link: "http://link/to/series", + Cc: []string{"first@user.com", "second@user.com"}, Patches: []api.SeriesPatch{ { Seq: 1, -- cgit mrf-deployment