Skip to content
Merged
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
25 changes: 15 additions & 10 deletions internal/commands/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ func NewResultsCommand(
resultsWrapper wrappers.ResultsWrapper,
scanWrapper wrappers.ScansWrapper,
codeBashingWrapper wrappers.CodeBashingWrapper,
bflWrapper wrappers.BflWrapper) *cobra.Command {
bflWrapper wrappers.BflWrapper,
) *cobra.Command {
resultCmd := &cobra.Command{
Use: "results",
Short: "Retrieve results",
Expand Down Expand Up @@ -289,7 +290,6 @@ func SummaryReport(
return nil, err
}
summary.BaseURI = wrappers.GetURL(fmt.Sprintf("projects/%s/overview", summary.ProjectID))
summary.TotalIssues = int(results.TotalCount)
for _, result := range results.Results {
countResult(summary, result)
}
Expand All @@ -308,20 +308,25 @@ func SummaryReport(

func countResult(summary *wrappers.ResultSummary, result *wrappers.ScanResult) {
engineType := strings.TrimSpace(result.Type)
if engineType == commonParams.SastType {
if engineType == commonParams.SastType && result.State != notExploitable {
summary.SastIssues++
summary.TotalIssues++
} else if engineType == commonParams.ScaType {
summary.ScaIssues++
} else if engineType == commonParams.KicsType {
summary.TotalIssues++
} else if engineType == commonParams.KicsType && result.State != notExploitable {
summary.KicsIssues++
summary.TotalIssues++
}
severity := strings.ToLower(result.Severity)
if severity == highLabel {
summary.HighIssues++
} else if severity == lowLabel {
summary.LowIssues++
} else if severity == mediumLabel {
summary.MediumIssues++
if result.State != notExploitable {
if severity == highLabel {
summary.HighIssues++
} else if severity == lowLabel {
summary.LowIssues++
} else if severity == mediumLabel {
summary.MediumIssues++
}
}
}

Expand Down
7 changes: 5 additions & 2 deletions internal/commands/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const (
thresholdMsgLog = "Threshold check finished with status %s : %s"
mbBytes = 1024.0 * 1024.0
scaType = "sca"
notExploitable = "NOT_EXPLOITABLE"
)

var (
Expand Down Expand Up @@ -1150,8 +1151,10 @@ func getSummaryThresholdMap(resultsWrapper wrappers.ResultsWrapper, scanID strin
}
summaryMap := make(map[string]int)
for _, result := range results.Results {
key := strings.ToLower(fmt.Sprintf("%s-%s", result.Type, result.Severity))
summaryMap[key]++
if !strings.EqualFold(result.State, notExploitable) {
key := strings.ToLower(fmt.Sprintf("%s-%s", result.Type, result.Severity))
summaryMap[key]++
}
}
return summaryMap, nil
}
Expand Down