Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion central/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ func customRoutes() (customRoutes []routes.CustomRoute) {
// Append report custom routes
customRoutes = append(customRoutes, routes.CustomRoute{
Route: "/api/reports/jobs/download",
Authorizer: user.With(permissions.Modify(resources.WorkflowAdministration), permissions.View(resources.Image)),
Authorizer: user.With(permissions.View(resources.WorkflowAdministration), permissions.View(resources.Image)),
ServerHandler: v2Service.NewDownloadHandler(),
Compression: true,
Comment on lines 959 to 963
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

This download route still excludes the target viewer role.

Line 961 still requires permissions.View(resources.WorkflowAdministration) in addition to permissions.View(resources.Image). Users who can view CVE results but lack workflow-administration access will still 403 on /api/reports/jobs/download, so the download side of the permission change is not complete.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@central/main.go` around lines 959 - 963, The download route for
"/api/reports/jobs/download" currently requires
permissions.View(resources.WorkflowAdministration) alongside
permissions.View(resources.Image), which blocks users with the target viewer
role; update the authorization on that customRoutes entry (where
NewDownloadHandler() is set) to include the target viewer permission by
replacing or adding permissions.View(resources.TargetViewer) in the
user.With(...) call so users with the target viewer role (and/or workflow admin
as appropriate) can access the download endpoint.

})
Expand Down
2 changes: 1 addition & 1 deletion central/reports/service/v2/service_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ var (
apiV2.ReportService_GetMyReportHistory_FullMethodName,
apiV2.ReportService_GetViewBasedReportHistory_FullMethodName,
apiV2.ReportService_GetViewBasedMyReportHistory_FullMethodName,
apiV2.ReportService_PostViewBasedReport_FullMethodName,
},
user.With(permissions.Modify(resources.WorkflowAdministration), permissions.View(resources.Image)): {
apiV2.ReportService_RunReport_FullMethodName,
apiV2.ReportService_CancelReport_FullMethodName,
apiV2.ReportService_DeleteReport_FullMethodName,
apiV2.ReportService_PostViewBasedReport_FullMethodName,
},
})
)
Expand Down
Loading