From b438bd66d6f95113d52f25c25bfef0e963c8ce8d Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Tue, 9 Jan 2024 16:27:55 +0100 Subject: dashboard: introduce an emergency stop mode Add an emergency stop button that can be used by any admin. After it's clicked two times, syzbot stops all reporting and recoding of new bugs. It's assumed that the stop mode is revoked by manually deleting an entry from the database. --- dashboard/app/reporting_external.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'dashboard/app/reporting_external.go') diff --git a/dashboard/app/reporting_external.go b/dashboard/app/reporting_external.go index e6f65c738..625476918 100644 --- a/dashboard/app/reporting_external.go +++ b/dashboard/app/reporting_external.go @@ -19,6 +19,9 @@ import ( // and report back bug status updates with apiReportingUpdate. func apiReportingPollBugs(c context.Context, r *http.Request, payload []byte) (interface{}, error) { + if stop, err := emergentlyStopped(c); err != nil || stop { + return &dashapi.PollBugsResponse{}, err + } req := new(dashapi.PollBugsRequest) if err := json.Unmarshal(payload, req); err != nil { return nil, fmt.Errorf("failed to unmarshal request: %w", err) @@ -36,6 +39,9 @@ func apiReportingPollBugs(c context.Context, r *http.Request, payload []byte) (i } func apiReportingPollNotifications(c context.Context, r *http.Request, payload []byte) (interface{}, error) { + if stop, err := emergentlyStopped(c); err != nil || stop { + return &dashapi.PollNotificationsResponse{}, err + } req := new(dashapi.PollNotificationsRequest) if err := json.Unmarshal(payload, req); err != nil { return nil, fmt.Errorf("failed to unmarshal request: %w", err) @@ -48,6 +54,9 @@ func apiReportingPollNotifications(c context.Context, r *http.Request, payload [ } func apiReportingPollClosed(c context.Context, r *http.Request, payload []byte) (interface{}, error) { + if stop, err := emergentlyStopped(c); err != nil || stop { + return &dashapi.PollClosedResponse{}, err + } req := new(dashapi.PollClosedRequest) if err := json.Unmarshal(payload, req); err != nil { return nil, fmt.Errorf("failed to unmarshal request: %w", err) -- cgit mrf-deployment