Open gsingh737 opened 9 months ago
@gsingh737 thanks for the input, I'll have a look. btw: do you have a public image name where I can use it for testing ?
@chen-keinan gsingh737/nginxwithsecret:v1 its public on dockerhub.
@gsingh737 sorry for getting late to this, I have tried scanning you image with trivy 0.51.1, image mode and did not got any results:
trivy image gsingh737/nginxwithsecret:v1 --image-config-scanners secret --scanners secret
2024-05-20T11:55:30+03:00 INFO Container image config scanners scanners=[secret]
2024-05-20T11:55:30+03:00 INFO Secret scanning is enabled
2024-05-20T11:55:30+03:00 INFO If your scanning is slow, please try '--scanners vuln' to disable secret scanning
2024-05-20T11:55:30+03:00 INFO Please see also https://aquasecurity.github.io/trivy/v0.51/docs/scanner/secret/#recommendation for faster secret detection
am I missing anything ?
Weird, here is me trying it with 0.48.0 and then with 0.51.2:
In both case it is reported
@jemag does it works for you in client/server mode:
trivy server --listen 0.0.0.0:8081
AND
trivy image gsingh737/nginxwithsecret:v1 --image-config-scanners secret --scanners secret --server http://0.0.0.0:8081
I do detect the image secret with regular trivy-cli: However I do not detect it running the trivy-server included in trivy-operator (port-forwarding it locally):
edit: both are running 0.52.0
@jemag , thanks for checking it out, I have made several tests and got mixed result. I'll investigate it
What steps did you take and what happened: Running Trivy operator with these ENV values
Built a Dockerfile with following
Running a pod in cluster with Trivy Operator running with Trivy server in Client/Server Mode
Exposed Secret Report is not catching any secret.
[A clear and concise description of what the bug is, and what commands you ran.]
What did you expect to happen: Expected Trivy operator to catch exposed secrets.
Anything else you would like to add: Running in standalone Trivy image scan catches exposed secrets using Trivy cli i.e
trivy image --image-config-scanners secret --scanners secret --timeout 10m nginxwithsecret:v1
When running Trivy cli using Trivy Server, its back to not catching those secrets for the same image.
trivy image --server http://localhost:4954 --image-config-scanners secret --scanners secret --timeout 10m nginxwithsecret:v1
This issue was also reported here https://github.com/aquasecurity/trivy-operator/issues/1297 and was thought to be fixed in https://github.com/aquasecurity/trivy-operator/pull/1301 But I believe the fix is addressing FS mode scanning not image scanning as fix was only put in
func (p *plugin) getFSScanningArgs(ctx trivyoperator.PluginContext, command Command, mode Mode, trivyServerURL string) []string
Environment:
trivy-operator version
): 0.18.3 Chart version: 0.20.4kubectl version
): v1.27.7