-
Notifications
You must be signed in to change notification settings - Fork 223
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
feat: add local cache mode for scanner #1574
Conversation
Hi @chen-keinan , drafted this PR to address #1342 . Let me know what you think about this approach. |
@zhcli the only different between is that it has different command on example : standalone : Command: []string{
"trivy",
},
Args: []string{
"--cache-dir",
"/tmp/trivy/.cache",
"image",
"--download-db-only",
"--db-repository",
dbRepository,
},
Command: []string{
"/bin/sh",
},
Args: []string{
"-c", fmt.Sprintf("mkdir /tmp/trivy-db && cp -rv %s /tmp/trivy-db && chmod -R 777 /tmp/trivy-db", cacheDir),
}, |
Hi @chen-keinan , yes it is. |
@zhcli is setting this helm flag will not do the work for not running initContainer |
@chen-keinan I am reading the codes correctly, the |
@zhcli true, it will fail because it do not have |
@chen-keinan I was intended to remove all the init containers for local cache mode, however after that trivy complains about file systems permissions issue about its Vul DB files. It seems that I ran into the same issue as aquasecurity/trivy#4286 |
qq: does the trivy image include vuln db in it ? |
Yes. My testing environment is docker desktop + kind. I built a trivy image with latest Vul DB, no matter which volume I put the DB files, trivy complains about permissions issue. I have to leverage an external volume with read-write permission. |
can put it here an example how you build the vulndb with trivy image ? |
@chen-keinan please see below FROM ghcr.io/aquasecurity/trivy:0.46.0
RUN adduser -u 10000 -D -g '' trivyoperator trivyoperator
USER 10000
RUN trivy --cache-dir /home/trivyoperator/.cache image --download-db-only --db-repository ghcr.io/aquasecurity/trivy-db
RUN chmod -R 777 /home/trivyoperator/.cache
ENTRYPOINT ["trivy"] |
thanks will check it up and update you |
@zhcli thanks for sharing the docker file , I was able to reproduce this issue. the fix in |
@chen-keinan thanks for testing, I can take a look the trivy issue when I have some spare times, most likely late weekend nights. Also are you in the trivy slack channel? I will join and communicate with you over there. |
Any progress here? |
This PR is stale because it has been labeled with inactivity. |
@chen-keinan any chance that this functionality is provided soon? Can we help with a contribution or do you want to cover that internally? |
This PR is stale because it has been labeled with inactivity. |
The above issue referenced was closed - is this still pending? |
This PR is stale because it has been labeled with inactivity. |
Description
Adding local cache mode for vulnerability scanner
Related issues
Checklist