From 186b293cce8a7d304b654beba6ed46f292d0fe40 Mon Sep 17 00:00:00 2001 From: suhasgumma Date: Wed, 30 Nov 2022 01:23:45 +0530 Subject: [PATCH] fix link for cis controls in html output --- core/pkg/resultshandling/printer/v2/html/report.gohtml | 2 +- core/pkg/resultshandling/printer/v2/htmlprinter.go | 5 +++-- core/pkg/resultshandling/printer/v2/reportingstructs.go | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/pkg/resultshandling/printer/v2/html/report.gohtml b/core/pkg/resultshandling/printer/v2/html/report.gohtml index 2c51d34a..ff17cbf6 100644 --- a/core/pkg/resultshandling/printer/v2/html/report.gohtml +++ b/core/pkg/resultshandling/printer/v2/html/report.gohtml @@ -142,7 +142,7 @@ {{ .Severity }} {{ .Name }} - {{ .URL }} + {{ .ID }} {{ range .FailedPaths }}

{{ . }}

{{ end }} {{ end }} diff --git a/core/pkg/resultshandling/printer/v2/htmlprinter.go b/core/pkg/resultshandling/printer/v2/htmlprinter.go index 958c6e25..f277249b 100644 --- a/core/pkg/resultshandling/printer/v2/htmlprinter.go +++ b/core/pkg/resultshandling/printer/v2/htmlprinter.go @@ -130,10 +130,11 @@ func buildResourceTableView(opaSessionObj *cautils.OPASessionObj) ResourceTableV func buildResourceControlResult(resourceControl resourcesresults.ResourceAssociatedControl, control reportsummary.IControlSummary) ResourceControlResult { ctlSeverity := apis.ControlSeverityToString(control.GetScoreFactor()) ctlName := resourceControl.GetName() - ctlURL := resourceControl.GetID() + ctlID := resourceControl.GetID() + ctlURL := cautils.GetControlLink(resourceControl.GetID()) failedPaths := append(failedPathsToString(&resourceControl), fixPathsToString(&resourceControl)...) - return ResourceControlResult{ctlSeverity, ctlName, ctlURL, failedPaths} + return ResourceControlResult{ctlSeverity, ctlName, ctlID, ctlURL, failedPaths} } func buildResourceControlResultTable(resourceControls []resourcesresults.ResourceAssociatedControl, summaryDetails *reportsummary.SummaryDetails) []ResourceControlResult { diff --git a/core/pkg/resultshandling/printer/v2/reportingstructs.go b/core/pkg/resultshandling/printer/v2/reportingstructs.go index a4c2f408..1b3540b5 100644 --- a/core/pkg/resultshandling/printer/v2/reportingstructs.go +++ b/core/pkg/resultshandling/printer/v2/reportingstructs.go @@ -14,6 +14,7 @@ type ResourceResult struct { type ResourceControlResult struct { Severity string Name string + ID string URL string FailedPaths []string }