Skip to content

Commit

Permalink
feat(cmd): version output (#109)
Browse files Browse the repository at this point in the history
Print the version of the plugin Trivy import (not the binary)

fix(scan): after secret was found the pattren exist in results.json file so there is another match after rescan
moved to /tmp/aqua and delete after scan.

Co-authored-by: oranmoshai <oran.moshai@aquasec.com>
  • Loading branch information
oranmoshai and oranmoshai authored May 15, 2022
1 parent 2a26f9c commit 53c2cb2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion cmd/aqua/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var (
func main() {
app := cli.NewApp()
app.Name = "aqua"
app.Version = "0.0.1"
app.Version = "0.27.1"
app.ArgsUsage = "target"
app.Usage = "A simple and comprehensive vulnerability scanner for containers"
app.EnableBashCompletion = true
Expand Down Expand Up @@ -110,6 +110,9 @@ func main() {
EnvVars: []string{"TRIVY_QUIET"},
})

versionCmd := commands.NewVersionCommand()
versionCmd.Usage = "print the version of the trivy import library"

app.Commands = []*cli.Command{
fsCmd,
configCmd,
Expand All @@ -119,6 +122,7 @@ func main() {
commands.NewRepositoryCommand(),
commands.NewRootfsCommand(),
commands.NewServerCommand(),
versionCmd,
}
if err := app.Run(os.Args); err != nil {
log.Logger.Error(err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
)

const (
resultsFile = "results.json"
aquaPath = "/tmp/aqua"
resultsFile = aquaPath + "/results.json"
)

//go:embed trivy-secret.yaml
Expand Down Expand Up @@ -98,7 +98,7 @@ func Scan(c *cli.Context, path string) (trivyTypes.Results, error) {
return nil, errors.Wrap(err, "failed unmarshaling results file")
}

// Cleanup tmp diff dir
// Cleanup aqua tmp dir
defer os.RemoveAll(aquaPath)

return results, nil
Expand Down

0 comments on commit 53c2cb2

Please sign in to comment.