Skip to content

nist_sync: split ControlCatalogs by NIST family - #15115

Merged
Mab879 merged 1 commit into
ComplianceAsCode:masterfrom
ggbecker:split-gemara-format-into-groups
Oct 29, 2026
Merged

Mab879 merged 1 commit into
ComplianceAsCode:masterfrom
ggbecker:split-gemara-format-into-groups

Conversation

@ggbecker

Copy link
Copy Markdown
Member

Description:

  • Add split-by-family Gemara ControlCatalog generation for NIST SP 800-53.
  • Generate one catalog per NIST family for each product, matching the complytime-policies repository layout.
  • Update PR staging to copy the family catalogs into the expected governance catalog directories.
  • Disable unwanted YAML aliases during Gemara and bundle generation.

Rationale:

  • The split catalog format is required by complytime-policies and keeps each catalog scoped to a single NIST 800-53 family.
  • Smaller family-specific catalogs make updates, reviews, and downstream consumption easier.
  • Disabling automatic aliases prevents spurious YAML anchors caused by object ID reuse during serialization.

Review Hints:

  • Review the changes together across:

    • utils/nist_sync/export_to_gemara.py
    • utils/nist_sync/gemara/catalog.py
    • utils/nist_sync/generate_policies_pr.py
    • utils/nist_sync/generate_complyctl_bundle.py
  • Generate artifacts for all supported products:

    python3 utils/nist_sync/export_to_gemara.py \
        --products rhel8,rhel9,rhel10,fedora \
        --output-dir build/gemara \
        --validate

@ggbecker ggbecker added this to the 0.1.83 milestone Sep 10, 2026
@ggbecker ggbecker added the Infrastructure Our content build system label Sep 10, 2026
@ggbecker
ggbecker marked this pull request as draft September 10, 2026 19:13
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Sep 10, 2026
@ggbecker
ggbecker force-pushed the split-gemara-format-into-groups branch from b1a6a65 to 1f5094a Compare September 11, 2026 09:41
@ggbecker
ggbecker marked this pull request as ready for review September 11, 2026 09:45
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Sep 11, 2026
@macko1 macko1 self-assigned this Oct 2, 2026
@ggbecker

ggbecker commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

This PR complytime/complytime-policies#53 has contents from this PR

@ggbecker

ggbecker commented Oct 29, 2026 •

Copy link
Copy Markdown
Member Author

I'm self-merging this pull request as it has been a long standing PR and it has been already used to submit changes to complytime/complytime-policies#53

This is to allow us to proceed with related work with regards to NIST 800-53 and Gemara/Complytime.

Rebasing the PR before merging it.

…iases

Match the layout complytime-policies uses (see complytime/complytime-
policies#55): one ControlCatalog per NIST 800-53 family (AC, AU, SI, ...)
alongside the existing combined catalog, so files stay reviewable and
each catalog's 'groups' scope is a single family.

- gemara/catalog.py: add GemaraCatalogBuilder.build_by_group(), returning
  one catalog dict per family with a family-scoped metadata id/description
  and title suffix.
- export_to_gemara.py: write the per-family catalogs to
  build/gemara/{product}/by_group/nist-800-53-rev5-{product}-{family}-catalog.yaml.
- generate_policies_pr.py: stage those into
  governance/catalogs/nist-800-53/{product}/nist-800-53-{product}/, matching
  the complytime-policies directory structure.

Also fix a pre-existing bug hit while generating these: ruamel.yaml aliases
list/dict objects by id(), and CPython can reuse the same id() for distinct
short-lived lists of equal length (e.g. repeated ['fedora-low'] built fresh
in a loop). This silently collapsed unrelated 'applicability' lists into
YAML anchors/aliases (&id001 / *id001) in the generated catalogs. Set
representer.ignore_aliases = lambda data: True in every script that dumps
these structures (export_to_gemara.py, generate_policies_pr.py,
generate_complyctl_bundle.py) to disable aliasing entirely.
@ggbecker
ggbecker force-pushed the split-gemara-format-into-groups branch from 1f5094a to 8b37e9d Compare October 29, 2026 14:15
@Mab879 Mab879 self-assigned this Oct 29, 2026
@Mab879
Mab879 merged commit 9b6a644 into ComplianceAsCode:master Oct 29, 2026
74 of 81 checks passed
ggbecker added a commit to ggbecker/content that referenced this pull request Nov 5, 2026
The export-to-gemara workflow only runs on push to master and on a
schedule, so a broken nist_sync script (like the missing
gemara/yaml_output.py in ComplianceAsCode#15115) is invisible until after merge.

Add a PR-triggered gate that, on changes under utils/nist_sync/ or the
NIST 800-53 control files:
  - imports every script (--help) so a missing module fails fast,
  - runs the full export with --validate and fails on any [WARN]/[ERROR]/
    FAIL marker (the export itself only warns and exits 0),
  - runs the export test suite,
  - runs generate_complyctl_bundle.py and generate_policies_pr.py.

The gate uses the in-Python structural validation rather than CUE, so it
needs no external schema/binary pins; authoritative CUE validation stays
in export-to-gemara.yml.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Infrastructure Our content build system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants