ComplianceAsCode / ComplianceAsCode/content

filter_rules does not work with boolean "dynamic" platforms

Open
#9,077 2 comments 0 reactions 0 assignees View on GitHub
triaged
Dominant language
Shell
Stars
2.8k
Forks
828
Avg merge
3d 8m
Merged PRs (30d)
80

Description

#### Description of problem:
In OCP we use filter_rules a lot, in conjuction with `platforms`, typically to separate rules for `ocp4` and `ocp4-node`. Some rules (like applications/openshift/master/file_groupowner_ovs_conf_db_lock_s390x/rule.yml) also use the "dynamic" boolean expressions like `platform: ocp4-node and s390x_arch` to denote that the rule is only meant for a specific arch. It seems that these rules are not filtered correctly by `filter_rules` and end up in the wrong profile.

#### SCAP Security Guide Version:
today's master

#### Operating System Version:
OCP4.11

#### Steps to Reproduce:

1. have a rule like `applications/openshift/master/file_groupowner_ovs_conf_db_lock/rule.yml` with a `platform: ocp4-node and not_s390x_arch`
2. have a profile which filters by platform, e.g. `filter_rules: '"ocp4-node" not in platforms and "ocp4-master-node" not in platforms and "ocp4-node-on-sdn" not in platforms and "ocp4-node-on-ovn" not in platforms and "not_s390x_arch" not in platforms' `
3. build the content
4. the rule will end up in the profile, despite the profile says `ocp4-node" not in platforms`

#### Actual Results:
the rule is included in the profile which should exclude ocp4-node rules

#### Expected Results:
the rule is not included

#### Additional Information/Debugging Steps:

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.