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

fix(checks): correctly check the addresses count in the AVD-NIF-0001 rule #267

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

aokumasan
Copy link
Contributor

@aokumasan aokumasan commented Oct 8, 2024

The nifcloud computing rules were migrated to Rego at #185, but I found a difference with original Go rule.

Go: https://github.com/aquasecurity/trivy-checks/blob/v1.1.0/checks/cloud/nifcloud/computing/no_public_ingress_sgr.go#L40

if cidr.IsPublic(rule.CIDR.Value()) && cidr.CountAddresses(rule.CIDR.Value()) > 1 {

Rego: https://github.com/aquasecurity/trivy-checks/blob/v1.1.0/checks/cloud/nifcloud/computing/no_public_ingress_sgr.rego#L39

cidr.is_public(rule.cidr.value)
cidr.count_addresses(rule.cidr.value) > 0

In Golang, it was an error if the address count was more than 1 (> 1), But in Rego, it is an error if the count is greater than 0 (> 0).
I think it is correct to follow the Go code and use > 1 as the condition.

@aokumasan aokumasan requested a review from simar7 as a code owner October 8, 2024 15:34
@CLAassistant
Copy link

CLAassistant commented Oct 8, 2024

CLA assistant check
All committers have signed the CLA.

@nikpivkin
Copy link
Contributor

Thank you! It's a typo.

@simar7 simar7 added this pull request to the merge queue Oct 10, 2024
Merged via the queue into aquasecurity:main with commit ae293f3 Oct 10, 2024
5 checks passed
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.

4 participants