From 606e3b9d5dd03baec1257878f443ae4b5be9455c Mon Sep 17 00:00:00 2001 From: "A.J. Stein" Date: Tue, 29 Oct 2024 16:17:55 -0400 Subject: [PATCH] Add initial constraint and tests for #833 --- features/fedramp_extensions.feature | 3 ++ ...ersion-matches-fedramp-version-INVALID.xml | 6 ++++ .../fedramp-external-constraints.xml | 31 +++++++++++++++++-- ...-version-matches-fedramp-version-FAIL.yaml | 9 ++++++ ...-version-matches-fedramp-version-PASS.yaml | 9 ++++++ 5 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 src/validations/constraints/content/ssp-oscal-version-matches-fedramp-version-INVALID.xml create mode 100644 src/validations/constraints/unit-tests/oscal-version-matches-fedramp-version-FAIL.yaml create mode 100644 src/validations/constraints/unit-tests/oscal-version-matches-fedramp-version-PASS.yaml diff --git a/features/fedramp_extensions.feature b/features/fedramp_extensions.feature index a077d5966..72467c8b0 100644 --- a/features/fedramp_extensions.feature +++ b/features/fedramp_extensions.feature @@ -125,6 +125,8 @@ Examples: | inventory-item-virtual-PASS.yaml | | missing-response-components-FAIL.yaml | | missing-response-components-PASS.yaml | + | oscal-version-matches-fedramp-version-FAIL.yaml | + | oscal-version-matches-fedramp-version-PASS.yaml | | privilege-level-FAIL.yaml | | privilege-level-PASS.yaml | | resource-has-base64-or-rlink-FAIL.yaml | @@ -219,6 +221,7 @@ Examples: | inventory-item-public | | inventory-item-virtual | | missing-response-components | + | oscal-version-matches-fedramp-version | | privilege-level | | prop-response-point-has-cardinality-one | | resource-has-base64-or-rlink | diff --git a/src/validations/constraints/content/ssp-oscal-version-matches-fedramp-version-INVALID.xml b/src/validations/constraints/content/ssp-oscal-version-matches-fedramp-version-INVALID.xml new file mode 100644 index 000000000..2f65b1f64 --- /dev/null +++ b/src/validations/constraints/content/ssp-oscal-version-matches-fedramp-version-INVALID.xml @@ -0,0 +1,6 @@ + + + 2.0.0 + + + \ No newline at end of file diff --git a/src/validations/constraints/fedramp-external-constraints.xml b/src/validations/constraints/fedramp-external-constraints.xml index 9058088c6..67066dc0a 100644 --- a/src/validations/constraints/fedramp-external-constraints.xml +++ b/src/validations/constraints/fedramp-external-constraints.xml @@ -31,6 +31,33 @@ + + + + + + + + + + + + + + + A FedRAMP document SHOULD have an OSCAL version that matches the minimally required version for FedRAMP packages, {$fedramp-version-oscal-part}, not {../oscal-version}. DEBUG: {$major-version-valid} {$minor-version-valid} {$patch-version-valid} + + + @@ -168,7 +195,7 @@ - + There must be at least two (2) data centers listed. @@ -199,7 +226,7 @@ A FedRAMP SSP must define a role for the point of contact for an information system security officer. - + diff --git a/src/validations/constraints/unit-tests/oscal-version-matches-fedramp-version-FAIL.yaml b/src/validations/constraints/unit-tests/oscal-version-matches-fedramp-version-FAIL.yaml new file mode 100644 index 000000000..b04b36f0c --- /dev/null +++ b/src/validations/constraints/unit-tests/oscal-version-matches-fedramp-version-FAIL.yaml @@ -0,0 +1,9 @@ +test-case: + name: Negative Test for oscal-version-matches-fedramp-version + description: >- + This test case validates the behavior of constraint + oscal-version-matches-fedramp-version + content: ../content/ssp-oscal-version-matches-fedramp-version-INVALID.xml + expectations: + - constraint-id: oscal-version-matches-fedramp-version + result: fail diff --git a/src/validations/constraints/unit-tests/oscal-version-matches-fedramp-version-PASS.yaml b/src/validations/constraints/unit-tests/oscal-version-matches-fedramp-version-PASS.yaml new file mode 100644 index 000000000..4b2425c1a --- /dev/null +++ b/src/validations/constraints/unit-tests/oscal-version-matches-fedramp-version-PASS.yaml @@ -0,0 +1,9 @@ +test-case: + name: Positive Test for oscal-version-matches-fedramp-version + description: >- + This test case validates the behavior of constraint + oscal-version-matches-fedramp-version + content: ../content/ssp-all-VALID.xml + expectations: + - constraint-id: oscal-version-matches-fedramp-version + result: pass