CMP-4323: Exclude runtime lock files from file_permissions_cni_conf#14755
Open
Vincent056 wants to merge 1 commit into
Open
CMP-4323: Exclude runtime lock files from file_permissions_cni_conf#14755Vincent056 wants to merge 1 commit into
Vincent056 wants to merge 1 commit into
Conversation
The file_permissions_cni_conf rules matched every file under /etc/cni/net.d/ with the regex ^/etc/cni/net.d/.*$ and required mode 0600. The directory can also contain cni.lock, a zero-byte flock sentinel created by CRI-O/podman with mode 0644. The actual CNI configuration files (e.g. 100-crio-bridge.conflist, 200-loopback.conflist) are already 0600 and compliant, but cni.lock caused the rule to FAIL. Narrow the regex to only match CNI configuration files (.conf, .conflist, .json) so the runtime lock file is no longer checked. This avoids false FAILs while still verifying the permissions of the actual network configuration files. CMP-4323
|
@Vincent056: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
The
file_permissions_cni_confrules (and the_not_s390x/_s390xvariants) matched every file under/etc/cni/net.d/using the regex^/etc/cni/net.d/.*$and required mode0600. The directory can also containcni.lock— a zero-byteflocksentinel created by CRI-O/podman with mode0644. The actual CNI configuration files (e.g.100-crio-bridge.conflist,200-loopback.conflist) are already0600and compliant, butcni.lockcaused the rule to report FAIL.This narrows the regex to only match CNI configuration files (
.conf,.conflist,.json) so the runtime lock file is no longer checked:Rationale:
cni.lockis a runtime lock file, not a network configuration file, and its0644mode is set by the container runtime — it is not something the cluster admin can or should remediate. Checking it produces a false FAIL on otherwise-compliant clusters. Restricting the check to actual CNI config-file extensions keeps the rule meaningful (the real configuration files are still verified) while ignoring the lock sentinel.Reported via Red Hat Jira CMP-4323.
Review Hints:
EXCLUDED_FILESmechanism in thefile_permissionstemplate only applies to the directory-matching (is_directory) branch, not thefilepath_is_regexbranch this rule uses, so narrowing the regex is the appropriate fix here.ocp4product: the generated OVAL now emits<unix:filepath operation="pattern match">^/etc/cni/net.d/.*\.(conf|conflist|json)$</unix:filepath>. Withcheck_existence="none_exist",cni.lockis no longer collected while the.conflistfiles continue to be checked.file_owner_cni_conf/file_groupowner_cni_confrules use the same regex but are not affected (the lock file isroot:root), so they are intentionally left out of this change.