Skip to content

Commit

Permalink
Feature/trivy (#504)
Browse files Browse the repository at this point in the history
* fix data-races when running analysis (#477)

* fix possible wrong path concat on windows

* enable data race detection on make test

* fix data-races when running analysis

Previously when we start an analysis of language/tool we controlled the
state of execution using the monitor package, but many objects use the
same instance of monitor doing updates and reads concurrent resulting
in possible data races. This commit drops the monitor package and replace
to use the `sync.WaitGroup` to control the state of go routines.
An improvement was also made to control the timeout of analysis using
`time.After` function to receive the channel when timeout occurred or close
the `done` channel when analysis finish. An mutex was added on Service
to avoid data races when adding errors on Analysis.

* improvement on Swift rules description (#479)

* feature/dependency-check (#478)

* Adding owasp dependency check formatter

* Adding tests and fixing lint

* Adding flag to enable owasp dependency check

* Fixing pipeline errors

* Fixing some errors

* Updating devkit version

* Feature/dotnet cli (#480)

* Adding dotnet cli dependency check

* Fixing lint errors

* Adding lisence header

* Improving security code scan

* Adding validation to not found solution in scs, adding license headers

* Adding code in security code scan

* Updating csharp example with vulnerable dependencies, adding validation to failed build in security code scan

* Fixing some errors

* Adding code, line and filepath in dotnet cli. Fixing some errors

* Updating horusec json

* Fixing commit authors issues

* Fixing some issues found during tests

* Adding validation to dotnetcli output

* Fixing lint error

* Fixing lint errors

* Fixing lint error

* Updating horusec config json

* Updating go modules and adding missing unity test

* Fixing error to remove .horusec

* [skip ci] Update versioning file

* avoid time.Sleep to log analysis timeout status (#482)

Previously, to warn the user that the analysis is still running, we used
time.Sleep to print how much time is left for the timeout, however, if the
analysis has already been completed, we still need to wait for the end of
time.Sleep to finish the analysis. This change removes time.Sleep and uses
time.Tick to print the message, so, if the analysis is finished before the
next retry, we do not lock the analysis with time.Sleep.

* Feature/nancy (#483)

* Adding nancy dependency check for go

* Adding nancy unity tests

* Adding vulnerable dependencies in go example project

* Fixing errors found during tests

* Fixing unity tests and pipeline errors

* Updating devkit version

* Fixing pipeline errors

* Updating go dockerfile to use nancy binary from github

* Add set log file to global command
Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>

Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>

* Add set log file to global command
Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>

Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>

* remove ctrl v error

Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>

* refactor cyclomatic function

Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>

* Fixing lint errors

Signed-off-by: nathanmartinszup <nathan.martins@zup.com.br>

* fix tests

Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>

* Add LogOutput Tests

Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>

* Fix tests

Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>

* altering fileName creation to use filepath.Join

Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>

* removing comments from tests

Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>

* Change logpath flage name to log-file-path and refactor on logSetOutput

* Adding more tests and system call interface

Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>

* Save work

Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>

* fix viper config

Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>

* Add trivy as new tool to generic analyzers

Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>

* Att gomod and add setSystemCall

* Add license to trivy files

* Fix tools to ignore from merge commit error

Co-authored-by: matheusalcantarazup <84723211+matheusalcantarazup@users.noreply.github.com>
Co-authored-by: nathanmartinszup <63246935+nathanmartinszup@users.noreply.github.com>
Co-authored-by: wilian <wilian.silva@zup.com.br>
Co-authored-by: nathanmartinszup <nathan.martins@zup.com.br>
  • Loading branch information
5 people authored Aug 5, 2021
1 parent 9dae597 commit f92efcc
Show file tree
Hide file tree
Showing 18 changed files with 1,729 additions and 128 deletions.
2 changes: 1 addition & 1 deletion cmd/app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func init() {

_ = rootCmd.PersistentFlags().String("log-level", configs.GetLogLevel(), "Set verbose level of the CLI. Log Level enable is: \"panic\",\"fatal\",\"error\",\"warn\",\"info\",\"debug\",\"trace\"")
_ = rootCmd.PersistentFlags().String("config-file-path", configs.GetConfigFilePath(), "Path of the file horusec-config.json to setup content of horusec")

_ = rootCmd.PersistentFlags().StringP("log-file-path", "l", configs.GetLogFilePath(), `set user defined log file path instead of default`)
rootCmd.AddCommand(version.NewVersionCommand().CreateCobraCmd())
rootCmd.AddCommand(startCmd.CreateStartCommand())
rootCmd.AddCommand(generateCmd.CreateCobraCmd())
Expand Down
3 changes: 3 additions & 0 deletions cmd/app/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ func (s *Start) setConfig(startCmd *cobra.Command) {
s.configs = s.configs.NewConfigsFromViper().NormalizeConfigs()
s.configs = s.configs.NewConfigsFromEnvironments().NormalizeConfigs()
s.configs = s.configs.NewConfigsFromCobraAndLoadsCmdStartFlags(startCmd).NormalizeConfigs()
if err := s.configs.SetLogOutput(os.Stdout); err != nil {
logger.LogErrorWithLevel(messages.MsgErrorSettingLogFile, err)
}
}

func (s *Start) runE(cmd *cobra.Command, _ []string) error {
Expand Down
Loading

0 comments on commit f92efcc

Please sign in to comment.