Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit c8da19f

Browse files
authored
Merge pull request #179 from StefanScherer/add-app-vulns-if-not-json-output
Add --app-vulns flag only if no json output
2 parents e2f8c4d + 9907ac9 commit c8da19f

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

cmd/docker-scan/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ func configureProvider(ctx context.Context, dockerCli command.Cli, flags options
124124
}
125125
} else if flags.groupIssues {
126126
return nil, fmt.Errorf("--json flag is mandatory to use --group-issues flag")
127+
} else {
128+
opts = append(opts, provider.WithAppVulns())
127129
}
128130
if flags.dockerFilePath != "" {
129131
opts = append(opts, provider.WithDockerFile(flags.dockerFilePath))

internal/provider/provider.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type Options struct {
5050
// NewProvider returns default provider options setup with the give options
5151
func NewProvider(options ...Ops) (Options, error) {
5252
provider := Options{
53-
flags: []string{"container", "test", "--app-vulns"},
53+
flags: []string{"container", "test"},
5454
out: os.Stdout,
5555
err: os.Stderr,
5656
}
@@ -151,6 +151,14 @@ func WithGroupIssues() Ops {
151151
}
152152
}
153153

154+
// WithAppVulns scans for applications vulnerabilities as well
155+
func WithAppVulns() Ops {
156+
return func(provider *Options) error {
157+
provider.flags = append(provider.flags, "--app-vulns")
158+
return nil
159+
}
160+
}
161+
154162
// WithPath update the provider binary with the path from the configuration
155163
func WithPath(path string) Ops {
156164
return func(provider *Options) error {

0 commit comments

Comments
 (0)