nist_800_53: fix duplicate variables and ordering in sync, add missing rules#14823
nist_800_53: fix duplicate variables and ordering in sync, add missing rules#14823ggbecker wants to merge 1 commit into
Conversation
…g rules
Fix two bugs in utils/nist_sync/sync_nist_split.py:
- Deduplicate variable assignments by collecting into a set before sorting.
When cis_nist_mappings.json contains both a bare key ('var_x') and a
full assignment ('var_x=value') for the same variable, iterating and
calling extend() would add the same assignment twice per key.
- Sort the resulting variable list for deterministic output across runs.
Also add rsyslog_filecreatemode to the ac-3 block in rhel9 and rhel10
product control files, which was present in the CIS→NIST mappings but
missing from the human-maintained files, causing a CIS vs CIS-NIST
profile diff.
Regenerate all three product reference files (rhel8/rhel9/rhel10) with
the fixed script to reflect the corrected de-duplication and the updated
CIS→NIST mappings introduced in fab8d57.
|
@ggbecker: 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. |
Mab879
left a comment
There was a problem hiding this comment.
Please double check the variables below. I have not highligted all of cis_rhelX mismatches so please make sure those are addressed.
| rules: | ||
| - var_audit_backlog_limit=8192 | ||
| - var_auditd_admin_space_left_action=cis_rhel8 | ||
| - var_auditd_disk_error_action=cis_rhel8 |
| - var_audit_backlog_limit=8192 | ||
| - var_auditd_admin_space_left_action=cis_rhel8 | ||
| - var_auditd_disk_error_action=cis_rhel8 | ||
| - var_auditd_disk_full_action=cis_rhel8 |
| - var_auditd_space_left_action=cis_rhel9 | ||
| - var_auditd_admin_space_left_action=cis_rhel9 | ||
| - var_audit_backlog_limit=8192 | ||
| - var_auditd_disk_error_action=cis_rhel9 |
| - var_auditd_admin_space_left_action=cis_rhel9 | ||
| - var_audit_backlog_limit=8192 | ||
| - var_auditd_disk_error_action=cis_rhel9 | ||
| - var_auditd_disk_full_action=cis_rhel9 |
| - var_audit_backlog_limit=8192 | ||
| - var_auditd_disk_error_action=cis_rhel9 | ||
| - var_auditd_disk_full_action=cis_rhel9 | ||
| - var_auditd_space_left_action=cis_rhel9 |
| - var_audit_backlog_limit=8192 | ||
| - var_auditd_action_mail_acct=root | ||
| - var_auditd_space_left_action=cis_rhel9 | ||
| - var_auditd_admin_space_left_action=cis_rhel9 |
There was a problem hiding this comment.
Should this be cis_rhel10?
I know this isn't change, but we should at least be constant.
|
@Mab879 Correct me if I'm wrong, but all the things you highlighted, if you look at the folder name, you see that they are referencing different RHEL versions and each RHEL version uses their respective cis_rhelX variable. for example: shared/references/controls/nist_800_53_cis_reference_rhel8/au.yml |
Description:
This is a continuation of: nist_800_53: fix sync script variable lookup and complete CIS→NIST mappings #14785
Fix duplicate variable entries and non-deterministic ordering in
utils/nist_sync/sync_nist_split.py. Whencis_nist_mappings.jsoncontains both a bare key (var_x) and a full assignment (var_x=value) for the same variable, both strip to the same name andextend()would add the same assignment multiple times. Fixed by collecting into asetbefore sorting, ensuring stable, deduplicated output on every run.Add
rsyslog_filecreatemodeto theac-3block inproducts/rhel9/controls/nist_800_53/ac.ymlandproducts/rhel10/controls/nist_800_53/ac.yml. The rule was present incis_nist_mappings.jsonbut missing from the human-maintained product control files, causing a non-emptyCIS - CIS_NISTdiff.Regenerate
shared/references/controls/nist_800_53_cis_reference_{rhel8,rhel9,rhel10}/with the fixed script to reflect both the deduplication fix and the CIS→NIST mapping additions from fab8d57.Rationale:
var_auditd_space_left_action=cis_rhel9appearing 2–3 times in the same control block), making diffs noisy and the output non-idempotent across runs.rsyslog_filecreatemodein the product control files caused the CIS-NIST workflow to report that CIS-NIST did not fully cover CIS for rhel9 and rhel10.Review Hints:
shared/references/controls/are deduplication + sort order fixes plus thersyslog_filecreatemodeadditions; no rules were removed.sync_nist_split.pyfix is ingenerate_controls()around line 474: replacesextend()on a loop over asetwithset.update()+sorted().