Skip to content
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

chore: fix issue caused by ownerIsBuiltIn being true by default #216

Merged
merged 2 commits into from
Aug 30, 2023

Conversation

thapabishwa
Copy link
Contributor

@thapabishwa thapabishwa commented Aug 30, 2023

Description

Pods without owners are ignored because ownerIsBuiltIn is true by default. As a result the condition in if statement evaluates to true and the Pods without owners are ignored.

if c.excludeOwned && ownerIsBuiltIn {

This PR adds ownerExists boolean variable to fix this issue.

Before

go run examples/trivy.go
Current namespace: default
Scanning kind 'pods' with exclude-owned=true
Name: pod-with-crd-owner, Kind: Pod, Namespace: kube-system, Images: [nginx:latest]

After

go run examples/trivy.go
Current namespace: default
Scanning kind 'pods' with exclude-owned=true
Name: my-pod, Kind: Pod, Namespace: default, Images: [nginx:latest]
Name: pod-with-crd-owner, Kind: Pod, Namespace: kube-system, Images: [nginx:latest]

pkg/trivyk8s/trivyk8s.go Outdated Show resolved Hide resolved
@chen-keinan
Copy link
Contributor

lgtm 🚀

@chen-keinan chen-keinan merged commit fe986af into aquasecurity:main Aug 30, 2023
@thapabishwa thapabishwa deleted the chore-fix-custom-resource branch August 30, 2023 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants