aboutsummaryrefslogtreecommitdiffstats
path: root/syz-cluster/pkg/service
diff options
context:
space:
mode:
Diffstat (limited to 'syz-cluster/pkg/service')
-rw-r--r--syz-cluster/pkg/service/finding.go21
-rw-r--r--syz-cluster/pkg/service/report.go11
2 files changed, 31 insertions, 1 deletions
diff --git a/syz-cluster/pkg/service/finding.go b/syz-cluster/pkg/service/finding.go
index df5f7c2d9..c44783b87 100644
--- a/syz-cluster/pkg/service/finding.go
+++ b/syz-cluster/pkg/service/finding.go
@@ -7,6 +7,7 @@ import (
"bytes"
"context"
"fmt"
+ "time"
"github.com/google/syzkaller/syz-cluster/pkg/api"
"github.com/google/syzkaller/syz-cluster/pkg/app"
@@ -87,6 +88,23 @@ func (s *FindingService) saveAssets(finding *db.Finding, req *api.NewFinding) er
return nil
}
+func (s *FindingService) InvalidateSession(ctx context.Context, sessionID string) error {
+ findings, err := s.findingRepo.ListForSession(ctx, sessionID, 0)
+ if err != nil {
+ return err
+ }
+ for _, finding := range findings {
+ err := s.findingRepo.Update(ctx, finding.ID, func(finding *db.Finding) error {
+ finding.SetInvalidatedAt(time.Now())
+ return nil
+ })
+ if err != nil {
+ return fmt.Errorf("failed to update finding %s: %w", finding.ID, err)
+ }
+ }
+ return nil
+}
+
func (s *FindingService) List(ctx context.Context, sessionID string, limit int) ([]*api.Finding, error) {
list, err := s.findingRepo.ListForSession(ctx, sessionID, limit)
if err != nil {
@@ -112,6 +130,9 @@ func (s *FindingService) List(ctx context.Context, sessionID string, limit int)
if item.CReproURI != "" {
finding.LinkCRepro = s.urls.FindingCRepro(item.ID)
}
+ if !item.InvalidatedAt.IsNull() {
+ finding.Invalidated = true
+ }
build := testPerName[item.TestName].PatchedBuild
if build != nil {
finding.Build = makeBuildInfo(s.urls, build)
diff --git a/syz-cluster/pkg/service/report.go b/syz-cluster/pkg/service/report.go
index c92ccfa11..a33c9d889 100644
--- a/syz-cluster/pkg/service/report.go
+++ b/syz-cluster/pkg/service/report.go
@@ -51,7 +51,7 @@ var ErrNotOnModeration = errors.New("the report is not on moderation")
func (rs *ReportService) Upstream(ctx context.Context, id string, req *api.UpstreamReportReq) error {
rep, err := rs.query(ctx, id)
if err != nil {
- return nil
+ return err
} else if !rep.Moderation {
return ErrNotOnModeration
}
@@ -68,6 +68,15 @@ func (rs *ReportService) Upstream(ctx context.Context, id string, req *api.Upstr
return nil
}
+func (rs *ReportService) Invalidate(ctx context.Context, id string) error {
+ rep, err := rs.query(ctx, id)
+ if err != nil {
+ return err
+ }
+ // For now, invalidate all the findings at once - later we can do it more selectively.
+ return rs.findingService.InvalidateSession(ctx, rep.SessionID)
+}
+
const maxFindingsPerReport = 5
func (rs *ReportService) Next(ctx context.Context, reporter string) (*api.NextReportResp, error) {