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

False positive on CIS benchmark 4.2.7 - general problem with booleans compared to strings #1850

Closed
OlofKalufs opened this issue Feb 12, 2024 · 1 comment · Fixed by #1858
Closed
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@OlofKalufs
Copy link

OlofKalufs commented Feb 12, 2024

What steps did you take and what happened:
I get a misreporting error on CIS benchmark 4.2.7 - "Ensure that the --make-iptables-util-chains argument is set to true" even though that parameter is set to true

What did you expect to happen:
It shouldn't report that failure

Anything else you would like to add:
It is caused by the node-collector returning the value of kubeletMakeIptablesUtilChainsArgumentSet as a boolean:

"kubeletMakeIptablesUtilChainsArgumentSet": {
  "values": [
    true
  ]

while the rego rule in https://github.com/aquasecurity/trivy-policies/blob/main/checks/kubernetes/cisbenchmarks/kubelet/kubelet_make_iptables_util_chains.rego expects it to be a string.

I've tried to alter the input in the Rego playground, and changing it to

"kubeletMakeIptablesUtilChainsArgumentSet": {
  "values": [
    "true"
  ]

prevents the false positive.

I think it is the same problem with the variable kubeletAnonymousAuthArgumentSet even though that will lead to a false negative instead. That variable is also set to a boolean value but the rule makes a string comparison.

Environment:

  • Trivy-Operator version (use trivy-operator version): 0.18.5
  • Kubernetes version (use kubectl version): 1.25.7
  • OS (macOS 10.15, Windows 10, Ubuntu 19.10 etc): The Kubernetes nodes run on Ubuntu 22
@OlofKalufs OlofKalufs added the kind/bug Categorizes issue or PR as related to a bug. label Feb 12, 2024
@chen-keinan
Copy link
Contributor

@OlofKalufs thanks for the inout and analysis , I'll update a look at it and update you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants