Skip to content

Commit

Permalink
fix(cli): report-formats panics with uppercase input closes Checkmarx…
Browse files Browse the repository at this point in the history
  • Loading branch information
rogeriopeixotocx authored Nov 3, 2021
1 parent 87b1ff7 commit 8daf925
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/console/helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ func GenerateReport(path, filename string, body interface{}, formats []string, p
defer progressBar.Close()

for _, format := range formats {
format = strings.ToLower(format)
if err = reportGenerators[format](path, filename, body); err != nil {
log.Error().Msgf("Failed to generate %s report", format)
break
Expand Down
3 changes: 2 additions & 1 deletion internal/console/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"os/signal"
"path/filepath"
"strings"
"syscall"

"github.com/Checkmarx/kics/internal/console/flags"
Expand Down Expand Up @@ -99,7 +100,7 @@ func run(cmd *cobra.Command) error {

func updateReportFormats() {
for _, format := range flags.GetMultiStrFlag(flags.ReportFormatsFlag) {
if format == "all" {
if strings.EqualFold(format, "all") {
flags.SetMultiStrFlag(flags.ReportFormatsFlag, consoleHelpers.ListReportFormats())
break
}
Expand Down

0 comments on commit 8daf925

Please sign in to comment.