-
Notifications
You must be signed in to change notification settings - Fork 67
fix: trivy binary check fallback #1154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
b625541
8da96c7
15b5699
1288f1b
a04d0cd
22cea7d
5d37828
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| FROM golang:1.23-bullseye@sha256:80eb3147ef40b58d527d9c2e634b1a79a750aee09de6f973844db38b33f0550b | ||
sozercan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| FROM golang:1.24-bullseye@sha256:dfd72198d14bc22f270c9e000c304a2ffd19f5a5f693fad82643311afdc6b568 | ||
|
|
||
| RUN GO111MODULE=on go install sigs.k8s.io/controller-tools/cmd/[email protected] | ||
| RUN GO111MODULE=on go install k8s.io/code-generator/cmd/[email protected] | ||
|
|
||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,8 +168,9 @@ func (c *Config) getRuntimeVar() (string, error) { | |
| } | ||
|
|
||
| type ImageScanner struct { | ||
| config Config | ||
| timer *time.Timer | ||
| config Config | ||
| timer *time.Timer | ||
| trivyPath string | ||
| } | ||
|
|
||
| func (s *ImageScanner) Scan(img unversioned.Image) (ScanStatus, error) { | ||
|
|
@@ -186,13 +187,13 @@ func (s *ImageScanner) Scan(img unversioned.Image) (ScanStatus, error) { | |
| stderr := new(bytes.Buffer) | ||
|
|
||
| cliArgs := s.config.cliArgs(refs[i]) | ||
| cmd := exec.Command(trivyCommandName, cliArgs...) | ||
| cmd := exec.Command(s.trivyPath, cliArgs...) // nolint:gosec // G204: Subprocess launched with variable | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you make the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good point, this might be why we used
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On second thought, we can change Thanks to Mo for the fresh perspective :) |
||
| cmd.Stdout = stdout | ||
| cmd.Stderr = stderr | ||
| cmd.Env = append(cmd.Env, os.Environ()...) | ||
| cmd.Env = setRuntimeSocketEnvVars(cmd, s.config.Runtime) | ||
|
|
||
| log.V(1).Info("scanning image ref", "ref", refs[i], "cli_invocation", fmt.Sprintf("%s %s", trivyCommandName, strings.Join(cliArgs, " ")), "env", cmd.Env) | ||
| log.V(1).Info("scanning image ref", "ref", refs[i], "cli_invocation", fmt.Sprintf("%s %s", s.trivyPath, strings.Join(cliArgs, " ")), "env", cmd.Env) | ||
| if err := cmd.Run(); err != nil { | ||
| log.Error(err, "error scanning image", "imageID", img.ImageID, "reference", refs[i], "stderr", stderr.String()) | ||
| continue | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.