Deepen fedramplens 4x: tests, demos, hardening + bug fixes#5
Open
cognis-digital wants to merge 2 commits into
Open
Deepen fedramplens 4x: tests, demos, hardening + bug fixes#5cognis-digital wants to merge 2 commits into
cognis-digital wants to merge 2 commits into
Conversation
Tests (53 -> 242 test functions, all green): - test_core_validation.py: exhaustive boundary/component/flow/POA&M validation + malformed-file error paths + direct-dataclass hardening - test_analysis.py: SC-8 crossing detection (both directions, tokens, missing key), dangling flows, orphans, POA&M overdue/risk/date, coverage math, authorization gate, summary shape - test_oscal.py: SSP + POA&M output shape, deterministic uuids, control-id normalization, DOT structure/escaping - test_sarif_edge.py: envelope, rule de-dup, level mapping + rule-default escalation, preserved properties, empty/robust findings - test_cli.py: every subcommand, all formats, exit codes, error paths - test_datafeeds.py: catalog, cache/age, offline get contract, snapshot round-trip, control normalization/fallback, graceful degrade Demos (5 -> 20 runnable scenarios, each exits 0): - Added 06-20 covering AO risk dashboard, CI gate, coverage report, POA&M tracker, dependency inventory, hygiene lint, High-baseline walkthrough, JSON pipeline, air-gap snapshot transfer, enrichment degrade contract, SARIF rule catalogue, diagram export, SSP deep inspect, error-handling showcase, and a full-package pipeline capstone - run_all.py + docs/DEMOS.md updated Hardening + real bug fixes (public API unchanged): - analyze_boundary raised an uncaught KeyError when a Boundary was built directly via the public dataclass with (a) an out-of-range/uppercased impact or (b) a POA&M severity outside the weight table. Now normalizes impact and raises a clear BoundaryError, and tolerates unknown severity as moderate. - POA&M scheduled-date validation now runs on every item (open or closed), so a malformed date is surfaced as bad_poam_date regardless of status. - _build_boundary rejects non-dict components/flows/POA&M items and a non-list controls field with precise errors. - to_sarif escalates a rule's default level to the most severe finding of its type and tolerates findings missing type/severity/detail. - CLI catches late BoundaryError from analyze/ssp/poam (exit 2).
… PR) The config used the deprecated v4 flat glob syntax; labeler@v5 requires each label to be an array of config options with changed-files / any-glob-to-any-file. It errored 'found unexpected type for label docs' on every pull_request_target run. Migrated all rules and added a demos label.
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.
Quadruples the depth of the repo with real work; public API unchanged.
Tests: 53 -> 242 test functions (all green,
python -m pytest -q)encryptedkey), dangling flows, orphan components, POA&M overdue/risk/date handling, coverage math, authorization gate, summary shape.get()contract, snapshot export/import round-trip, control normalization + enhancement fallback, graceful degrade.All new tests are stdlib-only and never touch the network (offline OSCAL fixture cache).
Demos: 5 -> 20 runnable scenarios (each exits 0 under
PYTHONUTF8=1)Added scenarios 06–20: AO risk dashboard, CI gate + SARIF upload, control-coverage report, POA&M tracker, external-dependency inventory, boundary hygiene lint, High-baseline walkthrough, JSON pipeline integration, air-gap snapshot transfer, enrichment graceful-degrade contract, SARIF rule catalogue, diagram export formats, OSCAL SSP deep-inspect, error-handling showcase, and a full-package pipeline capstone.
run_all.pyanddocs/DEMOS.mdupdated.Error handling + real bug fixes (public API stable)
KeyErrorinanalyze_boundary— aBoundarybuilt directly via the public dataclass with an out-of-range/uppercasedimpact, or a POA&Mseverityoutside the weight table, leaked a rawKeyError. Nowimpactis normalized (and an out-of-range value raises a clearBoundaryError), and an unknown severity is weighted asmoderate.openbranch, so a malformed date on a closed item was silently accepted. Validation now runs on every item;bad_poam_dateis surfaced regardless of status._build_boundarynow rejects non-dict components/flows/POA&M items and a non-listcontrolsfield with precise errors.defaultConfiguration.levelreflected only the first finding of its type; it now escalates to the most severe. Exporter also tolerates findings missingtype/severity/detail.BoundaryErrorfrom analyze/ssp/poam and exits 2 with a clear message.Version bumped 0.4.9 -> 0.5.0.