From c699c2eb05c8f8cc8d8e20c5a883689491a03ac0 Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Tue, 9 Jul 2024 20:12:54 +0200 Subject: dashboard: make repro logs public PR #4837 added displaying successfull repro logs to syzbot but didn't make the logs publicly-accessible. Fix that. --- dashboard/app/access.go | 9 +++++++++ dashboard/app/access_test.go | 12 ++++++++++++ 2 files changed, 21 insertions(+) (limited to 'dashboard') diff --git a/dashboard/app/access.go b/dashboard/app/access.go index 912f0e6cf..dadaed7f0 100644 --- a/dashboard/app/access.go +++ b/dashboard/app/access.go @@ -99,6 +99,15 @@ func checkTextAccess(c context.Context, r *http.Request, tag string, id int64) ( return checkCrashTextAccess(c, r, "ReproSyz", id) case textReproC: return checkCrashTextAccess(c, r, "ReproC", id) + case textReproLog: + bug, crash, err := checkCrashTextAccess(c, r, "ReproLog", id) + if err == nil || err == ErrAccess { + return bug, crash, err + } + // ReproLog might also be referenced from Bug.ReproAttempts.Log + // for failed repro attempts, but those are not exposed to non-admins + // as of yet, so fallback to normal admin access check. + return nil, nil, checkAccessLevel(c, r, AccessAdmin) case textMachineInfo: // MachineInfo is deduplicated, so we can't find the exact crash/bug. // But since machine info is usually the same for all bugs and is not secret, diff --git a/dashboard/app/access_test.go b/dashboard/app/access_test.go index 08a759892..315ee341f 100644 --- a/dashboard/app/access_test.go +++ b/dashboard/app/access_test.go @@ -225,6 +225,17 @@ func TestAccess(t *testing.T) { url: fmt.Sprintf("/text?tag=ReproSyz&x=%v", strconv.FormatUint(uint64(crash.ReproSyz), 16)), }, + { + level: level, + ref: fmt.Sprint(crash.ReproLog), + url: fmt.Sprintf("/text?tag=ReproLog&id=%v", crash.ReproLog), + }, + { + level: level, + ref: fmt.Sprint(crash.ReproLog), + url: fmt.Sprintf("/text?tag=ReproLog&x=%v", + strconv.FormatUint(uint64(crash.ReproLog), 16)), + }, { level: nsLevel, ref: fmt.Sprint(crash.MachineInfo), @@ -326,6 +337,7 @@ func TestAccess(t *testing.T) { crashOpen.Report = []byte(accessPrefix + "report") crashOpen.ReproC = []byte(accessPrefix + "repro c") crashOpen.ReproSyz = []byte(accessPrefix + "repro syz") + crashOpen.ReproLog = []byte(accessPrefix + "repro log") crashOpen.MachineInfo = []byte(ns + "machine info") client.ReportCrash(crashOpen) repOpen := client.pollBug() -- cgit mrf-deployment