45 Commits

Author SHA1 Message Date
Dan Brodjieski
361b95e034 chore: fix linting error 2026-07-28 17:10:23 -04:00
Dan Brodjieski
f77fdda03a chore: update cli-tests for macos 27 2026-07-28 17:09:01 -04:00
Dan Brodjieski
d59658ec35 Merge branch 'usnistgov:dev_27' into dev_27 2026-07-28 16:27:21 -04:00
Dan Brodjieski
6801cda82b fix: correct org.opencontainers.image.revision label for non-default-branch builds
docker/metadata-action sets this label from github.sha, which for
workflow_run events is always the default branch's tip, not the
branch that actually triggered the build. entrypoint.sh's update
check reads this label, so dev_27 images always looked stale
against themselves. Override it with the resolved head_sha.
2026-07-16 16:57:59 -04:00
Dan Brodjieski
5b5cda21c8 fix: compare update check against the running image's own tag
entrypoint.sh always checked ghcr's :latest manifest for a newer
build, so non-main images (e.g. dev_27) incorrectly reported an
update available since their SHA never matches main's latest. Bake
the image's tag in at build time and check against that tag instead.
2026-07-16 16:42:58 -04:00
Dan Brodjieski
fd5e75e137 fix: compare update check against the running image's own tag
entrypoint.sh always checked ghcr's :latest manifest for a newer
build, so non-main images (e.g. dev_27) incorrectly reported an
update available since their SHA never matches main's latest. Bake
the image's tag in at build time and check against that tag instead.
2026-07-16 16:42:09 -04:00
Dan Brodjieski
c6e2e0c36a chore: run Lint Code Base on dev_27 pushes
Push-triggered workflows use the branch's own copy, not main's, so
this was needed on dev_27 itself for the container-publish lint gate
to find a matching run.
2026-07-16 16:27:49 -04:00
Dan Brodjieski
53dd084bb1 chore: update container build process 2026-07-16 16:18:33 -04:00
Dan Brodjieski
be948ab684 chore: remove scap cli test from 27 2026-07-16 16:01:30 -04:00
Dan Brodjieski
e23c87fd01 chore: sync actions with main 2026-07-16 15:58:05 -04:00
Dan Brodjieski
7c36be3a8c chore: update container build for 27 2026-07-16 15:40:29 -04:00
Dan Brodjieski
ad13f07d70 chore: update container build process 2026-07-16 15:25:15 -04:00
Dan Brodjieski
b64cdf4c59 Refactor logging, rules, and improve GitHub Actions workflows (#722)
* fix: spinner text info for baseline migration

* fix: update CURRENT_USER discovery

change method to use the loginwindow.plist instead of console

* refactor: release string and format

* chore: correct reference to changelog

Issue #718

* refactor: configure logging to catch early CLI issues

* refactor: clarification and inclusion of custom rules

* refactor: correct platform overrides and adjust adoc/md output

* refactor: alias mobileconfig attribute to match yaml

* refactor: admin functions for release and new rule

* chore: lint cleanup and remove markdownlint

* chore(rule): correct validation issues

* chore: adjust spellcheck to main

* chore: correct spelling issues

* chore: update container build process

* chore: trigger container build on push to main

* chore: gate container build on lint and smoke tests

* chore: pin GitHub Actions to commit SHAs and update Node.js to 22 LTS

Pin all unpinned action references to immutable commit SHAs to prevent
supply chain attacks. Upgrade checkout/setup-node from v3 to v4 in
spellcheck workflow and bump Node.js from 20 (deprecated) to 22 LTS
in build_documentation workflow.

* chore: improve GitHub Actions workflow hygiene

- Pin cspell to 10.0.1 instead of @latest
- Add permissions: contents: read to spellcheck, cli-tests, and generate_baselines workflows
- Add concurrency group to generate_baselines to prevent race conditions on rapid pushes
- Add workflow_dispatch to generate_baselines and spellcheck
- Remove dead push-to-main trigger from labeler (labels PRs only)
- Add paths filter to label-sync pull_request_target trigger
- Remove redundant ref from generate_baselines checkout step
- Pin Python to 3.12.1 in cli-tests for consistency
- Remove unnecessary --user flag from pip install in lint workflow

* chore[deps]: update pillow dependency

* chore[rule]: sync enforcement info

issue #592

* chore[rule]: correct CIS ODV

issue #621

* chore[rule]: correct CIS ODV

issue #621

* refactor: filter out incomplete baselines

* feat: add tag mutation API to RuleLibrary

Stores source_file on Macsecurityrule (excluded from serialization) so
RuleLibrary.add_tag/remove_tag can write back to disk after filtering.
Each unique source file is written at most once to avoid redundant I/O
when the library spans multiple platform/version entries for the same rule.

* feat: add add_benchmark/remove_benchmark to RuleLibrary

Unlike tag mutations, benchmark entries are stored per OS version inside
the platforms dict, so both methods group rules by source file and apply
all version mutations to a single canonical object before writing to avoid
clobbering version entries not covered by the first object encountered.

* fix: switch RuleLibrary mutation write path to text-level patching

rule.to_yaml() was designed for custom/derived output and is lossy when
applied to source files — it flattens per-version CCE/STIG dicts and
renames canonical YAML keys (800-53r5 → nist_800_53r5). Replaced all
mutation method write calls with targeted text-level patching helpers
that modify only the specific lines that change, leaving the rest of
each source file untouched.

* chore: update workflow actions

* fix: include multiple mobileconfig payloads if defined in rule

using suggestion from @adrian-ib, changed the mobileconfig info build-out in the manifest to include multiple payloads if they exist

Issue #723

* chore: fix linting and spellcheck findings

* chore: update build action to recent releases

* fix: correct issue with granular profiles and add date

profiles are now generated with a create date in the description

Issue #678

* chore: updates to container build

add entrypoint that will check if latest container and alert the user if a new one is available

move container support files from project root

* chore: adjust to check for container SHA match

* chore: update container update message

* chore: cleanup progress bar messaging

* refactor: custom logo processing in guidance

when a custom logo file is defined at the CLI, it will be copied to the custom/images/ folder for reference in guidance generation.
2026-07-14 10:43:11 -04:00
Dan Brodjieski
5a4772b29a chore: updates to container build
add entrypoint that will check if latest container and alert the user if a new one is available

move container support files from project root
2026-07-02 13:24:43 -04:00
Dan Brodjieski
0309d69f90 chore: update build action to recent releases 2026-07-01 17:13:38 -04:00
Dan Brodjieski
8821208521 chore: update workflow actions 2026-06-30 13:15:06 -04:00
Dan Brodjieski
1154bd8a90 chore: improve GitHub Actions workflow hygiene
- Pin cspell to 10.0.1 instead of @latest
- Add permissions: contents: read to spellcheck, cli-tests, and generate_baselines workflows
- Add concurrency group to generate_baselines to prevent race conditions on rapid pushes
- Add workflow_dispatch to generate_baselines and spellcheck
- Remove dead push-to-main trigger from labeler (labels PRs only)
- Add paths filter to label-sync pull_request_target trigger
- Remove redundant ref from generate_baselines checkout step
- Pin Python to 3.12.1 in cli-tests for consistency
- Remove unnecessary --user flag from pip install in lint workflow
2026-06-29 10:56:36 -04:00
Dan Brodjieski
9df67ac796 chore: pin GitHub Actions to commit SHAs and update Node.js to 22 LTS
Pin all unpinned action references to immutable commit SHAs to prevent
supply chain attacks. Upgrade checkout/setup-node from v3 to v4 in
spellcheck workflow and bump Node.js from 20 (deprecated) to 22 LTS
in build_documentation workflow.
2026-06-29 10:41:37 -04:00
Dan Brodjieski
f2f5933a74 chore: gate container build on lint and smoke tests 2026-06-26 16:24:08 -04:00
Dan Brodjieski
74e83b7475 chore: trigger container build on push to main 2026-06-26 16:03:20 -04:00
Dan Brodjieski
9cd26e5f8a chore: update container build process 2026-06-26 15:44:20 -04:00
Dan Brodjieski
5cc9e561a5 chore: adjust spellcheck to main 2026-06-26 15:05:13 -04:00
Dan Brodjieski
586f351509 chore: lint cleanup and remove markdownlint 2026-06-26 14:48:06 -04:00
Bob Gendler
80ff0c064c updated to reference main from dev_20 2026-06-22 10:56:06 -04:00
Dan Brodjieski
2e0b9cfde9 Refactor collecting rules, improving performance for admin baselines, fix issue with missing baseline (#708)
* chore: update issue templates

* chore: update issue templates

* refactor: create EnforcementInfo class to support hierarchy

platforms with differing enforcement methods are now correctly captured and generated

* chore: re-add macOS 14 support for initial release

* refactor: split macsecurityrule into references, mobileconfig, and enforcement_info modules

Extracts reference submodels (NistReferences, DisaReferences, CisReferences,
bsiReferences, bzkReferences, hhsReferences, customReferences, References) into
references.py and mobileconfig model + XML rendering utilities into mobileconfig.py.
Consolidates duplicate _create_value_element/_create_static_value_element into a
single create_value_element function. Adds Google-style docstrings throughout and
widens ResultDef fields to accept "$ODV" on all three types.

* refactor: add runtime validation and fix schema issues

- Add @model_validator to ShellCheck, ShellFix, DefaultStateShell enforcing
  that either shell or additional_info (or note) must be provided, and that
  result is required when shell is present on ShellCheck
- Add OdvHint/OdvValidation models in odv.py and a @field_validator on
  Macsecurityrule.odv to catch missing hint fields (e.g. datatype) at runtime
- Wrap Macsecurityrule construction in load_rules with ValidationError handler
  so bad rules are logged and skipped rather than crashing the process
- Switch validate_rules to iter_errors so all failures per file are reported,
  not just the first; improve error output with field path and fix log message
  showing correct rules path; guard against missing id field with .get()
- Fix schema: move if/then/else out of properties in ddmDef, fix
  declarationtype typo in conditional, move additionalProperties out of
  properties on iOS and visionOS, add sfr to disa references, widen
  anyOf constraints on check/fix/default_state to require shell or
  additional_info, clean up redundant type+$ref on array entry,
  update resultDef boolean to not allow $ODV

* feat: add remove_mscp_apple_release and standardize --version flag

Add mscp admin remove subcommand that removes a platform version from
mscp_data.yaml, all rule YAML files, and the JSON schema — the inverse
of mscp admin update. Also renames --new_version to --version on the
update subcommand for consistency.

* refactor: fix version datatype in removal and add success string to validate

* chore: lint cleanup

* fix: re-added missing imports

* removed fix blob from 26 and 14

* feat: add CLI smoke test workflow and --no-docs flag for guidance

Adds a GitHub Actions workflow that smoke-tests key CLI subcommands
(baseline, guidance, scap, admin validate) on every push/PR to dev_2.0.
Adds --no-docs flag to the guidance subcommand to skip asciidoctor/PDF/HTML
generation, allowing CI to test the guidance pipeline without requiring
the Ruby toolchain.

* refactor: adjust CLI tests

* fix: exit 1 when admin validate finds invalid YAML files

* refactor: rename collect_all_rules, fix -l listing, suppress admin spinner

- Rename Macsecurityrule.collect_all_rules -> collect_platform_rules to
  reflect that it filters by a specific OS type and version, not everything
- Fix `baselines -l` to load rules via RuleLibrary.from_rules_dir() so
  benchmarks from all platforms (iOS, visionOS) appear in the listing
- Add suppress_spinner flag to logging_config; set it in build_all_baselines
  so the spinner is fully suppressed during bulk baseline generation
- Replace the suppressed yaspin object with a _NoOpSpinner shim so that
  sp.ok(), sp.fail(), and sp.text assignments are silently swallowed

* perf: avoid repeated collect_platform_rules in admin baselines

Add a preloaded_rules kwarg to generate_baseline so callers can pass
pre-collected rules and skip the collect_platform_rules filesystem walk.

In build_all_baselines, load the full RuleLibrary once and slice it per
platform filtered to args.os_version, matching the original single-call
behavior but without re-reading the rules directory on every iteration.
Fixes duplicate rule_ids that appeared when filtering by platform alone
included rules from multiple OS versions.

Also fixes the absolute import of RuleLibrary introduced by the linter.

* chore[rule]: correct yaml linting

---------

Co-authored-by: Bob Gendler <robert.gendler@nist.gov>
2026-06-19 21:38:28 -04:00
Dan Brodjieski
f7fa180505 chore: update spellcheck workflow 2026-06-16 09:58:46 -04:00
Dan Brodjieski
3632115c2f chore: update workflows 2026-06-16 08:38:39 -04:00
Bob Gendler
0702ac6906 Update paths for committing build number changes 2026-05-13 10:05:24 -04:00
Bob Gendler
720432a435 Update file path for mscp-data.yaml in workflow 2026-05-13 09:58:54 -04:00
Dan Brodjieski
7d7808f9bc chore: only run generate/bump on main repo 2026-04-16 13:37:42 -04:00
Dan Brodjieski
eee6725fda fix: correct path in action 2026-04-16 13:32:35 -04:00
Dan Brodjieski
0bf10e3d80 refactor: admin baseline generator to default folder
update action to generate baselines  and increment build number
2026-04-16 13:27:38 -04:00
Dan Brodjieski
4d3d81b109 chore: change build bump to exclude forks 2026-04-15 14:37:49 -04:00
Dan Brodjieski
fdeeb46178 chore: update spellcheck dependency 2026-04-15 12:37:06 -04:00
Dan Brodjieski
34e52e0f38 add build to bump commit message 2026-04-09 18:14:02 -04:00
Dan Brodjieski
39ced7ce71 add version incrementing action 2026-04-09 18:11:07 -04:00
Dan Brodjieski
7850d9fbda restore: add missing components for customization 2025-12-12 11:09:53 -05:00
Dan Brodjieski
b1deb07f57 Revert "Merge branch 'dev_2.0' into dev_2.0"
This reverts commit 6ac2dc6805, reversing
changes made to 60b04555fd.
2025-11-14 12:04:08 -05:00
Dan Brodjieski
fea8e9f5d3 chore: add spell check workflow 2025-09-15 17:04:30 -04:00
Stephen Beale
5fd93435d6 refactor(actions): Correct python linting
- Add if checks to all steps for if files are changed
2025-08-06 14:08:55 -06:00
Stephen Beale
d85f20664b Update workflows to include 'dev_2.0' branch for label sync, labeler, linting, and renovate processes 2025-07-16 14:48:06 -06:00
Stephen Beale
56795d1725 Add new scripts for generating compliance reports and mappings
- Implemented `script.py` for generating compliance scripts with Jinja2 templating and audit plist creation.
- Created `local_report.py` to generate local compliance reports in Excel and HTML formats, including pie chart visualizations.
- Developed `mapping.py` to update security rules with custom controls based on CSV input and generate baseline YAML files.
- Introduced `scap.py` for creating SCAP-compliant XML files, with support for different OS types and export formats.
2025-07-16 13:48:18 -06:00
Dan Brodjieski
45e16a9fd3 removed workflow, updated schema 2025-04-11 16:55:29 -04:00
Dan Brodjieski
cce3996219 Update branch_merge.yml 2025-04-11 16:34:03 -04:00
Dan Brodjieski
8ad7d6f097 add workflow to merge from actions 2025-04-11 16:29:58 -04:00