From ac47899067c348aa0db3fcccce60edfd05670ee2 Mon Sep 17 00:00:00 2001 From: Gabeblis Date: Thu, 9 Jan 2025 16:33:25 +0000 Subject: [PATCH] Add 'inventory-item-has-hardware-model' constraints and tests --- features/fedramp_extensions.feature | 3 +++ .../rev5/examples/ssp/xml/fedramp-ssp-example.oscal.xml | 9 +++++++++ .../ssp-inventory-item-has-hardware-model-INVALID.xml | 7 +++++++ .../constraints/fedramp-external-constraints.xml | 5 +++++ .../inventory-item-has-hardware-model-FAIL.yaml | 9 +++++++++ .../inventory-item-has-hardware-model-PASS.yaml | 9 +++++++++ 6 files changed, 42 insertions(+) create mode 100644 src/validations/constraints/content/ssp-inventory-item-has-hardware-model-INVALID.xml create mode 100644 src/validations/constraints/unit-tests/inventory-item-has-hardware-model-FAIL.yaml create mode 100644 src/validations/constraints/unit-tests/inventory-item-has-hardware-model-PASS.yaml diff --git a/features/fedramp_extensions.feature b/features/fedramp_extensions.feature index 9305b7aaf..8f36af969 100644 --- a/features/fedramp_extensions.feature +++ b/features/fedramp_extensions.feature @@ -125,6 +125,7 @@ Examples: | inventory-item-allows-authenticated-scan | | inventory-item-and-component-has-public | | inventory-item-has-function | + | inventory-item-has-hardware-model | | inventory-item-has-scan-type | | inventory-item-has-software-name | | inventory-item-has-software-version | @@ -392,6 +393,8 @@ Examples: | inventory-item-and-component-has-public-PASS.yaml | | inventory-item-has-function-FAIL.yaml | | inventory-item-has-function-PASS.yaml | + | inventory-item-has-hardware-model-FAIL.yaml | + | inventory-item-has-hardware-model-PASS.yaml | | inventory-item-has-scan-type-FAIL.yaml | | inventory-item-has-scan-type-PASS.yaml | | inventory-item-has-software-name-FAIL.yaml | diff --git a/src/content/rev5/examples/ssp/xml/fedramp-ssp-example.oscal.xml b/src/content/rev5/examples/ssp/xml/fedramp-ssp-example.oscal.xml index f1b3b3ce6..63c46b19d 100644 --- a/src/content/rev5/examples/ssp/xml/fedramp-ssp-example.oscal.xml +++ b/src/content/rev5/examples/ssp/xml/fedramp-ssp-example.oscal.xml @@ -2310,6 +2310,7 @@ approved.

Legacy Example (No implemented-component).

+ @@ -2365,6 +2366,7 @@ approved.

Component Inventory Example

+ @@ -2408,6 +2410,7 @@ approved.

None.

+ @@ -2430,6 +2433,7 @@ approved.

None.

+ @@ -2447,6 +2451,7 @@ approved.

None.

+ @@ -2468,6 +2473,7 @@ approved.

None.

+ @@ -2493,6 +2499,7 @@ approved.

None.

+ @@ -2513,6 +2520,7 @@ approved.

None.

+ @@ -2537,6 +2545,7 @@ approved.

Email-Service

+ diff --git a/src/validations/constraints/content/ssp-inventory-item-has-hardware-model-INVALID.xml b/src/validations/constraints/content/ssp-inventory-item-has-hardware-model-INVALID.xml new file mode 100644 index 000000000..08c896ed1 --- /dev/null +++ b/src/validations/constraints/content/ssp-inventory-item-has-hardware-model-INVALID.xml @@ -0,0 +1,7 @@ + + + + + + + \ 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 116c62800..863d9a0f4 100644 --- a/src/validations/constraints/fedramp-external-constraints.xml +++ b/src/validations/constraints/fedramp-external-constraints.xml @@ -692,6 +692,11 @@ Every inventory-item MUST provide remarks to describe the function of the item, either within the inventory-item itself, or within the component linked by the inventory-item. + + Inventory Item Has Hardware Model + + In a FedRAMP SSP, each inventory item MUST provide the hardware model either in the inventory item itself or within the linked component. + Inventory Item Has Scan Type diff --git a/src/validations/constraints/unit-tests/inventory-item-has-hardware-model-FAIL.yaml b/src/validations/constraints/unit-tests/inventory-item-has-hardware-model-FAIL.yaml new file mode 100644 index 000000000..bd3ccafde --- /dev/null +++ b/src/validations/constraints/unit-tests/inventory-item-has-hardware-model-FAIL.yaml @@ -0,0 +1,9 @@ +test-case: + name: Negative Test for inventory-item-has-hardware-model + description: >- + This test case validates the behavior of constraint + inventory-item-has-hardware-model + content: ../content/ssp-inventory-item-has-hardware-model-INVALID.xml + expectations: + - constraint-id: inventory-item-has-hardware-model + result: fail diff --git a/src/validations/constraints/unit-tests/inventory-item-has-hardware-model-PASS.yaml b/src/validations/constraints/unit-tests/inventory-item-has-hardware-model-PASS.yaml new file mode 100644 index 000000000..f6fff17c8 --- /dev/null +++ b/src/validations/constraints/unit-tests/inventory-item-has-hardware-model-PASS.yaml @@ -0,0 +1,9 @@ +test-case: + name: Positive Test for inventory-item-has-hardware-model + description: >- + This test case validates the behavior of constraint + inventory-item-has-hardware-model + content: ../../../content/rev5/examples/ssp/xml/fedramp-ssp-example.oscal.xml + expectations: + - constraint-id: inventory-item-has-hardware-model + result: pass