Skip to content

Commit

Permalink
support to --apisec-swagger-filter flag
Browse files Browse the repository at this point in the history
- linter
  • Loading branch information
igorlombacx committed Jul 28, 2023
1 parent e089240 commit 322d8d3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions internal/commands/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const (
notAvailableString = "N/A"
notAvailableNumber = -1
defaultPaddingSize = -13
defaultResultsPaddingSize = -15
scanPendingMessage = "Scan triggered in asynchronous mode or still running. Click more details to get the full status."
scaType = "sca"
directDependencyType = "Direct Dependency"
Expand Down Expand Up @@ -516,10 +517,10 @@ func writeConsoleSummary(summary *wrappers.ResultSummary) error {

fmt.Printf(" Total Results: %d \n", summary.TotalIssues)
fmt.Printf(" -------------------------------------- \n")
fmt.Printf(" | High: %*d| \n", defaultPaddingSize-2, summary.HighIssues)
fmt.Printf(" | Medium: %*d| \n", defaultPaddingSize-2, summary.MediumIssues)
fmt.Printf(" | Low: %*d| \n", defaultPaddingSize-2, summary.LowIssues)
fmt.Printf(" | Info: %*d| \n", defaultPaddingSize-2, summary.InfoIssues)
fmt.Printf(" | High: %*d| \n", defaultResultsPaddingSize, summary.HighIssues)
fmt.Printf(" | Medium: %*d| \n", defaultResultsPaddingSize, summary.MediumIssues)
fmt.Printf(" | Low: %*d| \n", defaultResultsPaddingSize, summary.LowIssues)
fmt.Printf(" | Info: %*d| \n", defaultResultsPaddingSize, summary.InfoIssues)
fmt.Printf(" -------------------------------------- \n")

if summary.KicsIssues == notAvailableNumber {
Expand Down
5 changes: 3 additions & 2 deletions internal/wrappers/results-summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ type ResultSummary struct {
Policies *PolicyResponseModel
}

// nolint: govet
type APISecResult struct {
APICount int `json:"api_count,omitempty",`
APICount int `json:"api_count,omitempty"`
TotalRisksCount int `json:"total_risks_count,omitempty"`
Risks []int `json:"risks,omitempty"`
RiskDistribution []struct {
Expand All @@ -58,7 +59,7 @@ func (r *ResultSummary) HasAPISecurity() bool {
}

func (r *ResultSummary) HasAPISecurityDocumentation() bool {
if len(r.APISecurity.RiskDistribution) > 1 && strings.ToLower(r.APISecurity.RiskDistribution[1].Origin) == "documentation" {
if len(r.APISecurity.RiskDistribution) > 1 && strings.EqualFold(r.APISecurity.RiskDistribution[1].Origin, "documentation") {
return true
}
return false
Expand Down

0 comments on commit 322d8d3

Please sign in to comment.